Description
Blink, in particular @yuki3, is thinking about implementing the incumbent concept in Q2. However, I wanted to check in first to see if maybe we should change the spec to use what Blink currently does, in case it is simpler. /cc @bzbarsky @bholley
There
Some discussion has already taken place in the margins of a Blink quarter-planning doc, but let's move it here. There @yuki3 says:
What Blink is currently doing for Incumbent realm is:
// Blink returns a function object created in the Current realm. f = iframe.contentWindow.location.replace; // Use |f|'s creation realm as the Incumbent realm. f('url');This is a totally different approach from the spec, but works the same for most cases, just because the calling realm of |f| is luckily the Current realm for most cases.
I believe this "function object created in the current realm" business matches the spec already, as of last year's work on cross-origin properties. So the question is about using f's realm (i.e., the current realm at the time the algorithm is running) vs. the incumbent realm.
Going through the examples in the spec in the linked section, as far as I can tell this means:
- Blink uses the current Realm for the MessageChannel example
- Blink uses
window
for the postMessage.bind example, via a much simpler path than the spec. - Blink uses
a
's environment settings object for the "final even more convoluted example", via a much simpler path than the spec.
I'm not sure what other test cases we might want to involve, but this does seem pretty nice and simple. @bzbarsky, can you think of any downsides to switching to Blink's version? Concretely, I guess that would mean replacing all references to "incumbent settings object" with "current settings object"---which is kind of where we were heading anyway, via #1430.
(This seems too easy, so I'm probably missing something...)
There's also at least some chance (untested) that Blink and WebKit still match, which would imply a shorter path to interop via aligning with Blink.