Closed Bug 1218499 Opened 4 years ago Closed 4 years ago

FetchEvent constructor will happily set mRequest to null if not passed

Categories

(Core :: DOM: Service Workers, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: bzbarsky, Assigned: ehsan)

References

Details

Attachments

(1 file)

But the IDL says it can't be null, so I expect this:

  (new FetchEvent("foo")).request

to crash with a null-deref in binding code.

Looks to me like the spec at https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#fetch-event-section has the same bug (except it just doesn't say what to do if request is not set, as opposed to requiring a crash).

Chances are "request" should just be required in FetchEventInit.
Oh, and looks like I mentioned this once before in bug 1065216 comment 3 and got ignored...
I guess https://github.com/slightlyoff/ServiceWorker/issues/680 is the spec issue.  But we shouldn't wait for the spec to be fixed to stop crashing.  Probably need to just mark this member as nullable.
Yeah we definitely crash here.
Assignee: nobody → ehsan
Attachment #8679059 - Flags: review?(bzbarsky)
Comment on attachment 8679059 [details] [diff] [review]
Make FetchEvent.request nullable

r=me
Attachment #8679059 - Flags: review?(bzbarsky) → review+
https://hg.mozilla.org/mozilla-central/rev/253416fea643
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
See Also: → 1238213
You need to log in before you can comment on or make changes to this bug.