-
Notifications
You must be signed in to change notification settings - Fork 165
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
Is a subclass still a platform object? #540
Comments
FWIW, it seems that at least Chrome shifts the relevant global object in that case, see: .<iframe></iframe>
<script>
class X extends frames[0].EventTarget {};
obj = new X();
obj.addEventListener("hi", () => w(window.event));
obj.dispatchEvent(new Event("hi"));
</script> |
So in Gecko, if you do your example above, I am pretty sure that |
Yeah, Henri said that's what happened with his patch in https://bugzilla.mozilla.org/show_bug.cgi?id=218415. For Chrome it's window though. 😟 |
Hrm. In the end you're executing Anyway, here's a less-magical testcase for this:
(live at http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=5856). And yes, Firefox and Chrome disagree here. Firefox logs Safari logs Given that, sounds like Chrome is the odd one out in terms of what it does here.... |
And for extra excitement, here's another interesting testcase:
live at http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=5859. Here Chrome logs |
Oh, also, even in today's spec https://heycam.github.io/webidl/#interface-object creation steps step 11 asserts that the newly-created thing's Realm is the realm of the constructor, not of the NewTarget. Which is an assert Chrome would fail. Looks like that assert is not clearly supported by any normative requirements, though. Those normative requirements used to exist, but were removed in 4a8f57e2 for some reason. Before that, there were clear statements like:
which seem to be gone now. @tobie, @domenic, why did those get removed? |
So to make sure we're on the same page here, we're looking at both interface objects and named constructors, right? Prior to 4a8f57e, there were no additional normative requirements for platform objects created by interface objects to be of the same Realm as the interface object that constructed them beyond the Wrt to named constructors, that requirement is still there, it just was rephrase a bit and moved to the second paragraph of §3.6.2. Named constructors (emphasis mine):
This should be also fixed in the same platform object creation algorithm. Does that make sense? Am I missing anything? |
That all sounds correct. What's unique here is that the "interface object" is in userland. |
Yes, but I believe there were such requirements earlier on. I didn't dig further back in history to double-check, though.
new.target is in userland, if by that you mean page-script-defined. The actual constructor that's running is not. And yes, we're talking about both named constructors and interface objects. |
I think this is all fully defined now. |
So how is #540 (comment) defined? Presumably it at least requires changes in DOM of some kind? |
We talked about this a bit on IRC: https://freenode.logbot.info/whatwg/20190227#c2028215 |
And the conclusion there was that the remainder is effectively #135. |
Related a bit to #533.
I'm wondering if a subclass of, .e.g.,
EventTarget
, would still be considered a platform object. Otherwise we need to expand the definition of "relevant global object" and potentially other such concepts.And even then we might need to clarify things here, e.g.,
The text was updated successfully, but these errors were encountered: