Bug 1080943 - Leak fix for 5994d92115ac copied from Loop's head.js. rs=bustage a=dolske
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Mon, 01 Dec 2014 00:14:08 -0800
changeset 242519 94d5dccebb4ee3791e37a077fbad4ca379b0c86a
parent 242518 ea2567a86c38151e83cd402ae1f7bf69ed2307c5
child 242520 400155de9bb8fa981a9995e8ec5fd82c86b97dd1
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage, dolske
bugs1080943
milestone36.0a2
Bug 1080943 - Leak fix for 5994d92115ac copied from Loop's head.js. rs=bustage a=dolske
browser/components/loop/test/mochitest/head.js
browser/modules/test/browser_UITour_loop.js
--- a/browser/components/loop/test/mochitest/head.js
+++ b/browser/components/loop/test/mochitest/head.js
@@ -59,17 +59,17 @@ function promiseGetMozLoopAPI() {
     // Remove the iframe after each test. This also avoids mochitest complaining
     // about leaks on shutdown as we intentionally hold the iframe open for the
     // life of the application.
     registerCleanupFunction(function() {
       loopPanel.hidePopup();
       let frameId = btn.getAttribute("notificationFrameId");
       let frame = document.getElementById(frameId);
       if (frame) {
-        loopPanel.removeChild(frame);
+        frame.remove();
       }
     });
   });
 }
 
 /**
  * Loads the loop panel by clicking the button and waits for its open to complete.
  * It also registers
--- a/browser/modules/test/browser_UITour_loop.js
+++ b/browser/modules/test/browser_UITour_loop.js
@@ -56,12 +56,23 @@ function checkLoopPanelIsHidden() {
   ok(!loopPanel.hasAttribute("noautohide"), "@noautohide on the loop panel should have been cleaned up");
   ok(!loopPanel.hasAttribute("panelopen"), "The panel shouldn't have @panelopen");
   isnot(loopPanel.state, "open", "The panel shouldn't be open");
   is(loopButton.hasAttribute("open"), false, "Loop button should know that the panel is closed");
 }
 
 if (Services.prefs.getBoolPref("loop.enabled")) {
   loopButton = window.LoopUI.toolbarButton.node;
+  registerCleanupFunction(() => {
+    // Copied from browser/components/loop/test/mochitest/head.js
+    // Remove the iframe after each test. This also avoids mochitest complaining
+    // about leaks on shutdown as we intentionally hold the iframe open for the
+    // life of the application.
+    let frameId = loopButton.getAttribute("notificationFrameId");
+    let frame = document.getElementById(frameId);
+    if (frame) {
+      frame.remove();
+    }
+  });
 } else {
   ok(true, "Loop is disabled so skip the UITour Loop tests");
   tests = [];
 }