Bug 998387 - Middle click on newtab block button blocks the site [r=me]
authorEdward Lee <edilee@mozilla.com>
Fri, 18 Apr 2014 14:22:50 -0700
changeset 179732 9069ad3a086957aac88955a0fd38556cbf51130b
parent 179731 d0849463abf688eb5dd925770ee94602447b5a2e
child 179733 667b8d9d4c7b841390dd41cdb4afaa7b966cd72a
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersme
bugs998387
milestone31.0a1
Bug 998387 - Middle click on newtab block button blocks the site [r=me] Update test to check middle click not blocking by potentially triggering the block() codepath in onClick.
browser/base/content/test/newtab/browser_newtab_bug998387.js
--- a/browser/base/content/test/newtab/browser_newtab_bug998387.js
+++ b/browser/base/content/test/newtab/browser_newtab_bug998387.js
@@ -1,19 +1,21 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function runTests() {
   yield setLinks("0");
   yield addNewTabPageTab();
 
   // Remember if the click handler was triggered
-  let cell = getCell(0);
+  let {site} = getCell(0);
+  let origOnClick = site.onClick;
   let clicked = false;
-  cell.site.onClick = e => {
+  site.onClick = e => {
+    origOnClick.call(site, e);
     clicked = true;
     executeSoon(TestRunner.next);
   };
 
   // Send a middle-click and make sure it happened
   let block = getContentDocument().querySelector(".newtab-control-block");
   yield EventUtils.synthesizeMouseAtCenter(block, {button: 1}, getContentWindow());
   ok(clicked, "middle click triggered click listener");