Closed
Bug 902718
Opened 12 years ago
Closed 12 years ago
Move XBL off of nsIScriptContext
Categories
(Core :: XBL, defect)
Tracking
()
RESOLVED
FIXED
mozilla26
People
(Reporter: bholley, Assigned: bholley)
References
Details
Attachments
(11 files, 2 obsolete files)
1.12 KB,
patch
|
mccr8
:
review+
|
Details | Diff | Splinter Review |
2.08 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
8.86 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
1.05 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
7.86 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
1.77 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
9.18 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
6.24 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
11.36 KB,
patch
|
bzbarsky
:
review+
mccr8
:
review+
|
Details | Diff | Splinter Review |
3.16 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
38.06 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
This is the first part of bug 901106. I have working patches.
Assignee | ||
Comment 1•12 years ago
|
||
Apparently the current setup is incidentally safe, but far from kosher.
Attachment #787269 -
Flags: review?(continuation)
Assignee | ||
Comment 2•12 years ago
|
||
Attachment #787270 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 3•12 years ago
|
||
Attachment #787271 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 4•12 years ago
|
||
Attachment #787272 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 5•12 years ago
|
||
This kind of has to be done all at once. The primary correctness concern here is
making sure that we continue to operate in the correct compartment. So the basic
strategy here is as follows.
For most anything that previously took a script context, we remove the parameter
entirely and assert that the stack-top cx is in the compartment of the
compilation scope. We then bubble this up through all the callers until we hit
a caller that finds the scx via some means other than its parameter list. At
these points, we push the scx, making it stack-top.
This puts us in a good position to switch wholesale to the SafeJSContext in
subsequent patches.
Attachment #787273 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 6•12 years ago
|
||
Currently we always pull the global off the nsIScriptContext, and trigger
a call to EnsureScriptEnvironment in the GetContext() call. So as we move away
from nsIScriptContext, let's make sure that GetGlobalJSObject continues to work
correctly.
Attachment #787274 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 7•12 years ago
|
||
Attachment #787275 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 8•12 years ago
|
||
Attachment #787276 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 9•12 years ago
|
||
Attachment #787277 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 10•12 years ago
|
||
Attachment #787278 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 11•12 years ago
|
||
Flagging bz for general review, mccr8 on the new CC setup.
Attachment #787279 -
Flags: review?(continuation)
Attachment #787279 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 12•12 years ago
|
||
Attachment #787280 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 13•12 years ago
|
||
Updated•12 years ago
|
Attachment #787269 -
Flags: review?(continuation) → review+
Comment 14•12 years ago
|
||
Comment on attachment 787279 [details] [diff] [review]
Part 11 - Stop using nsIScriptContext for XBL compilation. v1
Review of attachment 787279 [details] [diff] [review]:
-----------------------------------------------------------------
r=me on the CC stuff
::: content/xbl/src/nsXBLDocumentInfo.cpp
@@ +57,5 @@
>
> static JSBool doCheckAccess(JSContext *cx, JS::Handle<JSObject*> obj,
> JS::Handle<jsid> id, uint32_t accessType);
>
> + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsXBLDocGlobalObject)
Please move this up after to the NS_DECL_CYCLE_COLLECTING_ISUPPORTS so it is easier to find.
@@ +353,5 @@
> if (tmp->mBindingTable) {
> tmp->mBindingTable->Enumerate(TraverseProtos, &cb);
> }
> NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mGlobalObject");
> + cb.NoteXPCOMChild(tmp->mGlobalObject);
Please replace this line and the previous NOTE_EDGE_NAME one with just
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGlobalObject)
(This could have been done before your patches, too.)
Attachment #787279 -
Flags: review?(continuation) → review+
![]() |
||
Comment 15•12 years ago
|
||
Comment on attachment 787270 [details] [diff] [review]
Part 2 - Add a mechanism to assert that the stack-top cx is an XBL compilation scope. v1
r=me
Attachment #787270 -
Flags: review?(bzbarsky) → review+
![]() |
||
Comment 16•12 years ago
|
||
Comment on attachment 787271 [details] [diff] [review]
Part 3 - Stop taking an nsIScriptContext in XBL serialization routines. v1
r=me
Attachment #787271 -
Flags: review?(bzbarsky) → review+
![]() |
||
Comment 17•12 years ago
|
||
Comment on attachment 787272 [details] [diff] [review]
Part 4 - Switch to nsJUtils::EvaluateString in InstallField. v1
>- AutoPushJSContext cx(aContext->GetNativeContext());
>+ AutoJSContext cx;
Why is this change ok?
>+ rv = nsJSUtils::EvaluateString(cx, nsDependentString(mFieldText,
>+ mFieldTextLength),
>+ wrappedNode, compileOptions, evalOptions,
> result.address());
Please fix the indent.
Again, is this going to not screw up the operation callback stuff?
![]() |
||
Comment 18•12 years ago
|
||
Comment on attachment 787274 [details] [diff] [review]
Part 6 - Fix up nsXBLDocGlobalObject::GetGlobalJSObject() to force lazy global creation. v1
r=me
Attachment #787274 -
Flags: review?(bzbarsky) → review+
![]() |
||
Comment 19•12 years ago
|
||
Comment on attachment 787275 [details] [diff] [review]
Part 7 - Use the SafeJSContext for XBL serialization and deserialization. v1
r=me
Attachment #787275 -
Flags: review?(bzbarsky) → review+
![]() |
||
Comment 20•12 years ago
|
||
Comment on attachment 787276 [details] [diff] [review]
Part 8 - Use the SafeJSContext for prototype member compilation. v1
r-me
Attachment #787276 -
Flags: review?(bzbarsky) → review+
![]() |
||
Comment 21•12 years ago
|
||
Comment on attachment 787280 [details] [diff] [review]
Part 12 - Fold EnsureScriptEnvironment into GetCompilationGlobal. v1
r=me
Attachment #787280 -
Flags: review?(bzbarsky) → review+
![]() |
||
Comment 22•12 years ago
|
||
Comment on attachment 787277 [details] [diff] [review]
Part 9 - Stop using nsIScriptGlobalObjectOwner to grab the compilation global. v1
r=me
Attachment #787277 -
Flags: review?(bzbarsky) → review+
![]() |
||
Comment 23•12 years ago
|
||
Comment on attachment 787278 [details] [diff] [review]
Part 10 - Remove nsIScriptGlobalObjectOwner from XBL. v1
>- NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIScriptGlobalObjectOwner)
This needs to become:
NS_INTERFACE_MAP_ENTRY(nsISupports)
r=me with that
Attachment #787278 -
Flags: review?(bzbarsky) → review+
Comment 24•12 years ago
|
||
Comment on attachment 787270 [details] [diff] [review]
Part 2 - Add a mechanism to assert that the stack-top cx is an XBL compilation scope. v1
Review of attachment 787270 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/xbl/src/nsXBLDocumentInfo.h
@@ +72,5 @@
>
> +#ifdef DEBUG
> +void AssertInCompilationScope();
> +#else
> +#define AssertInCompilationScope() {}
This looks fishy... Should probably be
void AssertInCompilationScope() {}
or
#define AssertInCompilationScope()
Comment 25•12 years ago
|
||
Comment on attachment 787272 [details] [diff] [review]
Part 4 - Switch to nsJUtils::EvaluateString in InstallField. v1
Review of attachment 787272 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/xbl/src/nsXBLProtoImplField.cpp
@@ +426,5 @@
> + .setVersion(JSVERSION_LATEST);
> + nsJSUtils::EvaluateOptions evalOptions;
> + rv = nsJSUtils::EvaluateString(cx, nsDependentString(mFieldText,
> + mFieldTextLength),
> + wrappedNode, compileOptions, evalOptions,
Indentation
Assignee | ||
Comment 26•12 years ago
|
||
Comment on attachment 787272 [details] [diff] [review]
Part 4 - Switch to nsJUtils::EvaluateString in InstallField. v1
(In reply to Boris Zbarsky (:bz) (vacation Aug 10-19) from comment #17)
> Comment on attachment 787272 [details] [diff] [review]
> Part 4 - Switch to nsJUtils::EvaluateString in InstallField. v1
>
> >- AutoPushJSContext cx(aContext->GetNativeContext());
> >+ AutoJSContext cx;
>
> Why is this change ok?
You're right. I thought at the time that this was the XBL nsIScriptContext, but it's actually the one from the associated document, which makes this change incorrect and orthogonal to my goals in this bug. I'll toss this patch and rebase the next one.
Attachment #787272 -
Attachment is obsolete: true
Attachment #787272 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 27•12 years ago
|
||
Attachment #787273 -
Attachment is obsolete: true
Attachment #787273 -
Flags: review?(bzbarsky)
Attachment #787665 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 28•12 years ago
|
||
![]() |
||
Comment 29•12 years ago
|
||
Comment on attachment 787665 [details] [diff] [review]
Part 4 & 5 - Rip out nsIScriptContext from the lion's share of XBL code. v2
>+++ b/content/xbl/src/nsXBLProtoImplField.cpp
>@@ -402,38 +402,35 @@ nsXBLProtoImplField::InstallField(nsIScriptContext* aContext,
>- nsCOMPtr<nsIScriptContext> context = aContext;
We're sure either caller has a strong ref or evaluation of the field can't destroy aContext for some other reason?
r=me modulo that
Attachment #787665 -
Flags: review?(bzbarsky) → review+
![]() |
||
Comment 30•12 years ago
|
||
Comment on attachment 787279 [details] [diff] [review]
Part 11 - Stop using nsIScriptContext for XBL compilation. v1
Seems reasonable.
Attachment #787279 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 31•12 years ago
|
||
(In reply to Vacation until Aug 19. Do not ask for review. from comment #29)
> We're sure either caller has a strong ref or evaluation of the field can't
> destroy aContext for some other reason?
Yeah, the caller has a strong ref.
Assignee | ||
Comment 32•12 years ago
|
||
Comment 33•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/73ead14de387
https://hg.mozilla.org/mozilla-central/rev/cc6f5065e2fa
https://hg.mozilla.org/mozilla-central/rev/dcce29a469bd
https://hg.mozilla.org/mozilla-central/rev/1c9c29452c75
https://hg.mozilla.org/mozilla-central/rev/3f5f91d29bb3
https://hg.mozilla.org/mozilla-central/rev/76069d28109b
https://hg.mozilla.org/mozilla-central/rev/aa7282f72c70
https://hg.mozilla.org/mozilla-central/rev/4a9a068669cb
https://hg.mozilla.org/mozilla-central/rev/183f357bc3eb
https://hg.mozilla.org/mozilla-central/rev/26898c90f9cc
https://hg.mozilla.org/mozilla-central/rev/c588b8f7b26e
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in
before you can comment on or make changes to this bug.
Description
•