Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when target(in Value.preserveToString) is undefined #470

Closed
wants to merge 2 commits into from

Conversation

gnh1201
Copy link
Contributor

@gnh1201 gnh1201 commented Apr 30, 2021

@codecov-commenter
Copy link

codecov-commenter commented Apr 30, 2021

Codecov Report

Merging #470 (d00ef8f) into master (8d44bc1) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #470   +/-   ##
=======================================
  Coverage   86.05%   86.05%           
=======================================
  Files           2        2           
  Lines        2352     2352           
  Branches      607      607           
=======================================
  Hits         2024     2024           
  Misses        328      328           
Impacted Files Coverage Δ
es6-shim.js 87.57% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d44bc1...d00ef8f. Read the comment docs.

@gnh1201 gnh1201 changed the title Fix crash when target(parameter of Value.preserveToString) is undefined in WSH Fix crash when target(parameter of Value.preserveToString) is undefined in WSH with babel-polyfill Apr 30, 2021
@gnh1201 gnh1201 changed the title Fix crash when target(parameter of Value.preserveToString) is undefined in WSH with babel-polyfill Fix crash when target Value.preserveToString is undefined in WSH with babel-polyfill Apr 30, 2021
@gnh1201 gnh1201 changed the title Fix crash when target Value.preserveToString is undefined in WSH with babel-polyfill Fix crash when target(in Value.preserveToString) is undefined in WSH with babel-polyfill Apr 30, 2021
@gnh1201 gnh1201 changed the title Fix crash when target(in Value.preserveToString) is undefined in WSH with babel-polyfill Fix crash when target(in Value.preserveToString) is undefined Apr 30, 2021
Copy link
Collaborator

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just like with the previous change, I would much prefer to locate the specific caller of ES.preserveToString rather than papering over the problem here.

@gnh1201
Copy link
Contributor Author

gnh1201 commented Apr 30, 2021

* typeof(globals.Reflect): object
* typeof(ReflectShims.defineProperty): undefined   <-- error
overrideNative(globals.Reflect, 'defineProperty', ReflectShims.defineProperty);

This means that globals.Reflect variable is going to be undefined.

How can I fix a problem that ReflectShims.defineProperty is undefined?

@ljharb
Copy link
Collaborator

ljharb commented Apr 30, 2021

Ah - if Reflect exists but Reflect.defineProperty does not, then that block of code should do branch, and call defineProperty versus overrideNative.

@gnh1201
Copy link
Contributor Author

gnh1201 commented Jul 29, 2021

Found a better solution.

@gnh1201 gnh1201 closed this Jul 29, 2021
@ljharb
Copy link
Collaborator

ljharb commented Jul 29, 2021

@gnh1201 what better solution? Is #467 still an issue?

gnh1201 added a commit to gnh1201/es6-shim that referenced this pull request Jul 29, 2021
* Reverted from paulmillr#466 - No need to check that this is 'undefined'.
* This pull request fix the following issue: paulmillr#470 paulmillr#467
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants