Closed Bug 1499545 Opened 10 months ago Closed 10 months ago

WorkerPrivate double-initializes mMainThreadEventTarget

Categories

(Core :: DOM: Workers, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: jimb, Assigned: jimb)

References

Details

Attachments

(1 file)

This is a very minor cleanup, but:

WorkerPrivate::mMainThreadEventTarget is initialized to GetMainThreadEventTarget in the member initializer list:

  , mMainThreadEventTarget(GetMainThreadEventTarget())

but then is definitely initialized by every path through the function body. It seems like it would be better to initialize it to nullptr, to ensure a crash if the body fails to attend to it. (This means it could be omitted from the member initialized list altogether, since nsCOMPtr's default constructor initializes the pointer to nullptr.)
Assignee: nobody → jimb
Blocks: 1499468
Sorry to butt in, but wouldn't it be better to write an initialization function for that member and call it in the initialization list? That way we get static correctness guarantees instead of random crashes. (As a plus, it disentangles the various initialization steps from each other.)
Priority: -- → P2
Pushed by jblandy@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bbff80c1200f
Don't double-initialize WorkerPrivate::mMainThreadEventTarget. r=baku
https://hg.mozilla.org/mozilla-central/rev/bbff80c1200f
Status: NEW → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
Flags: qe-verify-
You need to log in before you can comment on or make changes to this bug.