Closed Bug 1070696 Opened 5 years ago Closed 5 years ago

Improve native global ergonomics a bit

Categories

(Core :: XPConnect, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla35

People

(Reporter: bholley, Assigned: bholley)

Details

Attachments

(2 files)

There are various inconveniences that have been bothering me. I was going to wait until jimb's refactoring in bug 971673 was done before doing this, but that's been taking a while and this stuff is easy to fix.
The method is infallible, and making the callers invoke
js::GetGlobalForObjectCrossCompartment manually is dumb.
Attachment #8492732 - Flags: review?(bugs)
Comment on attachment 8492733 [details] [diff] [review]
Part 2 - Implement a JSObject* override to AutoJSAPI::Init(). v1

>+  // This is a helper that grabs the native global associated with aGlobalObject
aObject, not aGlobalObject
Attachment #8492733 - Flags: review?(bugs) → review+
Comment on attachment 8492732 [details] [diff] [review]
Part 1 - Rename xpc::GetNativeForGlobal to xpc::NativeGlobal and make it accept non-global JSObjects. v1

> /**
>+ * Returns the nsIGlobalObject corresponding to |aObjs|'s JS global.
>+ */
>+nsIGlobalObject *
>+NativeGlobal(JSObject *aObj);

nsIGlobalObject*
NativeGlobal(JSObject* aObj);
would follow Mozilla coding style, but xpconnect has some unusual rules.
Attachment #8492732 - Flags: review?(bugs) → review+
https://hg.mozilla.org/mozilla-central/rev/e1f3be2c48f6
https://hg.mozilla.org/mozilla-central/rev/cafe6d84215b
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
You need to log in before you can comment on or make changes to this bug.