Closed
Bug 981218
Opened 11 years ago
Closed 10 years ago
Remove default compartment objects
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla34
People
(Reporter: bholley, Assigned: bholley)
References
Details
Attachments
(6 files)
(deleted),
patch
|
bobowen
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
bobowen
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
bobowen
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
luke
:
review+
|
Details | Diff | Splinter Review |
Part 5 - Stop using a default compartment object in the IndexedDB and ProxyAutoConfig JSRuntimes. v1
(deleted),
patch
|
bobowen
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
luke
:
review+
|
Details | Diff | Splinter Review |
Now that bug 979481 is landed, we have a null default compartment object for both DOMWindow JSContexts and the SafeJSContext. At that point, we really don't have a use for default compartment objects. Their primary purpose was to specify the compartment that the JSContext should be restored to after JS_SaveFrameChain (which happens during pushing). But I think we can get to a point where we only ever push DOMWindowJSContexts and the SafeJSContext.
I think we can probably do the following:
(1) Remove the special JSContexts we have for the component loader, sandboxes, etc, and replace them with the SafeJSContext.
(2) Fix up any jsapi-tests and whatnot that are sloppy about entering a compartment.
(3) Remove default compartment objects, and their associated goop.
Comment 1•11 years ago
|
||
\o/
Assignee | ||
Comment 3•10 years ago
|
||
Assignee | ||
Comment 4•10 years ago
|
||
By this point, AutoJSAPI takes care of entering the correct compartment, so this
no longer serves a purpose.
Attachment #8476240 -
Flags: review?(bobowencode)
Assignee | ||
Comment 5•10 years ago
|
||
Attachment #8476241 -
Flags: review?(bobowencode)
Assignee | ||
Comment 6•10 years ago
|
||
Attachment #8476242 -
Flags: review?(bobowencode)
Assignee | ||
Comment 7•10 years ago
|
||
Attachment #8476243 -
Flags: review?(luke)
Assignee | ||
Comment 8•10 years ago
|
||
Attachment #8476244 -
Flags: review?(bobowencode)
Updated•10 years ago
|
Attachment #8476243 -
Flags: review?(luke) → review+
Comment 10•10 years ago
|
||
Comment on attachment 8476245 [details] [diff] [review]
Part 6 - Remove default compartment objects. v1
\o/ \o/ \o/
Attachment #8476245 -
Flags: review?(luke) → review+
Comment 11•10 years ago
|
||
ISTR some sort of cruft (my memory is not more specific than that) we had to add to deal with the case where you start in compartment A, auto-enter compartment B, auto-leave compartment B, but since then the default-compartment-object has been changed to C. ExclusiveContext::leaveCompartment seems pretty reasonable nowadays, so maybe it's all gone.
Comment 12•10 years ago
|
||
Comment on attachment 8476240 [details] [diff] [review]
Part 1 - Remove the JSAutoCompartment from cx pushing. v1
Review of attachment 8476240 [details] [diff] [review]:
-----------------------------------------------------------------
Right, we only construct the AutoCxPusher in AutoJSAPI::InitInternal and we always enter a compartment directly afterwards, making this redundant.
Attachment #8476240 -
Flags: review?(bobowencode) → review+
Comment 13•10 years ago
|
||
Comment on attachment 8476241 [details] [diff] [review]
Part 2 - Stop using default compartment objects in nsJSUtils.cpp. v1
Review of attachment 8476241 [details] [diff] [review]:
-----------------------------------------------------------------
I've convinced myself that all the callers of nsJSUtils::ReportPendingException will either pass a JSContext that has a script context or pass the SafeJSContext.
Again, GetDefaultScopeFromJSContext is only called during an actual push as part of AutoJSAPI::InitInternal, so the JSContext must have a script context or be the SafeJSContext.
So in both cases either we would never call js::DefaultObjectForContextOrNull or it would return null anyway.
Attachment #8476241 -
Flags: review?(bobowencode) → review+
Comment 14•10 years ago
|
||
Comment on attachment 8476242 [details] [diff] [review]
Part 3 - Stop using default compartment objects in workers. v1
Review of attachment 8476242 [details] [diff] [review]:
-----------------------------------------------------------------
GlobalScope gets set just after the global is created in WorkerPrivate::CreateGlobalScope and (currently until part 6) set as the default compartment object for the context.
Attachment #8476242 -
Flags: review?(bobowencode) → review+
Comment 15•10 years ago
|
||
Comment on attachment 8476244 [details] [diff] [review]
Part 5 - Stop using a default compartment object in the IndexedDB and ProxyAutoConfig JSRuntimes. v1
Review of attachment 8476244 [details] [diff] [review]:
-----------------------------------------------------------------
OK, after part 4 it looks like the only place still using DefaultObjectForContextOrNull is JSRuntime::initSelfHosting.
This is only called as part of JS_NewContext, which is clearly before we're setting it here.
Attachment #8476244 -
Flags: review?(bobowencode) → review+
Assignee | ||
Comment 16•10 years ago
|
||
(In reply to Bob Owen (:bobowen) from comment #13)
> I've convinced myself that all the callers of
> nsJSUtils::ReportPendingException will either pass a JSContext that has a
> script context or pass the SafeJSContext.
Yep! Those are now the only 2 contexts left on the main thread. :-)
Assignee | ||
Comment 17•10 years ago
|
||
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/32f80f97a321
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/18ffee30e06a
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/0d911a34415d
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/fa5dfae27e49
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/f4c2b44cc493
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/ff8835b816c9
https://hg.mozilla.org/mozilla-central/rev/32f80f97a321
https://hg.mozilla.org/mozilla-central/rev/18ffee30e06a
https://hg.mozilla.org/mozilla-central/rev/0d911a34415d
https://hg.mozilla.org/mozilla-central/rev/fa5dfae27e49
https://hg.mozilla.org/mozilla-central/rev/f4c2b44cc493
https://hg.mozilla.org/mozilla-central/rev/ff8835b816c9
Assignee: nobody → bobbyholley
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
You need to log in
before you can comment on or make changes to this bug.
Description
•