Bug 1292299 - Refactor the test cases from bug 704320. r=jdm
☠☠ backed out by 394f02edb7cb ☠ ☠
authorHoratiu <horatiulazu@gmail.com>
Thu, 11 Aug 2016 08:45:48 -0400
changeset 312799 94bf7c3ec5aa4a51eb69774cead8ef0313c6fa35
parent 312798 0f431005c078af72bb30cfea04a362aca97b8868
child 312800 d7d0c8ff20f1300a8b9dcadb39e6db0f297f6c5a
push id30658
push usercbook@mozilla.com
push dateTue, 06 Sep 2016 13:28:59 +0000
treeherdermozilla-central@bec2b7e3c0eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs1292299, 704320
milestone51.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 1292299 - Refactor the test cases from bug 704320. r=jdm
dom/base/test/mochitest.ini
dom/base/test/test_bug704320.html
dom/base/test/test_bug704320_http_http.html
dom/base/test/test_bug704320_http_https.html
dom/base/test/test_bug704320_https_http.html
dom/base/test/test_bug704320_https_https.html
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -538,21 +538,17 @@ skip-if = buildapp == 'b2g'
 [test_bug693615.html]
 [test_bug693875.html]
 [test_bug694754.xhtml]
 [test_bug696301-1.html]
 [test_bug696301-2.html]
 [test_bug698381.html]
 [test_bug698384.html]
 [test_bug704063.html]
-[test_bug704320_http_http.html]
-[test_bug704320_http_https.html]
-[test_bug704320_https_http.html]
-skip-if = buildapp == 'b2g'  # b2g (https://example.com not working bug 1162353)
-[test_bug704320_https_https.html]
+[test_bug704320.html]
 skip-if = buildapp == 'b2g'  # b2g (https://example.com not working bug 1162353)
 [test_bug704320_policyset.html]
 [test_bug704320_policyset2.html]
 [test_bug704320_preload.html]
 [test_bug707142.html]
 [test_bug708620.html]
 [test_bug711047.html]
 [test_bug711180.html]
