Bug 1277750, fix intermittent bug734076.js test failure on linux64 e10s by forcing a size onto the <img> element loading an invalid URI, r=mikedeboer, a=test-only
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 06 Oct 2016 16:11:02 +0100
changeset 350657 0d849c4393fed898813a380bffc81f1921e12778
parent 350656 e840f66358c4f4145bde6be5c67773d35f76b46d
child 350658 ed4dbff3f5118dcfe45a5e9739269d753ded8f08
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer, test-only
bugs1277750, 734076
milestone50.0
Bug 1277750, fix intermittent bug734076.js test failure on linux64 e10s by forcing a size onto the <img> element loading an invalid URI, r=mikedeboer, a=test-only In the failing case, the context menu is basically appearing over <body> instead of the image. In that case we don't show the 'view image' option and don't have a URL to use to open the image, which means we try and do a security check for the load of '', which fails, and we don't get a new load on which to run the rest of the test. My guess is this is happening because if the image hasn't loaded yet by the time we run the code, it takes up no space at all, and a mouse event at its coordinates only 'hits' the body. We can avoid that by givin the element width and height. MozReview-Commit-ID: kU2IoYTqeE
browser/base/content/test/general/browser_bug734076.js
--- a/browser/base/content/test/general/browser_bug734076.js
+++ b/browser/base/content/test/general/browser_bug734076.js
@@ -33,16 +33,18 @@ add_task(function* ()
     {
       name: "view image",
       url: "http://mochi.test:8888/",
       element: "img",
       go: function () {
         return ContentTask.spawn(gBrowser.selectedBrowser, { writeDomainURL: writeDomainURL }, function* (arg) {
           let doc = content.document;
           let img = doc.createElement("img");
+          img.height = 100;
+          img.width = 100;
           img.setAttribute("src", arg.writeDomainURL);
           doc.body.insertBefore(img, doc.body.firstChild);
 
           return "context-viewimage";
         });
       },
       verify: function () {
         return ContentTask.spawn(gBrowser.selectedBrowser, null, function* (arg) {
@@ -89,16 +91,18 @@ add_task(function* ()
 
     info("Run subtest " + test.name);
     let commandToRun = yield test.go();
 
     let popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown");
     yield BrowserTestUtils.synthesizeMouse(test.element, 3, 3,
           { type: "contextmenu", button: 2 }, gBrowser.selectedBrowser);
     yield popupShownPromise;
+    info("onImage: " + gContextMenu.onImage);
+    info("target: " + gContextMenu.target.tagName);
 
     let loadedAfterCommandPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
     document.getElementById(commandToRun).click();
     yield loadedAfterCommandPromise;
 
     yield test.verify();
 
     let popupHiddenPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popuphidden");