Closed Bug 613515 Opened 14 years ago Closed 13 years ago

JS properties set from chrome are lost

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
Tracking Status
blocking2.0 --- betaN+

People

(Reporter: mcs, Assigned: gal)

References

Details

(Keywords: regression, Whiteboard: [hardblocker][fixed-in-tracemonkey][fx4-fixed-bugday])

Attachments

(6 files)

I mentioned this problem in bug 601803... I have an extension that assigns a JS Object to a property on a content element.  In Firefox 4.0b7 and in current trunk builds, the object cannot be retrieved reliably from within the extension (the value is undefined).

Usually, the object can be retrieved for at least a few seconds (or several retrievals) before undefined is returned.  After undefined is returned the first time, subsequent retrievals always return undefined.

We created a small extension that demonstrates the problem and we will post it here shortly.

This problem does not occur in Firefox 3.6.12 or in Firefox 4.0b6.
To see the problem, install this extension.  After page load, it adds an image element to the page and assigns a JS Object to the element in a property named MYPROP.  It then starts a timer that checks MYPROP every second, displaying an alert when undefined is returned.  Click the image to attempt to access MYPROP manually.

We added the timer to make it easier to see the problem; without the timer, the problem will still occur if you click the image enough times.
Sounds like we don't gc-mark xray wrappers from the wrapped object?
blocking2.0: --- → ?
Group: core-security
If #2 is correct, we should hide the bug.
This shouldn't be a security bug. No GC hazard here. All this means is that expando properties get lost when the proxy gets recreated when the object is next touched from chrome.
(In reply to comment #4)
> All this means is that expando properties get lost when the proxy gets
> recreated when the object is next touched from chrome.

So does that mean this is a valid bug?  Or is this "by design"?  If this is a valid bug, is it something that is likely to be fixed in an upcoming beta?
This is a valid bug.

/be
Group: core-security
Blake, I thought that we were going to disallow setting custom properties on xray wrappers altogether. Did that not actually work out?
We need to sort this out one way or another before we ship.
blocking2.0: ? → betaN+
Andreas, mrbkap says you could fix this one. Over to you to offload mrbkap a bit.
Assignee: mrbkap → gal
Whiteboard: [hardblocker]
Attached patch patchSplinter Review
back to blake for debugging
Assignee: gal → mrbkap
We are still seeing some rather strange failures so it will probably take another few days.
Attached patch Fix for thatSplinter Review
This patch applies on top of attachment 503712 [details] [diff] [review] and fixes the testcase here. I think that with these two patches, we can land this!
Attachment #504045 - Flags: review?(gal)
Attachment #504045 - Flags: review?(gal) → review+
The two attached patches combined cause test failures and leaks, specifically on the browser chrome test browser/base/content/test/browser_inspector_tab_switch.js.

And I also see:

REFTEST TEST-UNEXPECTED-FAIL | file:///home/cltbld/talos-slave/test/build/jsreftest/tests/jsreftest.html?test=js1_5/extensions/regress-369696-02.js | No test results reported. (SCRIPT)
REFTEST TEST-UNEXPECTED-FAIL | file:///home/cltbld/talos-slave/test/build/jsreftest/tests/jsreftest.html?test=js1_5/Regress/regress-417893.js | No test results reported. (SCRIPT)

on all platforms on try.

Andreas, can you look into this more? Blake has his plate pretty full atm.

I'll attach the output of a browser chrome test run w/o this set of patches (works.log) and with (fails.log).
Attached file works.log
Attached file fails.log
Meh, leaks are my least favorite bugs to look at.
Assignee: mrbkap → gal
It is certainly possible that the leak is due to a failure in the test causing something to not be properly torn down. So maybe the best approach here is to fix the errors first (the jsreftest ones), and then check whether the leaks remain or not, etc. I can help test if you have something resembling a fix for some of the errors...
Yeah, good point.
jst, neither reftest has anything to do with wrappers. Are you sure no other patches were involved when you pushed?
I don't see anything else that could cause the tests, the push was based on a revision that didn't show any problems on m-c.

The try results are at:

http://tbpl.mozilla.org/?tree=MozillaTry&rev=e3650aaf3792

and the m-c results for the commit which mine was based on are at:

http://tbpl.mozilla.org/?rev=b22bb39e834f

I'll try to reproduce the js test failures locally to confirm.
I tried a local shell reftest run. If this is some mean GC bug, maybe we mess up an unrelated test in the browser?
jst can reproduce this
This fixes the issues seen in the last push to try. This is from Andreas, r=mrbkap.
Attachment #506041 - Flags: review+
http://hg.mozilla.org/tracemonkey/rev/5a6e9e7e487a
Whiteboard: [hardblocker] → [hardblocker], fixed-in-tracemonkey
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
No longer blocks: 628599
Depends on: 628599
Verified with Mozilla/5.0 (X11; Linux i686; rv:2.0b12pre) Gecko/20110204 Firefox/4.0b12pre
Status: RESOLVED → VERIFIED
Whiteboard: [hardblocker], fixed-in-tracemonkey → [hardblocker][fixed-in-tracemonkey][fx4-fixed-bugday]
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: