Bug 1547489 - Make sure to target something inside the cross-origin iframe in browser_bug734076.js. r=mconley
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 06 May 2019 19:02:40 +0000
changeset 531580 49c8a6dac9bed384b3913bd8a19cf68113bc64a2
parent 531579 c386ebfd9c6bdcf77162391848b32f143561b67f
child 531581 c4a8d8d5cb2a01f45c3851578233197d4784b3f0
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1547489, 734076
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1547489 - Make sure to target something inside the cross-origin iframe in browser_bug734076.js. r=mconley This test is already somewhat racy. At least locally, I could see the background-image test fail sometimes in chaos mode. This is because we don't wait for the background-image to load. But that's a different bug in any case. Anyway, this failure happens because we're sending an event to the <iframe>, but the context menu code expects the target of the event to be a node inside the cross-origin iframe, in order for this check to work: https://searchfox.org/mozilla-central/rev/b4e790d05f5a146d186c238bac5601a553581d23/browser/actors/ContextMenuChild.jsm#1036 Since <iframe> is cross-origin, stuff in it may not have been laid out yet. This will also be a problem with fission, afaict, where that check wouldn't even be possible, I think. If stuff there hasn't been laid out, the thing getting the event (the contextmenu's target) is the <iframe>, rather than the content document's target. Make sure to target content under the subframe for now. This change is a bit subtle, in the sense that what ensures stuff is getting laid out after this change is the getBoundingClientRect() calls in: https://searchfox.org/mozilla-central/rev/b4e790d05f5a146d186c238bac5601a553581d23/testing/mochitest/tests/SimpleTest/AsyncUtilsContent.js#75 However we rely on those all over the place already (even before my change), so I think this is the easiest / better test fix for now. With Fission we'll probably need to change how those context-menu checks work so that they work when targeting the <iframe> or forward to the nested child process or something. Differential Revision: https://phabricator.services.mozilla.com/D29943
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
@@ -56,17 +56,17 @@ add_task(async function() {
           Assert.ok(!content.document.body.textContent,
             "no domain was inherited for view image");
         });
       },
     },
     {
       name: "show only this frame",
       url: "http://mochi.test:8888/",
-      element: "iframe",
+      element: ["iframe", "html"],
       go() {
         return ContentTask.spawn(gBrowser.selectedBrowser, { writeDomainURL }, async function(arg) {
           let doc = content.document;
           let iframe = doc.createElement("iframe");
           iframe.setAttribute("src", arg.writeDomainURL);
           doc.body.insertBefore(iframe, doc.body.firstElementChild);
 
           // Wait for the iframe to load.