Closed Bug 1052089 Opened 11 years ago Closed 11 years ago

Streamline XPConnect singleton scopes and remove lazy instantiation

Categories

(Core :: XPConnect, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla34

People

(Reporter: billm, Assigned: bholley)

References

Details

Attachments

(9 files)

2.73 KB, patch
billm
: review+
Details | Diff | Splinter Review
5.36 KB, patch
billm
: review+
Details | Diff | Splinter Review
2.20 KB, patch
billm
: review+
Details | Diff | Splinter Review
1.27 KB, patch
billm
: review+
Details | Diff | Splinter Review
1.39 KB, patch
billm
: review+
Details | Diff | Splinter Review
1.13 KB, patch
billm
: review+
Details | Diff | Splinter Review
6.10 KB, patch
billm
: review+
gkrizsanits
: feedback+
Details | Diff | Splinter Review
21.76 KB, patch
billm
: review+
gkrizsanits
: feedback+
Details | Diff | Splinter Review
18.45 KB, patch
billm
: review+
gkrizsanits
: feedback+
Details | Diff | Splinter Review
This will be useful for some extra CPOW security that we need.
Summary: Rename JunkScope and safe JS context scope to PrivilegedJunkScope and UnprivilegedJunkScope → Streamline XPConnect singleton scopes and remove lazy instantiation
Assignee: nobody → bobbyholley
This is green.
And earlier version of these patches called nsContentUtils::GetSystemPrincipal() too early, which returned null, and caused xpc::CreateSandboxObject to create an nsNullPrincipal. Let's avoid having that happen again.
Attachment #8474050 - Flags: review?(wmccloskey)
nsContentUtils isn't ready by this point.
Attachment #8474051 - Flags: review?(wmccloskey)
This causes problems when used too early in startup.
Attachment #8474052 - Flags: review?(wmccloskey)
This prevents the JS engine from trying to fire off debugger notifications and do other complicated things when we create this thing early in startup in the upcoming patches.
Attachment #8474055 - Flags: review?(wmccloskey)
We've had some problems with GetJunkScope returning null and causing crashes in the past, but I'm now pretty convinced that just null-checking it isn't the answer. Rather than creating it lazily, we should create it at a defined point in startup. Any problems will then be much more reproducible, and we can track them down and fix them.
Attachment #8474056 - Flags: review?(wmccloskey)
These two things ended up getting mushed together in my tree.
Attachment #8474057 - Flags: review?(wmccloskey)
Comment on attachment 8474056 [details] [diff] [review] Part 7 - Infallibly init singleton scopes in the XPCJSRuntime constructor. v1 I'm flagging Bill for review on this stuff because he's the one blocked on it, but I'm also flagging gabor for feedback on the last 3 patches just to make sure he's in the loop.
Attachment #8474056 - Flags: feedback?(gkrizsanits)
Attachment #8474057 - Flags: feedback?(gkrizsanits)
Attachment #8474058 - Flags: feedback?(gkrizsanits)
Comment on attachment 8474055 [details] [diff] [review] Part 6 - Make the junk scope invisible to the debugger and Components-less. v1 Review of attachment 8474055 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/xpconnect/src/XPCJSRuntime.cpp @@ +3557,5 @@ > if (!mJunkScope) { > AutoSafeJSContext cx; > SandboxOptions options; > options.sandboxName.AssignLiteral("XPConnect Junk Compartment"); > + options.invisibleToDebugger = true; why invisible to the debugger?
Attachment #8474056 - Flags: feedback?(gkrizsanits) → feedback+
Comment on attachment 8474057 [details] [diff] [review] Part 8 - Rename JunkScope to PrivilegedJunkScope and remove fallibility of singleton scope access. v1 Review of attachment 8474057 [details] [diff] [review]: ----------------------------------------------------------------- PrivilegedJunkScope sounds super weird... but I don't have any good/better name idea either.
Attachment #8474057 - Flags: feedback?(gkrizsanits) → feedback+
Attachment #8474058 - Flags: review?(wmccloskey)
Attachment #8474058 - Flags: review?(gkrizsanits)
Attachment #8474058 - Flags: feedback?(gkrizsanits)
Attachment #8474058 - Flags: feedback+
Attachment #8474050 - Flags: review?(wmccloskey) → review+
(In reply to Gabor Krizsanits [:krizsa :gabor] from comment #14) > why invisible to the debugger? See comment 9.
Attachment #8474051 - Flags: review?(wmccloskey) → review+
Attachment #8474052 - Flags: review?(wmccloskey) → review+
Attachment #8474053 - Flags: review?(wmccloskey) → review+
Attachment #8474054 - Flags: review?(wmccloskey) → review+
Attachment #8474055 - Flags: review?(wmccloskey) → review+
Attachment #8474056 - Flags: review?(wmccloskey) → review+
Attachment #8474057 - Flags: review?(wmccloskey) → review+
Comment on attachment 8474058 [details] [diff] [review] Part 9 - Swap out the SafeJSContextGlobal for the new UnprivilegedJunkScope. v1 Review of attachment 8474058 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/xpconnect/src/XPCJSRuntime.cpp @@ +3548,5 @@ > > + // Create the Unprivileged Junk Scope. > + SandboxOptions unprivilegedJunkScopeOptions; > + unprivilegedJunkScopeOptions.sandboxName.AssignLiteral("XPConnect Junk Compartment"); > + unprivilegedJunkScopeOptions.invisibleToDebugger = true; Does this one need Components?
Attachment #8474058 - Flags: review?(wmccloskey) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: