Closed
Bug 601803
Opened 14 years ago
Closed 14 years ago
Support adopting a node cross-compartment
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
blocking2.0 | --- | beta8+ |
People
(Reporter: peterv, Assigned: mrbkap)
References
Details
(Keywords: regression, Whiteboard: [compartments], [Input] fixed-in-tracemonkey)
Attachments
(2 files, 4 obsolete files)
35.49 KB,
patch
|
gal
:
review+
jst
:
review+
|
Details | Diff | Splinter Review |
1.69 KB,
patch
|
Details | Diff | Splinter Review |
We've added code to bail out (see nsNodeUtils::CloneAndAdopt) but we should instead brain-transplant the existing XPCWrappedNative's JSObject into the new compartment.
Comment 1•14 years ago
|
||
There are some interesting problems to work through here.
It's helpful to think of even XPCOM objects as living in a particular compartment. Like JS objects, DOM nodes collectively belong to a domain and have the same principals. I think eventually we want them to be allocated in compartments in fact. If we really do want to go in that direction, then I think we have to implement this using a lot of C++ Swap() methods. Adopting would be O(total size of the tree being adopted).
JS_TransplantWrapper does not work on ordinary JSObjects yet, only non-script proxies. A brain transplant would be a bit more complex for ordinary JSObjects. When you move an object from one compartment to another, any pointers it holds to other values in its compartment of origin must be rewrapped for the new compartment. That's easy enough to do for pointers directly held by the JSObject itself-- simply loop over all the fslots and dslots (proto and parent, too) and use compartment->wrap on each one. For JSObjects held by the underlying C++ object (event handlers? nsIDOM3Node::setUserData? WrappedJS-es?) I'm not sure how to do it.
Comment 3•14 years ago
|
||
This should block bug 584237, otherwise it is too difficult to find.
Blocks: compartments
Comment 4•14 years ago
|
||
Over to mrbkap who's likely going to work on XPCWrappedNative brain transplanting, and blocking.
Comment 6•14 years ago
|
||
I would like to see this bug blocking beta7, not beta8 per bug 604612
Updated•14 years ago
|
Whiteboard: [compartments]
Comment 7•14 years ago
|
||
In my opinion this bug should block beta7, but beta7 was released yesterday and we still have the problem and a big marketing problem in Spain, Tuenti.com does not load (this site is more important than Facebook in Spain).
Just imagine a Firefox 4 beta which is unable to load Facebook...
Comment 8•14 years ago
|
||
Rubén, knowing this before b7 cutoff might have helped, but it's water under the bridge. The best we can do is get a fix in a nightly and promote a stable nightly with the fix instead of b7.
Blake, is this fixable soon?
/be
Comment 9•14 years ago
|
||
This is the most complex bug to fix for b8, so we are dealing with it first. It will probably take 2 or 3 days to fix.
Comment 10•14 years ago
|
||
Sorry guys, I though you were aware about this site importance due bug #604612 comments.
Thanks for your hard work!
Assignee | ||
Comment 11•14 years ago
|
||
This is missing the JS bits (it doesn't even compile), but it's a first stab at what I think need to be done in XPConnect.
Comment 12•14 years ago
|
||
More potent swap that should work across compartments and can also swap objects with different builtin slot count as well as native and non-native objects.
Updated•14 years ago
|
Updated•14 years ago
|
Whiteboard: [compartments] → [compartments], [Input]
Comment 13•14 years ago
|
||
Sorry for bug spam, but this tuenti.com is the second highest submitted site with issues on beta 7 via Input - http://input.mozilla.com/en-US/site/http/tuenti.com?sentiment=sad&search_type=latest+beta . I think they're all related to this issue.
Comment 14•14 years ago
|
||
Any way we can test that patch to ensure it's having the desired effect?
Comment 15•14 years ago
|
||
For what its worth, I applied attachment 490287 [details] [diff] [review] to my working mozilla-central tree on Mac OS and an assertion failed during startup/initial page load (maybe this stack trace will help someone).
I am not trying to work on this bug, but I was trying to determine if it explains a problem I am experiencing with an extension. My extension stores a JS object as a JS property on a content node and then tries to retrieve the object later... but this does not work reliably with recent builds (it did work OK in Firefox 4.0b6 and in 3.x).
Assignee | ||
Comment 16•14 years ago
|
||
Mark, I think your problem is another bug, please file it.
The patches in this bug are buggy for sure. We're still debugging them.
Comment 17•14 years ago
|
||
(In reply to comment #16)
> Mark, I think your problem is another bug, please file it.
Done. See bug 613515.
Assignee | ||
Comment 18•14 years ago
|
||
This doesn't crash immediately upon brain transplants or even after the first GC, but I haven't made sure that the result actually works or that expando properties are preserved (I doubt they do, Andreas, I think we need to expose a version JSObject::swap that only swaps properties (i.e. not the proto, parent and class) as well).
Attachment #490013 -
Attachment is obsolete: true
Attachment #490287 -
Attachment is obsolete: true
Attachment #491682 -
Attachment is obsolete: true
Comment 19•14 years ago
|
||
Per discussion with mrbkap and gal we don't need to finalize this for beta8, pushing to beta9.
blocking2.0: beta8+ → beta9+
Comment 20•14 years ago
|
||
(In reply to comment #19)
> Per discussion with mrbkap and gal we don't need to finalize this for beta8,
> pushing to beta9.
Please, could you reconsider this? This bug is breaking the most important social network in Spain (more that 8 million users) and is the 3rd site reported as "not working" at input.mozilla.org (comment #13)
We are having a big marketing problem in Spain with Firefox 4 betas and this bug.
Comment 21•14 years ago
|
||
I'd thought this was one of the critical issues for beta 8, too. Can someone elaborate on why it's being bumped?
Comment 22•14 years ago
|
||
Yeah, would like to know why here, and how much work is remaining here? Days? Weeks? Original estimate was a couple/few days.
Moving back to beta 8 until we have an answer here.
blocking2.0: beta9+ → beta8+
Comment 23•14 years ago
|
||
We have a patch but it needs work. I agree doing this for b8 would be good. Need Blake for this but I can help.
Comment 24•14 years ago
|
||
I fully agree that this would be good to fix for beta8, but given that we're not confident in the fix yet and the planned freeze *was* today I think we'd be better off releasing what we have than delaying only for this. But seems we're delaying for other reasons now, so we'll obviously try to get this in if at all possible. If it doesn't get fixed for beta8, it'll be fixed in the beta after that.
Comment 25•14 years ago
|
||
Need progress here soon. If we think this is going to take a week, we should ship beta 8 without it, and get it in as soon as possible. To be clear: Yes, we're going to fix it; however, we're tight on resources in this area so please be patient (typing to those users of the Spanish social networking site).
Comment 26•14 years ago
|
||
(In reply to comment #25)
> Need progress here soon. If we think this is going to take a week, we should
> ship beta 8 without it, and get it in as soon as possible. To be clear: Yes,
> we're going to fix it; however, we're tight on resources in this area so please
> be patient (typing to those users of the Spanish social networking site).
I agree with you, but you also have to think that we couldn't enter the site since two months ago.
Comment 27•14 years ago
|
||
Yes, it'll be a tough call. We are also planning on doing more non-tech outreach for beta8, so it would be unfortunate not to get this in.
On the other hand, we need feedback on the other fixes, this issue has existed for multiple betas, and we plan to have beta9 come fairly quickly after.
Assignee | ||
Comment 28•14 years ago
|
||
I just pushed this to try, though on first glance it appears to work.
Attachment #492466 -
Attachment is obsolete: true
Attachment #494598 -
Flags: review?(peterv)
Attachment #494598 -
Flags: review?(jst)
Attachment #494598 -
Flags: review?(gal)
Comment 29•14 years ago
|
||
Comment 30•14 years ago
|
||
Comment on attachment 494598 [details] [diff] [review]
patch v1
> * This function is called when a window is navigating. In that case, we
>- * need to "move" the window from wrapper's compartment to target's
>+ * need to "move" the window from origobj's compartment to target's
> * compartment.
This function is called when an object moves from one origin to another, i.e. a window is navigating or a node is being adopted.
Attachment #494598 -
Flags: review?(gal) → review+
Comment 31•14 years ago
|
||
For the record, it's looking very likely that this will land today, and thus be fixed in beta8.
Assignee | ||
Comment 33•14 years ago
|
||
Whiteboard: [compartments], [Input] → [compartments], [Input] fixed-in-tracemonkey
Comment 34•14 years ago
|
||
This landed on mozilla-central last night, marking FIXED!
http://hg.mozilla.org/mozilla-central/rev/a4813c8be814
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Comment 35•14 years ago
|
||
Yeah! Now it works perfectly. Thanks.
Updated•14 years ago
|
Attachment #494598 -
Flags: review?(jst) → review+
Comment 36•14 years ago
|
||
we need to figure out if this could be connected to the crash regression on dec 4 in bug 617048
Comment 37•14 years ago
|
||
The mochitest fails with my current iteration of parserless about:blank (attachment 541670 [details] [diff] [review]) applied. How do I need to prepare the generated about:blank to make sure the expando in the mochitest added here gets preserved?
Comment 38•14 years ago
|
||
The solution from bug 428653 comment 25 applies here, too.
Reporter | ||
Comment 39•12 years ago
|
||
Comment on attachment 494598 [details] [diff] [review]
patch v1
gal and jst r+'ed, don't think I can add anything (well, clownshoes+).
Attachment #494598 -
Flags: review?(peterv)
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•