Closed
Bug 618827
Opened 14 years ago
Closed 13 years ago
JS: instanceof fails when object's constructor is initialized from an iframe
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
blocking2.0 | --- | betaN+ |
People
(Reporter: bkon, Assigned: gal)
Details
(Keywords: regression)
Attachments
(1 file)
385 bytes,
text/html
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.215 Safari/534.10 Build Identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b7) Gecko/20100101 Firefox/4.0b7 When an object constructor is initialized from an iframe, instanceof incorrectly returns false when applied to an recently created object. Reproducible: Always Steps to Reproduce: 1. Create a sample html file with contents displayed below: <body> <script type="text/javascript"> var iframe = document.createElement("iframe"); iframe.style.display = "none"; document.body.appendChild(iframe); // write a script into the <iframe> and steal its Array object frames[frames.length - 1].document.write( "<script>parent.XXX = Array;<\/script>" ); var newItem = new XXX(); console.log(newItem instanceof XXX); </script> </body> 2. Open FF Beta 3. Open web console 4. Load the sample file (doesn't matter if it's loaded via file:// or via http:// 5. Note the output displayed in the web console (by the last line inside the script) Actual Results: "false" displayed in the web console. Expected Results: "true" displayed in the web console.
Updated•14 years ago
|
Summary: JS: instanceof fails when object's constructor is initialized from an inframe → JS: instanceof fails when object's constructor is initialized from an iframe
Updated•14 years ago
|
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
Comment 1•14 years ago
|
||
Hmm. That's odd, but doesn't seem like a DOM issue; more likely a problem with wrappers.
Status: UNCONFIRMED → NEW
blocking2.0: --- → ?
Component: DOM → XPConnect
Ever confirmed: true
Keywords: regression
QA Contact: general → xpconnect
Updated•14 years ago
|
Assignee: nobody → mrbkap
blocking2.0: ? → betaN+
Comment 2•14 years ago
|
||
mrbkap says this is a dupe of bug 597872.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
Reporter | ||
Comment 3•13 years ago
|
||
Still reproducible in Firefox 4 Beta 10 (which already contains fix for the bug 620486)
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Assignee | ||
Updated•13 years ago
|
Assignee: mrbkap → gal
Assignee | ||
Comment 4•13 years ago
|
||
Looking at this.
Assignee | ||
Comment 5•13 years ago
|
||
Assignee | ||
Comment 6•13 years ago
|
||
Ok, this is false for us, false for safari, and true for chrome. I couldn't get opera to display anything.
Comment 7•13 years ago
|
||
What about IE? And presumably this was true in Gecko 1.9.x?
Assignee | ||
Comment 8•13 years ago
|
||
I am not saying I won't fix this. I just noted the weird behavior for now.
Assignee | ||
Comment 9•13 years ago
|
||
An independent bug causes that instanceof to still fail, filed as 631135 with the same testcase.
Assignee | ||
Updated•13 years ago
|
Status: REOPENED → RESOLVED
Closed: 14 years ago → 13 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 10•13 years ago
|
||
It's true in Firefox 3.6.13, IE8, IE8 in "IE7 compatibility mode", replacing console.log() with alert() in the original source makes Opera display "true" as well.
You need to log in
before you can comment on or make changes to this bug.
Description
•