Closed Bug 748983 Opened 12 years ago Closed 12 years ago

foo instanceof XMLHttpRequest always throws

Categories

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

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla15
Tracking Status
firefox14 + fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

(Keywords: regression)

Attachments

(2 files, 3 obsolete files)

We only generate a hasInstance hook in some cases. In the cases when we do NOT generate it, we should just be using a Function, not something of our interface object class. Otherwise hasInstance just throws.
Assignee: nobody → bzbarsky
Whiteboard: [need review]
Attached patch With some asserts fixed (obsolete) — Splinter Review
Attachment #618500 - Flags: review?(peterv)
Attachment #618459 - Attachment is obsolete: true
Attachment #618459 - Flags: review?(peterv)
Comment on attachment 618500 [details] [diff] [review] With some asserts fixed Review of attachment 618500 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bindings/Utils.cpp @@ +38,5 @@ > + } > + constructor = JS_NewObject(cx, constructorClass, functionProto, global); > + } else { > + MOZ_ASSERT(constructorNative); > + // XXXbz should the name for the function be "name" or NULL? Can we clear this up? My gut says "name", but I don't see this defined anywhere. @@ +108,5 @@ > ConstantSpec *constants, JSFunctionSpec *staticMethods, > const char* name) > { > + MOZ_ASSERT(protoClass || constructorClass || constructor, > + "Need at least one class!"); ... or a constructor @@ +263,5 @@ > +JSBool > +ThrowingConstructorWorkers(JSContext* cx, unsigned argc, JS::Value* vp) > +{ > + return Throw<false>(cx, NS_ERROR_FAILURE); > +} Could also templatize ThrowingConstructor. ::: dom/bindings/Utils.h @@ +229,5 @@ > + * if it should be a function object. > + * constructor is the JSNative to use as a constructor. If this is non-null, it > + * should be used as a JSNative to back the interface object, which > + * should be a Function. If this is null, then we should create an > + * object of constructorClass, unles that's also null, in which case unless @@ +230,5 @@ > + * constructor is the JSNative to use as a constructor. If this is non-null, it > + * should be used as a JSNative to back the interface object, which > + * should be a Function. If this is null, then we should create an > + * object of constructorClass, unles that's also null, in which case > + * we shold not create an interface object at all. should
Attachment #618500 - Flags: review?(peterv) → review+
> Can we clear this up? My gut says "name", but I don't see this defined anywhere. Looks like .name on function is not actually standard. ;) I think having this come up as |function XMLHttpRequest() {}| makes a lot of sense. I'll just remove the XXX comment. Fixed the other issues.
Whiteboard: [need review] → [need landing]
> Could also templatize ThrowingConstructor. Can I put a pointer to a template function in the JSClass? Seems a bit chancy; I've left this part as is.
Attached patch Updated to comments (obsolete) — Splinter Review
Attachment #618500 - Attachment is obsolete: true
Attachment #620422 - Attachment is obsolete: true
Flags: in-testsuite+
Whiteboard: [need landing]
Target Milestone: --- → mozilla15
Attachment #620423 - Attachment is obsolete: true
Comment on attachment 620587 [details] [diff] [review] Aurora version of patch [Approval Request Comment] Regression caused by (bug #): bug 740069 User impact if declined: Incorrect instanceof behavior for XMLHttpRequest; likely web content fallout. Testing completed (on m-c, etc.): Passes automated tests Risk to taking this patch (and alternatives if risky): Low risk: makes something that throws right now return a boolen instead. Another option is disabling the Paris bindings for XHR if we think this is too risky but don't want to ship the bug. Yet another option is to ship the bug. String changes made by this patch: None.
Attachment #620587 - Flags: approval-mozilla-aurora?
Comment on attachment 620587 [details] [diff] [review] Aurora version of patch [Triage Comment] Early enough in the cycle to take a low-risk fix for this regression. Approving for Aurora 14.
Attachment #620587 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #620423 - Attachment is obsolete: false
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: