Bug 1321133 - Backout 1285373 for regressions in pageworks. r=kmaglione
authorMichael Kaply <mozilla@kaply.com>
Thu, 01 Dec 2016 12:09:44 -0600
changeset 325074 2d8e3c16f55b492e77cd0d9147d235141d3f4287
parent 325073 6ee056796f7b0a6855930807249a51eb667631d2
child 325075 f03cdaa7c326306660a6952833ad3a8be6f26992
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewerskmaglione
bugs1321133, 1285373
milestone53.0a1
Bug 1321133 - Backout 1285373 for regressions in pageworks. r=kmaglione MozReview-Commit-ID: 3dXTJHFady0
addon-sdk/source/lib/sdk/event/chrome.js
addon-sdk/source/test/leak/jetpack-package.ini
addon-sdk/source/test/leak/leak-utils.js
addon-sdk/source/test/leak/test-leak-event-chrome.js
--- a/addon-sdk/source/lib/sdk/event/chrome.js
+++ b/addon-sdk/source/lib/sdk/event/chrome.js
@@ -52,14 +52,14 @@ function observe(topic) {
   // observerChannel (since third argument is `true`). There for if it
   // will be GC-ed with all it's event listeners once no other references
   // will be held.
   addObserver(observerChannel, topic, true);
 
   // We need to remove any observer added once the add-on is unloaded;
   // otherwise we'll get a "dead object" exception.
   // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1001833
-  unload(() => removeObserver(observerChannel, topic), { weak: true });
+  unload(() => removeObserver(observerChannel, topic));
 
   return observerChannel;
 }
 
 exports.observe = observe;
--- a/addon-sdk/source/test/leak/jetpack-package.ini
+++ b/addon-sdk/source/test/leak/jetpack-package.ini
@@ -1,8 +1,7 @@
 [DEFAULT]
 support-files =
   leak-utils.js
 
 [test-leak-window-events.js]
 [test-leak-event-dom-closed-window.js]
 [test-leak-tab-events.js]
-[test-leak-event-chrome.js]
--- a/addon-sdk/source/test/leak/leak-utils.js
+++ b/addon-sdk/source/test/leak/leak-utils.js
@@ -26,17 +26,16 @@ function gc() {
           resolve();
         }
       }
     }
 
     Cu.schedulePreciseGC(genGCCallback());
   });
 }
-exports.gc = gc;
 
 // Execute the given test function and verify that we did not leak windows
 // in the process.  The test function must return a promise or be a generator.
 // If the promise is resolved, or generator completes, with an sdk loader
 // object then it will be unloaded after the memory measurements.
 exports.asyncWindowLeakTest = function*(assert, asyncTestFunc) {
 
   // SelfSupportBackend periodically tries to open windows.  This can
deleted file mode 100644
--- a/addon-sdk/source/test/leak/test-leak-event-chrome.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-'use strict';
-
-const { gc } = require("./leak-utils");
-const { Loader } = require("sdk/test/loader");
-const { Cu } = require("chrome");
-const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
-
-exports["test sdk/event/chrome does not leak when not referenced"] = function*(assert) {
-  let loader = Loader(module);
-  let { observe } = loader.require("sdk/event/chrome");
-  let { on } = loader.require("sdk/event/core");
-
-  let gotFooEvent = false;
-  on(observe("test-foo"), "data", function(evt) {
-    gotFooEvent = true;
-  });
-
-  let bar = observe("test-bar");
-  let barPromise = new Promise(resolve => {
-    on(bar, "data", function(evt) {
-      assert.ok(!gotFooEvent, "should not have gotten test-foo event");
-      resolve();
-    });
-  });
-
-  // This should clear the test-foo observer channel because we are not
-  // holding a reference to it above.
-  yield gc();
-
-  Services.obs.notifyObservers(null, "test-foo", null);
-  Services.obs.notifyObservers(null, "test-bar", null);
-
-  yield barPromise;
-
-  loader.unload();
-}
-
-require("sdk/test").run(exports);