Closed Bug 1132347 Opened 6 years ago Closed 4 years ago

mozBackgroundRequest ignore errors only in the main thread

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: emk, Assigned: emk)

References

Details

Attachments

(1 file)

Because it is annotated as [SetterThrows=Workers] while it can actually fail even in the main thread.

Is this intentional? If so, why is it different between the main thread and workers?
This totally looks like a bug.  Should just be SetterThrows.  Want to fix?
Flags: needinfo?(VYV03354)
Will do.
Assignee: nobody → VYV03354
Flags: needinfo?(VYV03354)
Attached patch patchSplinter Review
|void SetMozBackgroundRequest(bool, nsresult&)| was not even called, it was not even updated when ErrorResult was introduced. The compiler didn't catch the error because the signature of the XPCOM version (that is, |NS_IMETHODIMP nsXMLHttpRequest::SetMozBackgroundRequest(bool)|) happened to match the signature of the infallible WebIDL setter function (the difference of the return type did not matter).

Is it possible to prevent similar mistakes in the future?
Attachment #8564126 - Flags: review?(bzbarsky)
> |void SetMozBackgroundRequest(bool, nsresult&)| was not even called
...from the generated code. It is called from the XPCOM version, of course.
Comment on attachment 8564126 [details] [diff] [review]
patch

r=me

As far as preventing this in the future, I filed bug 1132934.
Attachment #8564126 - Flags: review?(bzbarsky) → review+
Hm, some tests set mozBackgroundRequest after open() that should have no effect...
/dom/system/NetworkGeolocationProvider.js
/toolkit/components/search/SearchSuggestionController.jsm
/toolkit/identity/Identity.jsm
See Also: → 882485, 1007979, 753238
Fixed by bug 1269162.
Status: NEW → RESOLVED
Closed: 4 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.