new file mode 100644
--- /dev/null
+++ b/dom/base/test/test_bug704320.html
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=704320
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 704320</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="referrerHelper.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+
+<script type="application/javascript;version=1.7">
+
+//generates URLs to test
+var generateURLArray = (function(from, to){
+  const baseURL = '://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=';
+  const schemeTo = '&scheme-to=';
+
+  return [
+    from + baseURL + from + schemeTo + to + '&policy=no-referrer-when-downgrade',
+    from + baseURL + from + schemeTo + to + '&policy=no-referrer',
+    from + baseURL + from + schemeTo + to + '&policy=unsafe-url',
+    from + baseURL + from + schemeTo + to + '&policy=origin',
+    from + baseURL + from + schemeTo + to + '&policy=origin-when-cross-origin',
+  ];
+});
+
+var testIframeUrls = generateURLArray('http', 'http');
+testIframeUrls = testIframeUrls.concat(generateURLArray('https', 'https'));
+testIframeUrls = testIframeUrls.concat(generateURLArray('http', 'https'));
+testIframeUrls = testIframeUrls.concat(generateURLArray('https', 'http'));
+
+SimpleTest.waitForExplicitFinish();
+var advance = function() { tests.next(); };
+
+/**
+ * This is the main test routine -- serialized by use of a generator.
+ * It performs all tests in sequence using in the same iframe.
+ */
+var tests = (function() {
+  var iframe = document.getElementById("testframe");
+  iframe.onload = function() {
+     advance();
+  }
+
+  // load the test frame from testIframeUrls[url]
+  // it will call back into this function via postMessage when it finishes loading.
+  // and continue beyond the yield.
+  for(url in testIframeUrls) {
+    yield iframe.src = testIframeUrls[url];
+    // run test and check result for loaded test URL
+    yield checkExpectedGlobalResults();
+  }
+
+  // complete.  Be sure to yield so we don't call this twice.
+  yield SimpleTest.finish();
+})();
+
+</script>
+</head>
+
+<body onload="tests.next();">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=704320">Mozilla Bug 704320 - HTTP/HTTPS to HTTPS/HTTP</a>
+<p id="display"></p>
+<pre id="content">
+</pre>
+  <iframe id="testframe"></iframe>
+
+</body>
+</html>
\ No newline at end of file
deleted file mode 100644
--- a/dom/base/test/test_bug704320_http_http.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=704320
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 704320 - HTTP to HTTP</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="referrerHelper.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-
-<script type="application/javascript;version=1.7">
-
-var testIframeUrls = [
-  // HTTP to HTTP
-  'http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=http&policy=no-referrer-when-downgrade',
-  'http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=http&policy=no-referrer',
-  'http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=http&policy=unsafe-url',
-  'http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=http&policy=origin',
-  'http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=http&policy=origin-when-cross-origin',
-];
-
-SimpleTest.waitForExplicitFinish();
-var advance = function() { tests.next(); };
-
-/**
- * This is the main test routine -- serialized by use of a generator.
- * It performs all tests in sequence using in the same iframe.
- */
-var tests = (function() {
-  var iframe = document.getElementById("testframe");
-  iframe.onload = function() {
-     advance();
-  }
-
-  // load the test frame from testIframeUrls[url]
-  // it will call back into this function via postMessage when it finishes loading.
-  // and continue beyond the yield.
-  for(url in testIframeUrls) {
-    yield iframe.src = testIframeUrls[url];
-    // run test and check result for loaded test URL
-    yield checkExpectedGlobalResults();
-  }
-
-  // complete.  Be sure to yield so we don't call this twice.
-  yield SimpleTest.finish();
-})();
-
-</script>
-</head>
-
-<body onload="tests.next();">
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=704320">Mozilla Bug 704320 - HTTP to HTTP</a>
-<p id="display"></p>
-<pre id="content">
-</pre>
-  <iframe id="testframe"></iframe>
-
-</body>
-</html>
-
deleted file mode 100644
--- a/dom/base/test/test_bug704320_http_https.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=704320
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 704320 - HTTP to HTTPS</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="referrerHelper.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-
-<script type="application/javascript;version=1.7">
-
-var testIframeUrls = [
-  // HTTP to HTTPS
-  'http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=https&policy=no-referrer-when-downgrade',
-  'http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=https&policy=no-referrer',
-  'http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=https&policy=unsafe-url',
-  'http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=https&policy=origin',
-  'http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=https&policy=origin-when-cross-origin',
-];
-
-SimpleTest.waitForExplicitFinish();
-var advance = function() { tests.next(); };
-
-/**
- * This is the main test routine -- serialized by use of a generator.
- * It performs all tests in sequence using in the same iframe.
- */
-var tests = (function() {
-  var iframe = document.getElementById("testframe");
-  iframe.onload = function() {
-     advance();
-  }
-
-  // load the test frame from testIframeUrls[url]
-  // it will call back into this function via postMessage when it finishes loading.
-  // and continue beyond the yield.
-  for(url in testIframeUrls) {
-    yield iframe.src = testIframeUrls[url];
-    // run test and check result for loaded test URL
-    yield checkExpectedGlobalResults();
-  }
-
-  // complete.  Be sure to yield so we don't call this twice.
-  yield SimpleTest.finish();
-})();
-
-</script>
-</head>
-
-<body onload="tests.next();">
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=704320">Mozilla Bug 704320 - HTTP to HTTPS</a>
-<p id="display"></p>
-<pre id="content">
-</pre>
-  <iframe id="testframe"></iframe>
-
-</body>
-</html>
-
deleted file mode 100644
--- a/dom/base/test/test_bug704320_https_http.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=704320
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 704320 - HTTPS to HTTP</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="referrerHelper.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-
-<script type="application/javascript;version=1.7">
-
-var testIframeUrls = [
-  // HTTPS to HTTP
-  'https://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=https&scheme-to=http&policy=no-referrer-when-downgrade',
-  'https://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=https&scheme-to=http&policy=no-referrer',
-  'https://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=https&scheme-to=http&policy=unsafe-url',
-  'https://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=https&scheme-to=http&policy=origin',
-  'https://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=https&scheme-to=http&policy=origin-when-cross-origin',
-];
-
-SimpleTest.waitForExplicitFinish();
-var advance = function() { tests.next(); };
-
-/**
- * This is the main test routine -- serialized by use of a generator.
- * It performs all tests in sequence using in the same iframe.
- */
-var tests = (function() {
-  var iframe = document.getElementById("testframe");
-  iframe.onload = function() {
-     advance();
-  }
-
-  // load the test frame from testIframeUrls[url]
-  // it will call back into this function via postMessage when it finishes loading.
-  // and continue beyond the yield.
-  for(url in testIframeUrls) {
-    yield iframe.src = testIframeUrls[url];
-    // run test and check result for loaded test URL
-    yield checkExpectedGlobalResults();
-  }
-
-  // complete.  Be sure to yield so we don't call this twice.
-  yield SimpleTest.finish();
-})();
-
-</script>
-</head>
-
-<body onload="tests.next();">
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=704320">Mozilla Bug 704320 - HTTPS to HTTP</a>
-<p id="display"></p>
-<pre id="content">
-</pre>
-  <iframe id="testframe"></iframe>
-
-</body>
-</html>
-
deleted file mode 100644
--- a/dom/base/test/test_bug704320_https_https.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=704320
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 704320 - HTTPS to HTTPS</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="referrerHelper.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-
-<script type="application/javascript;version=1.7">
-
-var testIframeUrls = [
-  // HTTPS to HTTPS
-  'https://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=https&scheme-to=https&policy=no-referrer-when-downgrade',
-  'https://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=https&scheme-to=https&policy=no-referrer',
-  'https://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=https&scheme-to=https&policy=unsafe-url',
-  'https://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=https&scheme-to=https&policy=origin',
-  'https://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=https&scheme-to=https&policy=origin-when-cross-origin'
-];
-
-SimpleTest.waitForExplicitFinish();
-var advance = function() { tests.next(); };
-
-/**
- * This is the main test routine -- serialized by use of a generator.
- * It performs all tests in sequence using in the same iframe.
- */
-var tests = (function() {
-  var iframe = document.getElementById("testframe");
-  iframe.onload = function() {
-     advance();
-  }
-
-  // load the test frame from testIframeUrls[url]
-  // it will call back into this function via postMessage when it finishes loading.
-  // and continue beyond the yield.
-  for(url in testIframeUrls) {
-    yield iframe.src = testIframeUrls[url];
-    // run test and check result for loaded test URL
-    yield checkExpectedGlobalResults();
-  }
-
-  // complete.  Be sure to yield so we don't call this twice.
-  yield SimpleTest.finish();
-})();
-
-</script>
-</head>
-
-<body onload="tests.next();">
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=704320">Mozilla Bug 704320 - HTTPS to HTTPS</a>
-<p id="display"></p>
-<pre id="content">
-</pre>
-  <iframe id="testframe"></iframe>
-
-</body>
-</html>
-