Closed
Bug 842799
Opened 12 years ago
Closed 12 years ago
|Document.prototype instanceof Node| inside <script> returns false
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
VERIFIED
FIXED
mozilla22
People
(Reporter: alice0775, Assigned: peterv)
References
()
Details
(Keywords: regression)
Attachments
(3 files)
88 bytes,
text/html
|
Details | |
2.57 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
6.91 KB,
patch
|
peterv
:
review+
bajaj
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
Build Identifier:
http://hg.mozilla.org/mozilla-central/rev/e8f8a3f6f1f6
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20130219 Firefox/21.0 ID:20130219031055
Zlip792 reported the problem in http://forums.mozillazine.org/posting.php?mode=quote&f=23&p=12679997 .
alert(Document.prototype instanceof Node);
This happens when running the code in <script>.
This also happens when evaluate the code in Error Console.
However, this problem does not happen when evaluate the code in the Scratchpad and Web Console.
Steps to Reproduce:
1. Open testcase
Actual Results:
|false|
Expected Results:
|true|
Regression window(m-c)
Good:
http://hg.mozilla.org/mozilla-central/rev/7bd555e2acfa
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20130215 Firefox/21.0 ID:20130215133452
Bad:
http://hg.mozilla.org/mozilla-central/rev/484dbca61133
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20130216 Firefox/21.0 ID:20130216064952
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=7bd555e2acfa&tochange=484dbca61133
Regression window(m-i)
Good:
http://hg.mozilla.org/integration/mozilla-inbound/rev/424de8168602
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20130215 Firefox/21.0 ID:20130215141251
Bad:
http://hg.mozilla.org/integration/mozilla-inbound/rev/88361e96d89f
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20130215 Firefox/21.0 ID:20130215143355
Pushlog:
http://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=424de8168602&tochange=88361e96d89f
Triggered by:
9a12a0f8c8be Peter Van der Beken — Fix for bug 838269 (Support cross-global |... instanceof DOMInterface|). r=bz.
![]() |
||
Comment 1•12 years ago
|
||
So... This was a purposeful change. If we do want this to return true that can be done, I guess. Otherwise we should ask Microsoft to fix their test.
Cameron, thoughts?
Comment 2•12 years ago
|
||
So this is testing if an interface prototype object is instanceof the instance object? Web IDL has never required that to be true, AFAICR. Despite the fact that built-ins like Number, Date, etc. do behave like this, I think I remember TC39 folks saying that it's not a great pattern to follow. I think we should ask for the test to be fixed.
I have no idea why this being inside a <script> makes a difference here. The weirdness that the Web Console does with the global might be confusing matters.
![]() |
||
Comment 3•12 years ago
|
||
No, this is testing whether an interface prototype object for interface A is instanceof the interface object for interface B where A inherits from B.
I too have no idea what's different in the web console case; presumably some aspect of the sandbox is making this "work" somehow.
Assignee | ||
Comment 4•12 years ago
|
||
Given http://dev.w3.org/2006/webapi/WebIDL/#es-interface-hasinstance we do need to fix this:
A -> Node
O -> Node.prototype
V -> [[Prototype]] of Document.prototype, which is Node.prototype
O and V refer to the same object.
Attachment 710305 [details] [diff] probably didn't suffer from this flaw.
![]() |
||
Comment 5•12 years ago
|
||
Oh, hmm. So that still has the "walk up the proto chain" bit, I guess? <sigh>.
Well, that's easy enough to add...
Assignee | ||
Comment 6•12 years ago
|
||
![]() |
||
Comment 7•12 years ago
|
||
Comment on attachment 716159 [details] [diff] [review]
v1
> + js::GetObjectClass(proto) == interfacePrototypeClasp) {
Why do we want this bit? The spec just says to check for object identity, no?
But also, how does this deal with cross-compartment __proto__ links? Seems like we should be comparing "proto" to the reflection of interfacePrototype into the compartment of instance or something.
r=me with those fixed.
Attachment #716159 -
Flags: review?(bzbarsky) → review+
Comment 8•12 years ago
|
||
Does this affect users at all or just running a test case? Not clear why this would be a release blocker.
![]() |
||
Comment 9•12 years ago
|
||
It can affect website compat, and it's a correctness issue that shows up on commonly run correctness tests.
Given that we have a patch, I believe we should just make sure we actually get that patch landed. If by some miracle we get to release day and that hasn't happened, I wouldn't block the release on this, probably, given the info we have so far.
Updated•12 years ago
|
status-firefox21:
--- → affected
status-firefox22:
--- → affected
Assignee | ||
Comment 10•12 years ago
|
||
Comment 11•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
Assignee | ||
Comment 12•12 years ago
|
||
[Approval Request Comment]
Bug caused by (feature/regressing bug #): bug 838269
User impact if declined: broken sites
Testing completed (on m-c, etc.): landed on m-c, includes a test
Risk to taking this patch (and alternatives if risky): low-risk
String or UUID changes made by this patch: none
Attachment #722186 -
Flags: review+
Attachment #722186 -
Flags: approval-mozilla-aurora?
Comment 13•12 years ago
|
||
Comment on attachment 722186 [details] [diff] [review]
v1
low risk fix which may help with web compat issues .Patched is well baked on m-c, approving for uplift
Attachment #722186 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 14•12 years ago
|
||
Comment 15•12 years ago
|
||
Verified fixed on Windows 7, 64 bits, with Firefox 22 beta 2, Aurora 23.0 and latest Nightly 24.0:
- User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0, Build ID: 20130521223249
- User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20130526 Firefox/23.0, Build ID: 20130526004017
- User agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:24.0) Gecko/20130525 Firefox/24.0, Build ID: 20130525062525
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•