-
-
Notifications
You must be signed in to change notification settings - Fork 411
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
Uncaught TypeError when calling method on global object #1987
Comments
It turns out that we have two bugs related to the global object:
The first issue is relatively easy to fix: we can just insert properties in the global object when we initialize builtins. In theory, we should not create bindings for these, and the global environment should check if a variable is part of the global object or one of the global bindings, but removing the insertion into the global bindings breaks around 50k tests. The second issue is trickier, since when the global object gets constructed, the |
The way the global object currently works is, that it uses special internal object methods defiend in I think the best way to fix this issue is to add a While the spec currently does not define that the prototype of the global object should be |
This Pull Request closes #894. It changes the following: - Adds the `encodeURI()`, `decodeURI()`, `encodeURIComponent()` and `decodeURIComponent()` functions - Passes all the tests except for those depending on #1987 or on the comment below. Things to discuss: - I'm unable to find in the spec information regarding the only failing tests, which relate to [this](https://github.com/tc39/test262/blob/f1870753fa616261193b99f79d996889921b3404/test/built-ins/encodeURI/S15.1.3.3_A1.1_T2.js): > If string.charAt(k) in [0xDC00 - 0xDFFF], throw URIError Let me know your thoughts :) Co-authored-by: raskad <[email protected]>
Calling a method of the global object (using
this
/globalThis
) results in aTypeError
.To Reproduce
This JavaScript code reproduces the issue:
Expected behavior
true
is printedActual behavior
Uncaught "TypeError": "not a callable function"
is printed.Additional context
At least one test in the test suite requires the expected behavior above.
The text was updated successfully, but these errors were encountered: