Bug 1397655 - Update tests within dom/ to comply with new toplevel data: URI navigation policy. r=smaug
authorChristoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Sun, 10 Sep 2017 13:24:07 +0200
changeset 429458 697d93c85b773258b762224cd30d9bcb2cb6d8fd
parent 429457 5d74712bb1627824ef2abbc8fc4a5e28352e5f42
child 429459 a5f163da8a9be5d2e86138c57d59be69723b5457
child 429499 74a3b5e1f809a93f69e79dc5e90df7c735c21682
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1397655
milestone57.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 1397655 - Update tests within dom/ to comply with new toplevel data: URI navigation policy. r=smaug
dom/base/test/browser.ini
dom/base/test/file_bug1303838.html
dom/base/test/file_bug1303838_target_bar.html
dom/base/test/file_bug1303838_target_baz.html
dom/base/test/file_bug1303838_target_foo.html
dom/base/test/file_bug1303838_target_ibar.html
dom/base/test/file_bug1303838_target_ibaz.html
dom/base/test/file_bug1303838_target_ifoo.html
dom/base/test/test_data_uri.html
dom/base/test/test_x-frame-options.html
dom/file/tests/file_ipc_messagemanager_blob.html
dom/file/tests/mochitest.ini
dom/file/tests/test_ipc_messagemanager_blob.html
dom/html/test/test_fullscreen-api-race.html
dom/ipc/tests/file_cpow_cookies.html
dom/ipc/tests/mochitest.ini
dom/ipc/tests/test_cpow_cookies.html
dom/plugins/test/mochitest/test_pluginstream_err.html
--- a/dom/base/test/browser.ini
+++ b/dom/base/test/browser.ini
@@ -7,16 +7,22 @@ support-files =
   file_audioLoopInIframe.html
   file_blocking_image.html
   file_bug902350.html
   file_bug902350_frame.html
   file_bug1011748_redirect.sjs
   file_bug1011748_OK.sjs
   file_bug1303838.html
   file_bug1303838_target.html
+  file_bug1303838_target_foo.html
+  file_bug1303838_target_bar.html
+  file_bug1303838_target_baz.html
+  file_bug1303838_target_ifoo.html
+  file_bug1303838_target_ibar.html
+  file_bug1303838_target_ibaz.html
   file_bug1303838_with_iframe.html
   file_messagemanager_unload.html
   file_pluginAudio.html
   file_use_counter_outer.html
   file_use_counter_svg_getElementById.svg
   file_use_counter_svg_currentScale.svg
   file_use_counter_svg_fill_pattern_definition.svg
   file_use_counter_svg_fill_pattern.svg
--- a/dom/base/test/file_bug1303838.html
+++ b/dom/base/test/file_bug1303838.html
@@ -3,20 +3,20 @@
 <!--
 Tests for tab switching on link clicks.
 -->
 <head>
   <meta charset="utf-8">
   <title>Tests for tab switching on link clicks.</title>
 </head>
 <body>
-  <a id="link-1" target="testTab" href="data:text/html;charset=utf-8,foo">Link 1</a><br>
-  <a id="link-2" target="testTab" href="data:text/html;charset=utf-8,bar">Link 2</a><br>
-  <a id="link-3" target="testTab" href="data:text/html;charset=utf-8,baz">Link 3</a><br>
+  <a id="link-1" target="testTab" href="file_bug1303838_target_foo.html">Link 1</a><br>
+  <a id="link-2" target="testTab" href="file_bug1303838_target_bar.html">Link 2</a><br>
+  <a id="link-3" target="testTab" href="file_bug1303838_target_baz.html">Link 3</a><br>
   <a id="link-4" target="testTab" href="file_bug1303838_target.html">Link 4</a><br>
   <a id="anchor-link-1" target="testTab" href="file_bug1303838_target.html#foo">Anchor Link 1</a><br>
   <a id="anchor-link-2" target="testTab" href="file_bug1303838_target.html#bar">Anchor Link 2</a><br>
   <a id="anchor-link-3" target="testTab" href="file_bug1303838_target.html#baz">Anchor Link 3</a><br>
-  <a id="frame-link-1" target="testFrame" href="data:text/html;charset=utf-8,ifoo">Frame Link 1</a><br>
-  <a id="frame-link-2" target="testFrame" href="data:text/html;charset=utf-8,ibar">Frame Link 2</a><br>
-  <a id="frame-link-3" target="testFrame" href="data:text/html;charset=utf-8,ibaz">Frame Link 3</a><br>
+  <a id="frame-link-1" target="testFrame" href="file_bug1303838_target_ifoo.html">Frame Link 1</a><br>
+  <a id="frame-link-2" target="testFrame" href="file_bug1303838_target_ibar.html">Frame Link 2</a><br>
+  <a id="frame-link-3" target="testFrame" href="file_bug1303838_target_ibaz.html">Frame Link 3</a><br>
 </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/dom/base/test/file_bug1303838_target_bar.html
@@ -0,0 +1,1 @@
+<html><body>bar</body></html>
new file mode 100644
--- /dev/null
+++ b/dom/base/test/file_bug1303838_target_baz.html
@@ -0,0 +1,1 @@
+<html><body>baz</body></html>
new file mode 100644
--- /dev/null
+++ b/dom/base/test/file_bug1303838_target_foo.html
@@ -0,0 +1,1 @@
+<html><body>foo</body></html>
new file mode 100644
--- /dev/null
+++ b/dom/base/test/file_bug1303838_target_ibar.html
@@ -0,0 +1,1 @@
+<html><body>ibar</body></html>
new file mode 100644
--- /dev/null
+++ b/dom/base/test/file_bug1303838_target_ibaz.html
@@ -0,0 +1,1 @@
+<html><body>ibaz</body></html>
new file mode 100644
--- /dev/null
+++ b/dom/base/test/file_bug1303838_target_ifoo.html
@@ -0,0 +1,1 @@
+<html><body>ifoo</body></html>
--- a/dom/base/test/test_data_uri.html
+++ b/dom/base/test/test_data_uri.html
@@ -10,18 +10,20 @@
       src: url(data:font/opentype;base64,AAEAAAANAIAAAwBQRkZUTU6u6MkAAAXcAAAAHE9TLzJWYWQKAAABWAAAAFZjbWFwAA8D7wAAAcAAAAFCY3Z0IAAhAnkAAAMEAAAABGdhc3D//wADAAAF1AAAAAhnbHlmCC6aTwAAAxQAAACMaGVhZO8ooBcAAADcAAAANmhoZWEIkAV9AAABFAAAACRobXR4EZQAhQAAAbAAAAAQbG9jYQBwAFQAAAMIAAAACm1heHAASQA9AAABOAAAACBuYW1lehAVOgAAA6AAAAIHcG9zdP+uADUAAAWoAAAAKgABAAAAAQAAMhPyuV8PPPUACwPoAAAAAMU4Lm0AAAAAxTgubQAh/5wFeAK8AAAACAACAAAAAAAAAAEAAAK8/5wAWgXcAAAAAAV4AAEAA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GgAdAAgACgAYwApACAAMgAwADAAOAAgAE0AbwB6AGkAbABsAGEAIABDAG8AcgBwAG8AcgBhAHQAaQBvAG4AAENvcHlyaWdodCAoYykgMjAwOCBNb3ppbGxhIENvcnBvcmF0aW9uAABNAGEAcgBrAEEAAE1hcmtBAABNAGUAZABpAHUAbQAATWVkaXVtAABGAG8AbgB0AEYAbwByAGcAZQAgADIALgAwACAAOgAgAE0AYQByAGsAQQAgADoAIAA1AC0AMQAxAC0AMgAwADAAOAAARm9udEZvcmdlIDIuMCA6IE1hcmtBIDogNS0xMS0yMDA4AABNAGEAcgBrAEEAAE1hcmtBAABWAGUAcgBzAGkAbwBuACAAMAAwADEALgAwADAAMAAgAABWZXJzaW9uIDAwMS4wMDAgAABNAGEAcgBrAEEAAE1hcmtBAAAAAgAAAAAAAP+DADIAAAABAAAAAAAAAAAAAAAAAAAAAAAEAAAAAQACACQAAAAAAAH//wACAAAAAQAAAADEPovuAAAAAMU4Lm0AAAAAxTgubQ==);
     }
   </style>
 
 <script>
 SimpleTest.waitForExplicitFinish();
 
 SpecialPowers.setBoolPref("security.data_uri.unique_opaque_origin", true);
+SpecialPowers.setBoolPref("security.data_uri.block_toplevel_data_uri_navigations", false);
 SimpleTest.registerCleanupFunction(() => {
   SpecialPowers.clearUserPref("security.data_uri.unique_opaque_origin");
+  SpecialPowers.clearUserPref("security.data_uri.block_toplevel_data_uri_navigations");
 });
 
 function imgListener(img) {
   return new Promise((resolve, reject) => {
     img.addEventListener("load", () => resolve());
     img.addEventListener("error", () => reject());
   });
 }
--- a/dom/base/test/test_x-frame-options.html
+++ b/dom/base/test/test_x-frame-options.html
@@ -170,15 +170,19 @@ var testFrameNotLoadedInDataURI = functi
     SimpleTest.finish();
   };
   win.location.href = "data:text/html,"+html;
 };
 
 SimpleTest.waitForExplicitFinish();
 
 // load the test harness
-document.getElementById("harness").src = "file_x-frame-options_main.html";
+SpecialPowers.pushPrefEnv({
+  "set": [["security.data_uri.block_toplevel_data_uri_navigations", false],]
+}, function() {
+  document.getElementById("harness").src = "file_x-frame-options_main.html";
+});
 
 </script>
 </pre>
 
 </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/dom/file/tests/file_ipc_messagemanager_blob.html
@@ -0,0 +1,1 @@
+<!DOCTYPE HTML><html><body></body></html>
--- a/dom/file/tests/mochitest.ini
+++ b/dom/file/tests/mochitest.ini
@@ -13,15 +13,16 @@ support-files =
   !/dom/html/test/form_submit_server.sjs
   !/dom/xhr/tests/file_XHRSendData.sjs
 
 [test_blob_fragment_and_query.html]
 [test_blobconstructor.html]
 [test_blobURL_expiring.html]
 [test_file_from_blob.html]
 [test_ipc_messagemanager_blob.html]
+support-files = file_ipc_messagemanager_blob.html
 [test_nonascii_blob_url.html]
 [test_file_negative_date.html]
 [test_fileapi.html]
 [test_fileapi_slice.html]
 skip-if = (toolkit == 'android') # Android: Bug 775227
 [test_mozfiledataurl.html]
 skip-if = toolkit == 'android' #TIMED_OUT
--- a/dom/file/tests/test_ipc_messagemanager_blob.html
+++ b/dom/file/tests/test_ipc_messagemanager_blob.html
@@ -9,18 +9,17 @@
 </head>
 <body>
 
   <script type="application/javascript">
     "use strict";
 
     SimpleTest.waitForExplicitFinish();
 
-    const childFrameURL =
-      "data:text/html,<!DOCTYPE HTML><html><body></body></html>";
+    const childFrameURL = "file_ipc_messagemanager_blob.html";
 
     function childFrameScript() {
       "use strict";
 
       addMessageListener("test:ipcClonedMessage", function(message) {
         if (!(message.json instanceof Components.interfaces.nsIDOMBlob)) {
           sendAsyncMessage(message.name, message.json);
           return;
--- a/dom/html/test/test_fullscreen-api-race.html
+++ b/dom/html/test/test_fullscreen-api-race.html
@@ -32,17 +32,18 @@ SimpleTest.waitForExplicitFinish();
 SimpleTest.requestFlakyTimeout(
   "Need to wait for potential fullscreen transition");
 addLoadEvent(function () {
   SpecialPowers.pushPrefEnv({
     "set": [
       ["full-screen-api.unprefix.enabled", true],
       ["full-screen-api.allow-trusted-requests-only", false],
       // Use legacy data: URI behavior to run test.
-      ["security.data_uri.unique_opaque_origin", false]
+      ["security.data_uri.unique_opaque_origin", false],
+      ["security.data_uri.block_toplevel_data_uri_navigations", false],
     ]
   }, next);
 });
 
 const OPEN_WINDOW_FUNCS = [
   function openNewTab() {
     return window.open("about:blank");
   },
new file mode 100644
--- /dev/null
+++ b/dom/ipc/tests/file_cpow_cookies.html
@@ -0,0 +1,1 @@
+<!DOCTYPE HTML><html><body></body></html>
--- a/dom/ipc/tests/mochitest.ini
+++ b/dom/ipc/tests/mochitest.ini
@@ -7,16 +7,17 @@ support-files =
 skip-if = e10s
 [test_blob_sliced_from_parent_process.html]
 # This test is only supposed to run in the main process.
 skip-if = e10s
 [test_bug1086684.html]
 # This test is only supposed to run in the main process
 skip-if = e10s || toolkit == 'android'
 [test_cpow_cookies.html]
+support-files = file_cpow_cookies.html
 [test_child_docshell.html]
 skip-if = toolkit == 'cocoa' # disabled due to hangs, see changeset 6852e7c47edf
 [test_CrashService_crash.html]
 skip-if = !(crashreporter && !e10s && (toolkit == 'gtk2' || toolkit == 'gtk3' || toolkit == 'cocoa' || toolkit == 'windows'))
 [test_temporaryfile_stream.html]
 skip-if = !e10s
 support-files =
   blob_verify.sjs
--- a/dom/ipc/tests/test_cpow_cookies.html
+++ b/dom/ipc/tests/test_cpow_cookies.html
@@ -9,18 +9,17 @@
 </head>
 <body>
 
   <script type="application/javascript">
     "use strict";
 
     SimpleTest.waitForExplicitFinish();
 
-    const childFrameURL =
-      "data:text/html,<!DOCTYPE HTML><html><body></body></html>";
+    const childFrameURL = "file_cpow_cookies.html";
 
     function childFrameScript() {
       "use strict";
 
       const Ci = Components.interfaces;
 
       function test1(message) {
         // NB: This is a no-op because we're a data: document with a null
--- a/dom/plugins/test/mochitest/test_pluginstream_err.html
+++ b/dom/plugins/test/mochitest/test_pluginstream_err.html
@@ -8,17 +8,17 @@ Tests for plugin stream error conditions
 <head>
   <title>NPAPI Stream Error Tests</title>
   <script type="text/javascript" 
           src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="plugin-utils.js"></script>
   <link rel="stylesheet" type="text/css" 
         href="/tests/SimpleTest/test.css" />
 </head>
-<body onload="runNextTest()">
+<body onload="startTests()">
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=517078">
   Mozilla Bug 517078</a> - Plugin Stream Error Tests
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
 <div id="test">
 <script class="testbody" type="text/javascript">
@@ -156,13 +156,19 @@ function continueTest() {
   gTestWindow.document.getElementById("test").appendChild(plugin);
 
   gTestWindow.document.getElementById("test")
                       .appendChild(document.createElement("br"));
 
   index++;
 }
 
+function startTests() {
+  SpecialPowers.pushPrefEnv({"set": [
+    ["security.data_uri.block_toplevel_data_uri_navigations", false],
+  ]}, runNextTest);
+}
+
 </script>
 </div>
 </body>
 </html>