Bug 1001821 - Wait for eyedropper to be destroyed before ending tests and checking for leaks. r=pbrosset, a=test-only
authorSami Jaktholm <sjakthol@outlook.com>
Fri, 16 Jan 2015 20:49:22 +0200
changeset 249350 cd1ae92f1ed9aad4dad820044df5eb8f6cca6239
parent 249349 f736f5e92126a7a9e41f11d3434565b93b751efe
child 249351 eaf74551577b2747db5409620e3157b96f9a25d6
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbrosset, test-only
bugs1001821
milestone37.0a2
Bug 1001821 - Wait for eyedropper to be destroyed before ending tests and checking for leaks. r=pbrosset, a=test-only
browser/devtools/eyedropper/test/browser_eyedropper_cmd.js
--- a/browser/devtools/eyedropper/test/browser_eyedropper_cmd.js
+++ b/browser/devtools/eyedropper/test/browser_eyedropper_cmd.js
@@ -26,19 +26,20 @@ function spawnTest() {
 
   yield inspectAndWaitForCopy();
 
   yield helpers.closeToolbar(options);
   yield helpers.closeTab(options);
 }
 
 function inspectAndWaitForCopy() {
-  return waitForClipboard(() => {
-    inspectPage(); // setup: inspect the page
-  }, DIV_COLOR);
+  let copied = waitForClipboard(() => {}, DIV_COLOR);
+  let ready = inspectPage(); // resolves once eyedropper is destroyed
+  
+  return Promise.all([copied, ready]);
 }
 
 function inspectPage() {
   let target = document.documentElement;
   let win = window;
 
   // get location of the <div> in the content, offset from browser window
   let box = gBrowser.selectedBrowser.getBoundingClientRect();
@@ -49,11 +50,12 @@ function inspectPage() {
 
   return dropperStarted(dropper).then(() => {
     EventUtils.synthesizeMouse(target, x, y, { type: "mousemove" }, win);
 
     return dropperLoaded(dropper).then(() => {
       EventUtils.synthesizeMouse(target, x + 10, y + 10, { type: "mousemove" }, win);
 
       EventUtils.synthesizeMouse(target, x + 10, y + 10, {}, win);
+      return dropper.once("destroy");
     });
   })
 }