Closed Bug 860176 Opened 13 years ago Closed 13 years ago

Frameworker's document-element-inserted not removed if worker is closed quickly

Categories

(Firefox Graveyard :: SocialAPI, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 23

People

(Reporter: markh, Assigned: markh)

Details

(Whiteboard: [qa-])

Attachments

(1 file)

Stumbled across this. Add the following patch to Frameworker: Services.obs.addObserver(function injectController(doc, topic, data) { + dump("injectController fired for " + self.name + " - " + doc.location.href + "\n"); if (!doc.defaultView || doc.defaultView != self.frame.contentWindow) { return; } + dump("injectController is ours\n"); Services.obs.removeObserver(injectController, "document-element-inserted"); try { self.createSandbox(); } catch (e) { Cu.reportError("FrameWorker: failed to create sandbox for " + url + ". " + e); } }, "document-element-inserted", false); + dump("added injectController for " + this.name + " - " + this.url + "\n"); and run the frameworker tests. By the end of the tests you see: added injectController for SocialProvider:http://example.com - http://example.com/browser/toolkit/components/social/test/browser/worker_social.js injectController fired for SocialProvider:http://example.com - http://example.com/browser/toolkit/components/social/test/browser/worker_social.js injectController is ours injectController fired for testEarlyClose - http://example.com/browser/toolkit/components/social/test/browser/worker_social.js injectController fired for SocialProvider:http://example.com - http://example.com/browser/toolkit/components/social/test/browser/worker_social.js injectController fired for SocialProvider:http://example.com - http://example.com/browser/toolkit/components/social/test/browser/worker_social.js Meaning there are a number of observers which were added but are never removed. I'm guessing this is a result of us closing the worker in some cases before it has fully initialized.
Assignee: nobody → mhammond
OS: Windows 7 → All
Hardware: x86_64 → All
This patch tracks if the observer has fired and removed itself, and if not, removes it in the terminate() method.
Attachment #737352 - Flags: review?(jaws)
Comment on attachment 737352 [details] [diff] [review] Check if we need to remove observer in terminate() method Review of attachment 737352 [details] [diff] [review]: ----------------------------------------------------------------- Nice fix!
Attachment #737352 - Flags: review?(jaws) → review+
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 23
Whiteboard: [qa-]
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: