Closed Bug 1365086 Opened 7 years ago Closed 7 years ago

Make nsMessageManagerScriptExecutor::mGlobal into a regular heap pointer

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: mccr8, Assigned: mccr8)

References

Details

Attachments

(3 files)

Right now it has type nsCOMPtr<nsIXPConnectJSObjectHolder>, which is archaic. This class is already cycle collected, so it is not be too hard to convert.
Comment on attachment 8868266 [details]
Bug 1365086, part 1 - Make nsMessageManagerScriptExecutor::GetGlobal return a JSObject pointer.

https://reviewboard.mozilla.org/r/139850/#review143210

::: dom/base/nsFrameMessageManager.h:370
(Diff revision 1)
>  public:
>    static void PurgeCache();
>    static void Shutdown();
> -  already_AddRefed<nsIXPConnectJSObjectHolder> GetGlobal()
> +  JSObject* GetGlobal()
>    {
> -    nsCOMPtr<nsIXPConnectJSObjectHolder> ref = mGlobal;
> +    return mGlobal->GetJSObject();

Is it guaranteed mGlobal is non-null here?
I'd prefer a null check.
Attachment #8868266 - Flags: review?(bugs) → review+
Comment on attachment 8868267 [details]
Bug 1365086, part 2 - Add unlink method for nsMessageManagerScriptExecutor.

https://reviewboard.mozilla.org/r/139852/#review143212
Attachment #8868267 - Flags: review?(bugs) → review+
(In reply to Olli Pettay [:smaug] from comment #5)
> Is it guaranteed mGlobal is non-null here?
> I'd prefer a null check.

That actually just goes away in a later patch. (mGlobal becomes a JSObject, and we just return it directly.)
Comment on attachment 8868268 [details]
Bug 1365086, part 3 - Make nsMessageManagerScriptExecutor::mGlobal into a raw pointer.

https://reviewboard.mozilla.org/r/139854/#review143214

Given that this changes black root marking a bit (XPCJSRuntime::TraceNativeBlackRoots), worth to check whether telemetry data around CC changes.

::: dom/base/nsFrameMessageManager.h:370
(Diff revision 1)
>  public:
>    static void PurgeCache();
>    static void Shutdown();
>    JSObject* GetGlobal()
>    {
> -    return mGlobal->GetJSObject();
> +    return mGlobal;

Ah, we change mGlobal here, so null check isn't needed.
Attachment #8868268 - Flags: review?(bugs) → review+
Pushed by amccreight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2ca54e1cbf46
part 1 - Make nsMessageManagerScriptExecutor::GetGlobal return a JSObject pointer. r=smaug
https://hg.mozilla.org/integration/autoland/rev/61d7468cd1c1
part 2 - Add unlink method for nsMessageManagerScriptExecutor. r=smaug
https://hg.mozilla.org/integration/autoland/rev/d4e14b275a0f
part 3 - Make nsMessageManagerScriptExecutor::mGlobal into a raw pointer. r=smaug
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: