Issue metadata
Sign in to add a comment
|
instanceof not work on new window
Reported by
baess...@gmail.com,
Jun 6 2018
|
||||||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36 Steps to reproduce the problem: 1. const newWindow= window.open() 2. add html on newWindow 3. find a node on html body on newWindow and check instanceOf HTMLElement. This will return false What is the expected behavior? instanceOf work with object subtypes on code running on new window What went wrong? all js libraries used on new window failed on every instanceOf check Did this work before? N/A Chrome version: 66.0.3359.181 Channel: n/a OS Version: 6.1 (Windows 7, Windows Server 2008 R2) Flash Version:
,
Jun 7 2018
,
Jun 7 2018
The same code return false on second log, on my chrome browser (see attached file). Firefox ok. Safari same problem
,
Jun 7 2018
baesso91@ Thanks for the issue. Tested this issue on Windows 10 and Mac OS 10.13.3 on the reported version and the latest Canary as per comment #1. 1. Launched Chrome and navigated to http://jsbin.com/labahub/edit?html,js,console,output. 2. Before allowing the popups on the page, can see Type Error on the Console. 3. After allowing the popups on the page, and reloading the page, a new tab is opened and the output in the Console of the previous tab is True, False. Whereas in Firefox the output is True, True. Attached is the screen cast for reference. dtapuska@ Request you to check and update if anything is missed from our end in triaging the issue. Thanks...
,
Jul 5
Trivial repro: data:text/html,<iframe srcdoc=""></iframe><script>console.log(document.querySelector('iframe').contentDocument instanceof Document)</script>
We've run into this before. Basically what's going on here is that we're reporting the ECMAScript sense of instanceof: since the two frames have separate global objects, there are separate HTMLElement.prototype and so on. Since each is only on the prototype chain for elements of that context, OrdinaryHasInstance reports that it's not an instance.
Firefox continues to implement a behavior that has since been removed from the WebIDL spec, which overrode this behavior in the specific case of WebIDL interfaces.
See also:
https://github.com/heycam/webidl/pull/356
https://bugs.chromium.org/p/chromium/issues/detail?id=717016
And the Mozilla bug to match us:
https://bugzilla.mozilla.org/show_bug.cgi?id=1360715
And there's a WPT test (WebIDL/ecmascript-binding/has-instance.html) that asserts that this is so.
|
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by dtapu...@chromium.org
, Jun 6 2018