Closed Bug 1001198 Opened 10 years ago Closed 10 years ago

Clean up XPConnect and SSM startup

Categories

(Core :: XPConnect, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: bholley, Assigned: bholley)

References

(Blocks 1 open bug)

Details

Attachments

(6 files)

I'm having to do some startup munging to put me in a place where I can initialize a Sandbox at XPConnect startup (which I want for bug 997906). I'm splitting that work out into a separate bug.
Depends on: 1001662
In contrast to InitClassesWithNewWrappedGlobal, InitClasses doesn't do much
these days. It pretty much only exists to support JSD globals that are created
without XPConnect's knowledge, and then are suddenly handed to XPConnect.

It really only has two observable effects. The first is ensuring the existence
of an XPCWrappedNativeScope, which we know we have here, because we went through
xpc::CreateGlobalObject. The second is to set up the XPCNativeWrapper
constructor (eww), which definitely doesn't matter here, especially now that
we're asserting that we never run script in this global.
Attachment #8417832 - Flags: review?(gkrizsanits)
All this does is null out some stuff that's already in the BSS. And it causes
leaks if we create a global before it's called, which the upcoming patch does.
Attachment #8417833 - Flags: review?(gkrizsanits)
This causes problems when we try to create a Sandbox during XPConnect
initialization. Luckily, we don't need it at all.
Attachment #8417835 - Flags: review?(gkrizsanits)
Comment on attachment 8417830 [details] [diff] [review]
Part 1 - Explicitly fire up the SSM from nsXPConnect. v1

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

::: js/xpconnect/src/XPCJSContextStack.cpp
@@ +74,1 @@
>          if ((e.cx == cx) && ssm) {

Remove null-check?

::: js/xpconnect/src/xpcprivate.h
@@ +283,2 @@
>      {
> +        return gScriptSecurityManager;

Maybe assert mainthread?
Comment on attachment 8417830 [details] [diff] [review]
Part 1 - Explicitly fire up the SSM from nsXPConnect. v1

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

::: dom/bindings/Exceptions.cpp
@@ +24,2 @@
>  bool
>  IsCallerChrome()

Is there a reason to keep this function?

::: js/xpconnect/src/xpcprivate.h
@@ +278,5 @@
>      XPCJSRuntime* GetRuntime() {return mRuntime;}
>  
>      static bool IsISupportsDescendant(nsIInterfaceInfo* info);
>  
> +    static nsIScriptSecurityManager* SSM()

This is not the most descriptive name to be honest... can we just call it SecurityManager() or ScriptSecurityManager()?
Attachment #8417830 - Flags: review?(gkrizsanits) → review+
Attachment #8417831 - Flags: review?(gkrizsanits) → review+
Attachment #8417832 - Flags: review?(gkrizsanits) → review+
Attachment #8417833 - Flags: review?(gkrizsanits) → review+
Attachment #8417834 - Flags: review?(gkrizsanits) → review+
Comment on attachment 8417835 [details] [diff] [review]
Part 6 - Stop getting XPConnect as a service during Sandbox creation. v1

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

\o/ This is really awesome, I always hated this line :)
Attachment #8417835 - Flags: review?(gkrizsanits) → review+
(In reply to :Ms2ger from comment #7)
> Comment on attachment 8417830 [details] [diff] [review]
> ::: js/xpconnect/src/XPCJSContextStack.cpp
> @@ +74,1 @@
> >          if ((e.cx == cx) && ssm) {
> 
> Remove null-check?

Yeah, good call.


> ::: js/xpconnect/src/xpcprivate.h
> @@ +283,2 @@
> >      {
> > +        return gScriptSecurityManager;
> 
> Maybe assert mainthread?

Done.


(In reply to Gabor Krizsanits [:krizsa :gabor] from comment #8)
> ::: dom/bindings/Exceptions.cpp
> @@ +24,2 @@
> >  bool
> >  IsCallerChrome()
> 
> Is there a reason to keep this function?

It actually just went away, in bug 997987.

> ::: js/xpconnect/src/xpcprivate.h
> > +    static nsIScriptSecurityManager* SSM()
> 
> This is not the most descriptive name to be honest... can we just call it
> SecurityManager() or ScriptSecurityManager()?

Yeah, I guess SecurityManager() is better.
Followup for compilation bustage on some platform: https://tbpl.mozilla.org/?tree=Try&rev=a3c23e9801e8
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: