Closed Bug 1474273 Opened 8 years ago Closed 8 years ago

Add xpc::CurrentNativeGlobal(cx) helper function

Categories

(Core :: XPConnect, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

Details

Attachments

(1 file)

16 callers of NativeGlobal pass in JS::CurrentGlobalOrNull(cx) so let's add xpc::CurrentNativeGlobal(cx) for this so we don't have to worry about these callers anymore in bug 1474272.
Comment on attachment 8990689 [details] [diff] [review] Add xpc::CurrentNativeGlobal and use it instead of NativeGlobal(JS::CurrentGlobalOrNull(cx)) >+++ b/dom/script/ScriptSettings.cpp > nsCOMPtr<nsPIDOMWindowInner> window = >- do_QueryInterface(xpc::NativeGlobal(JS::CurrentGlobalOrNull(aCx))); >+ do_QueryInterface(xpc::CurrentNativeGlobal(aCx)); This could use xpc::CurrentWindowOrNull to be a bit quicker (no QI). >+CurrentNativeGlobal(JSContext* cx); We should probably document that this must not be called when cx is not in a Realm, right? r=me
Attachment #8990689 - Flags: review?(bzbarsky) → review+
Pushed by jandemooij@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/4c72dc399004 Add xpc::CurrentNativeGlobal and use it instead of NativeGlobal(JS::CurrentGlobalOrNull(cx)). r=bz
(In reply to Boris Zbarsky [:bz] (no decent commit message means r-) from comment #2) > >+ do_QueryInterface(xpc::CurrentNativeGlobal(aCx)); > > This could use xpc::CurrentWindowOrNull to be a bit quicker (no QI). Ah thanks, done. > We should probably document that this must not be called when cx is not in a > Realm, right? Done.
Priority: -- → P2
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: