Closed Bug 601557 Opened 12 years ago Closed 12 years ago

imgRequestProxy requests in async_load_tests.js are too susceptible to garbage collection

Categories

(Core :: Graphics: ImageLib, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b7

People

(Reporter: jdm, Assigned: jdm)

References

Details

Attachments

(2 files)

Applying the httpd.js GC patch from bug 508128 has exposed a problem in the tests in async_load_tests.js.  Since imgRequests only hold weak references to the proxies, the only strong ref comes from the |var req = loader.loadImageWithChannel(...)| lines.  With the 508128 patch, there's a race which httpd.js can win which initiates a GC before the various necko events occur.  Since the req variable is out of scope at this point, the proxy is destroyed and triggers the |NS_PRECONDITION(!mListener, "Someone forgot to properly cancel this request!");| assertion.  The attached testcase easily demonstrates this with 508128 applied - for me it consistently asserts in check-interactive and passes in check-one.
Attached patch Reduced testcaseSplinter Review
The easiest fix is just to push each request onto a global array which retains them until the end of time.  I don't know if it's worth trying to find a more elegant solution.
Like so.
Attachment #480578 - Flags: review?(joe)
Attachment #480578 - Flags: review?(joe) → review+
http://hg.mozilla.org/mozilla-central/rev/56e77ab3cb8d
Assignee: nobody → josh
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b8
Target Milestone: mozilla2.0b8 → mozilla2.0b7
You need to log in before you can comment on or make changes to this bug.