Closed Bug 327156 Opened 15 years ago Closed 15 years ago

[FIX]|window instanceof X| throws a lot (e.g. if window is not an instance of X)

Categories

(Core :: DOM: Core & HTML, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

()

Details

(Keywords: fixed1.8.1)

Attachments

(1 file)

The problem is that the classinfo for Window has:

    DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventReceiver)

But that's not a scriptable (or indeed IDL!) interface.  So in nsDOMConstructor::HasInstance when we call GetInfoForIID() on that interface we of course get nothing back.  That causes:

###!!! ASSERTION: nsDOMConstructor::HasInstance can't get interface info.: 'Error', file ../../../../mozilla/dom/src/base/nsDOMClassInfo.cpp, line 4804

followed by a throw.

In other words, the only way "window instanceof X" doesn't throw is if X is Window, JSWindow, or WindowInternal.

It seems to me like the right way to fix this is to remove the classinfo for nsIDOMEventReceiver... or am I missing something?  The other option would be to silently continue on lack of interface info, if we do need that interface in classinfo for window (or other non-idl interfaces in other classinfos).

This isn't a recent regression or anything, which frankly amazes me.
Not sure about fixing on 1.8.0 branch, but we should fix on 1.8.1, imo.
Flags: blocking1.8.1?
Summary: Window instanceof X throws a lot (e.g. if Window is not an instance of X) → |window instanceof X| throws a lot (e.g. if window is not an instance of X)
*** Bug 310344 has been marked as a duplicate of this bug. ***
Attached patch FixSplinter Review
Assignee: general → bzbarsky
Status: NEW → ASSIGNED
Attachment #218129 - Flags: superreview?(jst)
Attachment #218129 - Flags: review?(jst)
Attachment #218129 - Flags: approval-branch-1.8.1?(jst)
Priority: -- → P2
Summary: |window instanceof X| throws a lot (e.g. if window is not an instance of X) → [FIX]|window instanceof X| throws a lot (e.g. if window is not an instance of X)
Target Milestone: --- → mozilla1.9alpha
Depends on: 333739
Comment on attachment 218129 [details] [diff] [review]
Fix

r+sr=jst
Attachment #218129 - Flags: superreview?(jst)
Attachment #218129 - Flags: superreview+
Attachment #218129 - Flags: review?(jst)
Attachment #218129 - Flags: review+
Attachment #218129 - Flags: approval-branch-1.8.1?(jst)
Attachment #218129 - Flags: approval-branch-1.8.1+
Fixed trunk and 1.8.1 branch.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Flags: blocking1.8.1?
Keywords: fixed1.8.1
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.