-
Notifications
You must be signed in to change notification settings - Fork 162
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
Issues with callables, realms, and proxies #847
Comments
Interesting; I hadn't realized Gecko currently does not use Anyway, I agree that if this part is specced to call |
Revoked Proxies ultimately do throw a TypeError when you actually attempt to call them in step 2 here. Naively I expect specs handling GetFunctionRealm's thrown TypeError to be not observably different from whatever happens today, unless the times of getting the Realm and the time of calling the callable differ. One place where the times do differ is Promises, which raises another question. I'll continue the discussion back at tc39/ecma262#1597. |
For the purposes of Web IDL callback functions, Chrome also uses the realm in which the object was created. For the purposes of determining entry realm for promise handlers, Chrome (actually V8) uses GetFunctionRealm with a fallback to the current realm. |
GetFunctionRealm already falls back to the current Realm, though there's a note saying that should only occur for "a non-standard function exotic object", whatever that is. |
(GetFunctionRealm does not fall back to the current Realm for revoked proxies. V8 does however.) |
Discovered by @syg in a different context: tc39/ecma262#1597 (comment)
First, an easy problem.
This should probably use GetFunctionRealm, which handles callable proxies and bound function objects.
OK, but callable proxies have an additional issue. Given
we have IsCallable(proxy) being true, but GetFunctionRealm(proxy) throws a TypeError. I don't think any uses of "associated Realm" throughout the web spec land are prepared for TypeErrors.
One particular case is in https://heycam.github.io/webidl/#es-invoking-callback-functions and its nearby counterparts. That should probably rethrow the TypeError, or convert it to a rejected Promise, as appropriate.
The text was updated successfully, but these errors were encountered: