RESOLVED DUPLICATE of bug 11388 185243
iframe.contentWindow.document not accessible only on WebKit.
https://bugs.webkit.org/show_bug.cgi?id=185243
Summary iframe.contentWindow.document not accessible only on WebKit.
Emilio Cobos Álvarez (:emilio)
Reported 2018-05-03 01:50:32 PDT
Created attachment 339399 [details] test.html See the testcase incoming, which does something useful in every other browser.
Attachments
test.html (669 bytes, text/html)
2018-05-03 01:50 PDT, Emilio Cobos Álvarez (:emilio)
no flags
Danyao Wang
Comment 1 2018-05-03 07:39:25 PDT
The problem doesn't seem to be with iframe.contentWindow.document. If I just add "var frm = document.getElementById('frm');" at the beginning, WebKit behaves identically to Chrome. I don't think it's standard to be able to reference HTML element by ID as named variables in JavaScript. I could be wrong.
Ali Juma
Comment 2 2018-05-03 09:10:19 PDT
(In reply to Danyao Wang from comment #1) > The problem doesn't seem to be with iframe.contentWindow.document. If I just > add "var frm = document.getElementById('frm');" at the beginning, WebKit > behaves identically to Chrome. > > I don't think it's standard to be able to reference HTML element by ID as > named variables in JavaScript. I could be wrong. See bug 183087; the id becomes a global variable unless it gets shadowed by another explicitly declared global variable. So if adding "var frm = document.getElementById('frm');" changes behavior in this example, that sounds like a bug, since frm should already be referring to that element.
Chris Dumez
Comment 3 2018-05-03 09:27:57 PDT
I believe the issue is that WebKit wrongly uses the iframe's id as the iframe's window name. Because of the ordering of Window's named property getter, we return the iframe's window that matches 'frm' instead of the iframe with id 'frm'.
Chris Dumez
Comment 4 2018-05-03 09:53:08 PDT
(In reply to Chris Dumez from comment #3) > I believe the issue is that WebKit wrongly uses the iframe's id as the > iframe's window name. Because of the ordering of Window's named property > getter, we return the iframe's window that matches 'frm' instead of the > iframe with id 'frm'. Ironically, looks like I fixed this in Blink a long time ago :) https://bugs.chromium.org/p/chromium/issues/detail?id=347169
Chris Dumez
Comment 5 2018-05-03 10:37:07 PDT
*** This bug has been marked as a duplicate of bug 11388 ***
Emilio Cobos Álvarez (:emilio)
Comment 6 2018-05-03 10:45:19 PDT
(In reply to Chris Dumez from comment #4) > (In reply to Chris Dumez from comment #3) > > I believe the issue is that WebKit wrongly uses the iframe's id as the > > iframe's window name. Because of the ordering of Window's named property > > getter, we return the iframe's window that matches 'frm' instead of the > > iframe with id 'frm'. > > Ironically, looks like I fixed this in Blink a long time ago :) > https://bugs.chromium.org/p/chromium/issues/detail?id=347169 Lol. Ok, thanks a lot, now I can report the CSS bug I really wanted to report :-)
Note You need to log in before you can comment on or make changes to this bug.