Now that bug 769273 has now landed in m-c, we should start using Cu.nukeSandox in order to kill all leaks on addon disabling. Here is a pull request to start using it on CommonJS modules: https://github.com/mozilla/addon-sdk/pull/479 We may want to use it for content script sandboxes too.
Works perfectly! Given pull request 479 and last try server build from gabor (bug 769273 comment 39) And an awfull addons which desperatly want to leak by using such code: require("window-utils").activeBrowserWindow.foo = this; We end up leaking only cuddlefish and loader sandboxes instead of all 41 module sandboxes! We are leaking these two because we don't call nukeSandbox on them.
Commits pushed to master at https://github.com/mozilla/addon-sdk https://github.com/mozilla/addon-sdk/commit/220332b32b255d508de9f583d149216302c3adbe Bug 775067: Start using Cu.nukeSandbox for CommonJS modules. https://github.com/mozilla/addon-sdk/commit/13eb5e5cbfd6104e18cf76aadf276eabfc3f5265 Merge pull request #479 from ochameau/leak/use-nukeSandbox Bug 775067: Prevent leaking sandboxes by using Cu.nukeSandbox. r=@gozala
(In reply to Alexandre Poirot (:ochameau) from comment #1) > We end up leaking only cuddlefish and loader sandboxes instead of all 41 > module sandboxes! We are leaking these two because we don't call nukeSandbox > on them. Hopefully bug 771409 will take care of that!