Backed out changeset 68aec891cd2e (bug 1557386) for test_beaconFrame.html failures CLOSED TREE
authorBogdan Tara <btara@mozilla.com>
Thu, 21 May 2020 20:46:37 +0300
changeset 531462 5424bea51e22f7d52e81869e6d124227b11e743d
parent 531461 fcd7cb8b4cdf9a5ff99df84739f7dc8b3c238a44
child 531463 9194f91b1fa27b48b18317ab806afdcc6c9dc9a3
push id37439
push userbtara@mozilla.com
push dateThu, 21 May 2020 21:49:34 +0000
treeherdermozilla-central@92c11f0bf14b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1557386
milestone78.0a1
backs out68aec891cd2e3d32372c8fde04841a64f3ce2365
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
Backed out changeset 68aec891cd2e (bug 1557386) for test_beaconFrame.html failures CLOSED TREE
dom/tests/mochitest/beacon/beacon-handler.sjs
dom/tests/mochitest/beacon/chrome.ini
dom/tests/mochitest/beacon/file_beaconSafelist.html
dom/tests/mochitest/beacon/test_beaconWithSafelistedContentType.html
--- a/dom/tests/mochitest/beacon/beacon-handler.sjs
+++ b/dom/tests/mochitest/beacon/beacon-handler.sjs
@@ -50,23 +50,16 @@ function handleRequest(request, response
     setOurState(null);
   }
 
   if (request.method == "GET") {
     DEBUG(" ------------ GET --------------- ");
     response.setHeader("Content-Type", "application/json", false);
     switch (request.queryString) {
     case "getLastBeacon":
-      // Allow CORS responses of the last beacon
-      var originHeader = request.getHeader("origin");
-      response.setHeader("Access-Control-Allow-Headers", "content-type", false);
-      response.setHeader("Access-Control-Allow-Methods", "POST, GET", false);
-      response.setHeader("Access-Control-Allow-Origin", originHeader, false);
-      response.setHeader("Access-Control-Allow-Credentials", "true", false);
-
       var state = getOurState();
       if (state === "unblocked") {
         finishControlResponse(response);
       } else {
         DEBUG("GET has  arrived, but POST has not, blocking response!");
         setOurState(response);
         response.processAsync();
       }
--- a/dom/tests/mochitest/beacon/chrome.ini
+++ b/dom/tests/mochitest/beacon/chrome.ini
@@ -1,10 +1,7 @@
 [DEFAULT]
 skip-if = os == 'android'
 
 [test_beaconCookies.html]
 skip-if = (verify && !debug && (os == 'win'))
 support-files = beacon-set-cookie.sjs
                 file_beaconCookies.html
-[test_beaconWithSafelistedContentType.html]
-support-files = beacon-handler.sjs
-                file_beaconSafelist.html
deleted file mode 100644
--- a/dom/tests/mochitest/beacon/file_beaconSafelist.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE HTML>
-<script class="testbody" type="text/javascript">
-
-var beaconUrl = "http://example.com/tests/dom/tests/mochitest/beacon/beacon-handler.sjs?beacon";
-
-var value = ["text"];
-var blob = new Blob(value, {type: "application/x-www-form-urlencoded"});
-navigator.sendBeacon(beaconUrl, blob);
-var intervalID = null;
-
-</script>
deleted file mode 100644
--- a/dom/tests/mochitest/beacon/test_beaconWithSafelistedContentType.html
+++ /dev/null
@@ -1,103 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1557386
--->
-<head>
-  <title>Test for Bug 1557386</title>
-  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1557386">Mozilla Bug 1557386</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-  
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-// not enabled by default yet.
-SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({'set': [["beacon.enabled", true]]}, beginTest);
-
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const {BrowserTestUtils} = ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
-const { clearInterval, setInterval } = ChromeUtils.import(
-  "resource://gre/modules/Timer.jsm"
-);
-
-function whenDelayedStartupFinished(aWindow, aCallback) {
-  Services.obs.addObserver(function observer(aSubject, aTopic) {
-    if (aWindow == aSubject) {
-      Services.obs.removeObserver(observer, aTopic);
-      setTimeout(aCallback, 0);
-    }
-  }, "browser-delayed-startup-finished");
-}
-
-let baseURL = "http://mochi.test:8888/chrome/dom/tests/mochitest/beacon/";
-let windowsToClose = [];
-let listener = msg => {
-  if (!(msg instanceof Ci.nsIConsoleMessage)) {
-    return;
-  }
-  if (msg.message.match("Cross-Origin Request Blocked:")) {
-    ok(false, "CORS response console warning found");
-  }
-};
-
-function beginTest() {
-  Services.console.registerListener(listener);
-
-  let mainWindow = window.docShell.rootTreeItem.domWindow;
-
-  let win = mainWindow.OpenBrowserWindow({});
-  windowsToClose.push(win);
-  whenDelayedStartupFinished(win, async function() {
-    Services.obs.addObserver(function waitCookie() {
-      Services.obs.removeObserver(waitCookie, "cookie-changed");
-      ok(true, "cookie set by beacon request in normal window");
-      testOnPrivateWindow();
-    }, "cookie-changed");
-    let testURL = baseURL + "file_beaconSafelist.html";
-    await BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, testURL);
-    await BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser, false, testURL);
-    await SpecialPowers.spawn(win.gBrowser.selectedBrowser, [], async () => {
-      await new Promise((resolve, reject) => {
-        let intervalId;
-        function queryIfBeaconSucceeded() {
-          content.clearInterval(intervalId);
-          let xhr = new content.XMLHttpRequest();
-          let baseURL = "http://example.com/tests/dom/tests/mochitest/beacon/";
-          let checkUrl = baseURL + "beacon-handler.sjs?getLastBeacon";
-          xhr.open("GET", checkUrl, true);
-          xhr.onload = function() {
-            let res = JSON.parse(xhr.responseText);
-            is(res.data, "text", "Got correct data");
-            resolve();
-          };
-          xhr.onerror = function() {
-            ok(false, "Error getting last beacon");
-            reject();
-          };
-          xhr.send();
-        }
-        intervalID = content.setInterval(queryIfBeaconSucceeded, 2000);
-      });
-    });
-    cleanup();
-  });
-}
-
-function cleanup() {
-  Services.console.unregisterListener(listener);
-  for (let i = 0; i < windowsToClose.length; ++i) {
-    windowsToClose[i].close();
-  }
-  SimpleTest.finish();
-}
-
-</script>
-</pre>
-</body>
-</html>