Bug 1288440 - Part 4: Test that sdk/window/events does not leak existing windows. r=gabor, a=sledru
authorBen Kelly <ben@wanderview.com>
Fri, 22 Jul 2016 06:26:49 -0700
changeset 340136 cc2c70e60632d87e27545833f55419c86a3d41a5
parent 340135 7ead20a4ee6e8d6642ad6a2aa9862761ff1cd324
child 340137 e7f05d6e1e2f181602977a24c75152287b2b8a95
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgabor, sledru
bugs1288440
milestone49.0a2
Bug 1288440 - Part 4: Test that sdk/window/events does not leak existing windows. r=gabor, a=sledru
addon-sdk/source/test/leak/test-leak-window-events.js
--- a/addon-sdk/source/test/leak/test-leak-window-events.js
+++ b/addon-sdk/source/test/leak/test-leak-window-events.js
@@ -39,9 +39,27 @@ exports["test window/events for leaks"] 
       });
 
       // Open a window.  This will trigger our data events.
       open();
     });
   });
 };
 
+exports["test window/events for leaks with existing window"] = function*(assert) {
+  yield asyncWindowLeakTest(assert, _ => {
+    return new Promise((resolve, reject) => {
+      let loader = Loader(module);
+      let w = open();
+      w.addEventListener("load", function windowLoaded(evt) {
+        w.removeEventListener("load", windowLoaded);
+        let { events } = loader.require("sdk/window/events");
+        w.addEventListener("DOMWindowClose", function windowClosed(evt) {
+          w.removeEventListener("DOMWindowClose", windowClosed);
+          resolve(loader);
+        });
+        w.close();
+      });
+    });
+  });
+};
+
 require("sdk/test").run(exports);