- From: Ms2ger <notifications@github.com>
- Date: Mon, 11 Feb 2019 08:41:17 -0800
- To: heycam/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <heycam/webidl/pull/635/review/202211112@github.com>
Ms2ger commented on this pull request. > @@ -12346,12 +12361,54 @@ It is the responsibility of specifications using Web IDL to state which global environment (or, by proxy, which global object) each platform object is associated with. +<div algorithm> + To create a <dfn export>new</dfn> object implementing the interface |interface|, with either + a Realm |realm| or a `new.target` value |newTarget|, perform the following steps: + + 1. If |newTarget| is provided, then: + 1. Set |realm| to [$GetFunctionRealm$](|newTarget|). @bzbarsky makes an interesting point that this might not be the right realm after all. Assuming no other interfering bugs in the test case below, I see Gecko and WebKit using the constructor's realm, and Chrome using the NewTarget's. <details> <summary>Test</summary> http://software.hixie.ch/utilities/js/live-dom-viewer/saved/6603 ```html <!DOCTYPE html> <script> function f(i) { var dp = new DOMParser(); w(dp.parseFromString("x", "text/html").documentURI) dp = new i.contentWindow.DOMParser(); w(dp.parseFromString("x", "text/html").documentURI) class X extends DOMParser {} dp = new X(); w(dp.parseFromString("x", "text/html").documentURI) class Y extends i.contentWindow.DOMParser {} dp = new Y(); w(dp.parseFromString("x", "text/html").documentURI) } </script> <iframe src=document onload=f(this)></iframe> ``` With `http://software.hixie.ch/utilities/js/` stripped from all results: | Test | Gecko | WebKit | Chrome | |-|-|-|-| | parent `DOMParser` | `live-dom-viewer/` | `live-dom-viewer/` | `live-dom-viewer/` | | subframe `DOMParser` | `live-dom-viewer/document` | `live-dom-viewer/document` | `live-dom-viewer/document` | | subclass of parent `DOMParser` | `live-dom-viewer` | `live-dom-viewer` | `live-dom-viewer` | | subclass of subframe `DOMParser` | `live-dom-viewer/document` | `live-dom-viewer/document` | `live-dom-viewer` | </details> -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/heycam/webidl/pull/635#pullrequestreview-202211112
Received on Monday, 11 February 2019 16:41:39 UTC