Closed
Bug 974327
Opened 10 years ago
Closed 10 years ago
Cleanup nsJSContext::GetGlobalObject()
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla33
People
(Reporter: Ms2ger, Assigned: Ms2ger)
Details
Attachments
(1 file)
1.96 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
If mGlobalObjectRef is null, we would non-fatally assert and then return null because ((~c->flags) & (JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS)) is true. The assertion isn't hit by our linux64 debug tests: <https://tbpl.mozilla.org/?tree=Try&rev=7991ead81f7a>. Not sure how useful it is.
Attachment #8378203 -
Flags: review?(bobbyholley)
Comment 1•10 years ago
|
||
Comment on attachment 8378203 [details] [diff] [review] Patch v1 Review of attachment 8378203 [details] [diff] [review]: ----------------------------------------------------------------- r=me with that. Thanks for doing this. ::: dom/base/nsJSEnvironment.cpp @@ +1070,5 @@ > return nullptr; > } > > + MOZ_ASSERT(mGlobalObjectRef); > + return mGlobalObjectRef; How about just: MOZ_ASSERT_IF(mWindowProxy, mGlobalObjectRef); return mGlobalObjectRef?
Attachment #8378203 -
Flags: review?(bobbyholley) → review+
Assignee | ||
Comment 2•10 years ago
|
||
(In reply to Bobby Holley (:bholley) from comment #1) > Comment on attachment 8378203 [details] [diff] [review] > Patch v1 > > Review of attachment 8378203 [details] [diff] [review]: > ----------------------------------------------------------------- > > r=me with that. Thanks for doing this. > > ::: dom/base/nsJSEnvironment.cpp > @@ +1070,5 @@ > > return nullptr; > > } > > > > + MOZ_ASSERT(mGlobalObjectRef); > > + return mGlobalObjectRef; > > How about just: > > MOZ_ASSERT_IF(mWindowProxy, mGlobalObjectRef); > return mGlobalObjectRef? Is that supposed to be equivalent?
Comment 3•10 years ago
|
||
(In reply to :Ms2ger from comment #2) > Is that supposed to be equivalent? Not strictly, no. But the lifetimes are very similar - both are nulled out at the same time. And the only time mWindowProxy is null and mGlobalObjectRef is not is between the initial construction of an nsJSContext (in nsGlobalWindow::EnsureScriptEnvironment()) and the first call to nsGlobalWindow::SetNewDocument (generally during the creation of an about:blank content viewer). And I don't see any good reason to return null during that window.
Assignee | ||
Comment 4•10 years ago
|
||
Looks like this got lost... Bobby, are you okay with me landing the patch as-in? I'd rather not deal with any fallout if it turns out something did depend on the null return there.
Flags: needinfo?(bobbyholley)
Comment 5•10 years ago
|
||
Sure. But at least add a comment around the affected code indicating that it can probably be simplified further, and pointing to comment 1 and comment 3?
Flags: needinfo?(bobbyholley)
Assignee | ||
Comment 6•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/b75c7cc9972a
Flags: in-testsuite-
Comment 7•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/b75c7cc9972a
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•