Closed Bug 1474272 Opened 6 years ago Closed 6 years ago

Stop using js::GetGlobalForObjectCrossCompartment in xpc::NativeGlobal

Categories

(Core :: XPConnect, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

Details

Attachments

(4 files, 2 obsolete files)

This is sort of a big one with 51 callers, although most of them are easy to audit.

Also, NativeGlobal currently always gets the object's global even though most callers already pass in a global. It would be nice to make NativeGlobal assert JS_IsGlobalObject and then have a separate function for the non-global object case.
Depends on: 1474273
Depends on: 1474522
Depends on: 1474540
Depends on: 1474541
Depends on: 1474542
Priority: -- → P2
Depends on: 1478306
Attachment #8994801 - Flags: review?(bzbarsky)
Just some minor clean up that makes it easier to reason about some of the NativeGlobal calls.
Attachment #8994814 - Flags: review?(bzbarsky)
Comment on attachment 8994801 [details] [diff] [review]
Part 1 - Remove unused WrappedJSToDictionary

Looks like this was used by some FxOS code at one point...  r=me
Attachment #8994801 - Flags: review?(bzbarsky) → review+
Comment on attachment 8994814 [details] [diff] [review]
Part 2 - Use more precise types in Promise code and add some assertions

r=me
Attachment #8994814 - Flags: review?(bzbarsky) → review+
With the later patches we can call this function in the memory reporting code while iterating the heap. We're replacing some js::GetGlobalForObjectCrossCompartment calls and that one doesn't assert anything about the heap state.
Attachment #8995149 - Flags: review?(jcoppeard)
I could also remove the assertion if you think that's fine..
xpc::NativeGlobal is now faster because it doesn't have to look up the object's global. xpc::NonCCWObjectNativeGlobal is nice to be explicit about not having a CCW object.

This is green on top of the patches in the dependent bugs.
Attachment #8995154 - Flags: review?(bzbarsky)
Comment on attachment 8995149 [details] [diff] [review]
Part 3 - Call AssertHeapIsIdleOrIterating instead of AssertHeapIsIdle in JS::GetNonCCWObjectGlobal

Review of attachment 8995149 [details] [diff] [review]:
-----------------------------------------------------------------

This is fine like this.
Attachment #8995149 - Flags: review?(jcoppeard) → review+
Attachment #8995154 - Attachment is obsolete: true
Attachment #8995154 - Flags: review?(bzbarsky)
Attachment #8995155 - Flags: review?(bzbarsky)
Comment on attachment 8995155 [details] [diff] [review]
Part 4 - Make NativeGlobal only work with global objects and add NonCCWObjectNativeGlobal for other callers

I'd like bholley to take a look.  I will admit to not being a fan of the length of NonCCWObjectNativeGlobal.
Attachment #8995155 - Flags: review?(bzbarsky) → review?(bobbyholley)
After our discussion yesterday, I think Bobby will like this one more.
Attachment #8995155 - Attachment is obsolete: true
Attachment #8995155 - Flags: review?(bobbyholley)
Attachment #8995457 - Flags: review?(bobbyholley)
Attachment #8995457 - Flags: review?(bobbyholley) → review+
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/6d6402132e9f
part 1 - Remove unused WrappedJSToDictionary. r=bz
https://hg.mozilla.org/integration/mozilla-inbound/rev/8d9247183eb7
part 2 - Use more precise types in Promise code and add some assertions. r=bz
https://hg.mozilla.org/integration/mozilla-inbound/rev/53e8a6239f8e
part 3 - Call AssertHeapIsIdleOrIterating instead of AssertHeapIsIdle in JS::GetNonCCWObjectGlobal. r=jonco
https://hg.mozilla.org/integration/mozilla-inbound/rev/f486f734d4c4
part 4 - Stop using js::GetGlobalForObjectCrossCompartment in xpc::NativeGlobal. r=bholley
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: