Improve native global ergonomics a bit

RESOLVED FIXED in mozilla35

Status

()

Core
XPConnect
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: bholley, Assigned: bholley)

Tracking

unspecified
mozilla35
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Assignee)

Description

4 years ago
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.
(Assignee)

Comment 1

4 years ago
Created attachment 8492732 [details] [diff] [review]
Part 1 - Rename xpc::GetNativeForGlobal to xpc::NativeGlobal and make it accept non-global JSObjects. v1

The method is infallible, and making the callers invoke
js::GetGlobalForObjectCrossCompartment manually is dumb.
Attachment #8492732 - Flags: review?(bugs)
(Assignee)

Comment 2

4 years ago
Created attachment 8492733 [details] [diff] [review]
Part 2 - Implement a JSObject* override to AutoJSAPI::Init(). v1
Attachment #8492733 - Flags: review?(bugs)

Comment 3

4 years ago
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 4

4 years ago
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
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
You need to log in before you can comment on or make changes to this bug.