Closed
Bug 797304
Opened 13 years ago
Closed 13 years ago
Reimplement MoveWrappers in terms of Orphan fixup
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
mozilla19
People
(Reporter: bholley, Assigned: bholley)
Details
Attachments
(4 files)
1.47 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
2.52 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
2.47 KB,
patch
|
peterv
:
review+
mccr8
:
feedback+
|
Details | Diff | Splinter Review |
12.05 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
Currently, when we do a document.write, we iterate over the entire old scope and move any XPCWrappedNatives (see bug 752446 comment 2 for the full dirt on why we do this). The existing implementation calls PreCreate (again) and politely asks the wrapper whether it wants to move. The edge cases here have caused us a lot of pain, so I think it might be simpler to reimplement this stuff in terms of orphan fixup (where we just trace the parent chain and follow cross-compartment wrappers).
Assignee | ||
Comment 1•13 years ago
|
||
Assignee | ||
Comment 2•13 years ago
|
||
Attachment #667457 -
Flags: review?(peterv)
Assignee | ||
Comment 3•13 years ago
|
||
To make stronger assumptions, we should dig deeper on the parent chain, and also morph any slim wrappers. This is slightly slower, but not much, since this stuff only gets called for HTML documents, and the parent chains there tend to be short. Moreover, this only gets called during document.open(), where performance doesn't matter so much.
Attachment #667458 -
Flags: review?(peterv)
Assignee | ||
Comment 4•13 years ago
|
||
Attachment #667459 -
Flags: review?(peterv)
Assignee | ||
Comment 5•13 years ago
|
||
Attachment #667460 -
Flags: review?(peterv)
Assignee | ||
Updated•13 years ago
|
Attachment #667459 -
Flags: feedback?(continuation)
Assignee | ||
Comment 6•13 years ago
|
||
Looks green! Uploaded patches and flagged for review.
Comment 7•13 years ago
|
||
Comment on attachment 667459 [details] [diff] [review]
Part 3 - Add special handling for nuked XUL elements in orphan fixup. v1
Review of attachment 667459 [details] [diff] [review]:
-----------------------------------------------------------------
Sounds like a clever workaround!
Attachment #667459 -
Flags: feedback?(continuation) → feedback+
Assignee | ||
Comment 8•13 years ago
|
||
Peter, is this something you have time for in the near future? I think this is a good time in the cycle to land this. If you don't have time, I'll try to find another reviewer.
Comment 9•13 years ago
|
||
Comment on attachment 667457 [details] [diff] [review]
Part 1 - Explicitly reparent the document to the new scope during document.open. v1
Review of attachment 667457 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/html/document/src/nsHTMLDocument.cpp
@@ +1515,5 @@
> SetIsInitialDocument(false);
>
> nsCOMPtr<nsIScriptGlobalObject> newScope(do_QueryReferent(mScopeObject));
> if (oldScope && newScope != oldScope) {
> + nsCOMPtr<nsISupports> doc = do_QueryObject(this);
static cast to nsINode* should work. We make that assumption all over content/.
Attachment #667457 -
Flags: review?(peterv) → review+
Comment 10•13 years ago
|
||
Comment on attachment 667458 [details] [diff] [review]
Part 2 - Be more aggressive when fixing up orphans. v2
Review of attachment 667458 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/xpconnect/src/XPCWrappedNative.cpp
@@ -1759,2 @@
> nsresult rv;
> - XPCWrappedNative *parentWrapper = GetParentWrapper();
Seems like this is the only caller for GetParentWrapper, remove it?
Attachment #667458 -
Flags: review?(peterv) → review+
Comment 11•13 years ago
|
||
Comment on attachment 667459 [details] [diff] [review]
Part 3 - Add special handling for nuked XUL elements in orphan fixup. v1
Review of attachment 667459 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/xpconnect/src/XPCWrappedNative.cpp
@@ +1774,5 @@
>
> + // There's one little nasty twist here. For reasons described in bug 752764,
> + // we nuke SOW-ed objects after transplanting them. This means that XUL
> + // elements, which are parented directly to their parent element, can end up
> + // with a nuked proxy n the parent chain, depending on the order of fixup.
*o*n/*i*n the parent chain?
@@ +1779,5 @@
> + // Because the proxy is nuked, we can't follow it anywhere. But we _can_ find
> + // the new wrapper for the underlying XUL parent, which is exactly what
> + // PreCreate does for XUL elements. So do that here.
> + if (MOZ_UNLIKELY(JS_IsDeadWrapper(parentObj))) {
> + MOZ_ASSERT(!strcmp(js::GetObjectClass(mFlatJSObject)->name, "XULElement"));
Nuke the assert and change the comments to talk about |nodes parented to an element|.
Attachment #667459 -
Flags: review?(peterv) → review+
Updated•13 years ago
|
Attachment #667460 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 12•13 years ago
|
||
thanks peter!
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/b57ffb225317
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/ce9b7d6c1396
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/a812a1ef0bfc
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/c37ac98907d1
Comment 13•13 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/b57ffb225317
https://hg.mozilla.org/mozilla-central/rev/ce9b7d6c1396
https://hg.mozilla.org/mozilla-central/rev/a812a1ef0bfc
https://hg.mozilla.org/mozilla-central/rev/c37ac98907d1
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in
before you can comment on or make changes to this bug.
Description
•