diff options
63 files changed, 157 insertions, 83 deletions
diff --git a/devtools/client/inspector/markup/test/browser.ini b/devtools/client/inspector/markup/test/browser.ini index 3116e4beb1..9ff73a6c69 100644 --- a/devtools/client/inspector/markup/test/browser.ini +++ b/devtools/client/inspector/markup/test/browser.ini @@ -32,6 +32,8 @@ support-files = doc_markup_void_elements.xhtml doc_markup_whitespace.html doc_markup_xul.xul + doc_markup_update-on-navigtion_1.html + doc_markup_update-on-navigtion_2.html head.js helper_attributes_test_runner.js helper_events_test_runner.js diff --git a/devtools/client/inspector/markup/test/browser_markup_update-on-navigtion.js b/devtools/client/inspector/markup/test/browser_markup_update-on-navigtion.js index 241cea6723..c298878c32 100644 --- a/devtools/client/inspector/markup/test/browser_markup_update-on-navigtion.js +++ b/devtools/client/inspector/markup/test/browser_markup_update-on-navigtion.js @@ -5,9 +5,8 @@ // Test that markup view handles page navigation correctly. -const SCHEMA = "data:text/html;charset=UTF-8,"; -const URL_1 = SCHEMA + "<div id='one' style='color:red;'>ONE</div>"; -const URL_2 = SCHEMA + "<div id='two' style='color:green;'>TWO</div>"; +const URL_1 = URL_ROOT + "doc_markup_update-on-navigtion_1.html"; +const URL_2 = URL_ROOT + "doc_markup_update-on-navigtion_2.html"; add_task(function* () { let {inspector, testActor} = yield openInspectorForURL(URL_1); diff --git a/devtools/client/inspector/markup/test/doc_markup_update-on-navigtion_1.html b/devtools/client/inspector/markup/test/doc_markup_update-on-navigtion_1.html new file mode 100644 index 0000000000..d2fdb16294 --- /dev/null +++ b/devtools/client/inspector/markup/test/doc_markup_update-on-navigtion_1.html @@ -0,0 +1 @@ +<div id='one' style='color:red;'>ONE</div> diff --git a/devtools/client/inspector/markup/test/doc_markup_update-on-navigtion_2.html b/devtools/client/inspector/markup/test/doc_markup_update-on-navigtion_2.html new file mode 100644 index 0000000000..93d84a0885 --- /dev/null +++ b/devtools/client/inspector/markup/test/doc_markup_update-on-navigtion_2.html @@ -0,0 +1 @@ +<div id='two' style='color:green;'>TWO</div> diff --git a/docshell/base/crashtests/914521.html b/docshell/base/crashtests/914521.html index 9ae18b8606..eb0a437491 100644 --- a/docshell/base/crashtests/914521.html +++ b/docshell/base/crashtests/914521.html @@ -20,6 +20,14 @@ function f() finish(); } +function init() +{ + SpecialPowers.pushPrefEnv({"set": [ + ["security.data_uri.block_toplevel_data_uri_navigations", false], + ]}, start); + +} + function start() { var html = "<script>" + f + "<\/script><body onload=f()>"; @@ -29,5 +37,5 @@ function start() </script> </head> -<body onload="start();"></body> +<body onload="init();"></body> </html> diff --git a/docshell/test/chrome/test_bug364461.xul b/docshell/test/chrome/test_bug364461.xul index 85154f9d74..9e45ce9711 100644 --- a/docshell/test/chrome/test_bug364461.xul +++ b/docshell/test/chrome/test_bug364461.xul @@ -29,9 +29,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=364461 /** Test for Bug 364461 **/ SimpleTest.waitForExplicitFinish(); -window.open("bug364461_window.xul", "bug364461", - "chrome,width=600,height=600"); +SpecialPowers.pushPrefEnv({ + "set":[["security.data_uri.block_toplevel_data_uri_navigations", false]] +}, runTests); + +function runTests() { + window.open("bug364461_window.xul", "bug364461", + "chrome,width=600,height=600"); +} ]]> </script> diff --git a/docshell/test/file_bug598895_1.html b/docshell/test/file_bug598895_1.html new file mode 100644 index 0000000000..6fbb13a020 --- /dev/null +++ b/docshell/test/file_bug598895_1.html @@ -0,0 +1 @@ +<script>window.onload = function() { opener.postMessage('loaded', '*'); }</script><body>Should show</body> diff --git a/docshell/test/file_bug598895_2.html b/docshell/test/file_bug598895_2.html new file mode 100644 index 0000000000..0822c566bb --- /dev/null +++ b/docshell/test/file_bug598895_2.html @@ -0,0 +1 @@ +<script>window.onload = function() { opener.postMessage('loaded', '*'); }</script><body></body> diff --git a/docshell/test/file_bug637644_1.html b/docshell/test/file_bug637644_1.html new file mode 100644 index 0000000000..6fbb13a020 --- /dev/null +++ b/docshell/test/file_bug637644_1.html @@ -0,0 +1 @@ +<script>window.onload = function() { opener.postMessage('loaded', '*'); }</script><body>Should show</body> diff --git a/docshell/test/file_bug637644_2.html b/docshell/test/file_bug637644_2.html new file mode 100644 index 0000000000..0822c566bb --- /dev/null +++ b/docshell/test/file_bug637644_2.html @@ -0,0 +1 @@ +<script>window.onload = function() { opener.postMessage('loaded', '*'); }</script><body></body> diff --git a/docshell/test/mochitest.ini b/docshell/test/mochitest.ini index 2298bed741..d2e3789288 100644 --- a/docshell/test/mochitest.ini +++ b/docshell/test/mochitest.ini @@ -21,9 +21,13 @@ support-files = file_bug540462.html file_bug580069_1.html file_bug580069_2.sjs + file_bug598895_1.html + file_bug598895_2.html file_bug590573_1.html file_bug590573_2.html file_bug634834.html + file_bug637644_1.html + file_bug637644_2.html file_bug640387.html file_bug653741.html file_bug660404 diff --git a/docshell/test/navigation/NavigationUtils.js b/docshell/test/navigation/NavigationUtils.js index c90ea74d5b..72bea7dded 100644 --- a/docshell/test/navigation/NavigationUtils.js +++ b/docshell/test/navigation/NavigationUtils.js @@ -9,10 +9,10 @@ /////////////////////////////////////////////////////////////////////////// var body = "This frame was navigated."; -var target_url = "data:text/html,<html><body>" + body + "</body></html>"; +var target_url = "navigation_target_url.html" var popup_body = "This is a popup"; -var target_popup_url = "data:text/html,<html><body>" + popup_body + "</body></html>"; +var target_popup_url = "navigation_target_popup_url.html"; /////////////////////////////////////////////////////////////////////////// // Functions that navigate frames @@ -58,7 +58,7 @@ function navigateByHyperlink(name) { function isNavigated(wnd, message) { var result = null; try { - result = SpecialPowers.wrap(wnd).document.body.innerHTML; + result = SpecialPowers.wrap(wnd).document.body.innerHTML.trim(); } catch(ex) { result = ex; } @@ -68,7 +68,7 @@ function isNavigated(wnd, message) { function isBlank(wnd, message) { var result = null; try { - result = wnd.document.body.innerHTML; + result = wnd.document.body.innerHTML.trim(); } catch(ex) { result = ex; } @@ -146,7 +146,9 @@ function xpcGetFramesByName(name) { function xpcCleanupWindows() { xpcEnumerateContentWindows(function(win) { - if (win.location && win.location.protocol == "data:") + if (win.location && + (win.location.href.endsWith(target_url) || + win.location.href.endsWith(target_popup_url))) { win.close(); }); } @@ -177,12 +179,12 @@ function xpcWaitForFinishedFrames(callback, numFrames) { } function searchForFinishedFrames(win) { - if ((escape(unescape(win.location)) == escape(target_url) || - escape(unescape(win.location)) == escape(target_popup_url)) && + if ((win.location.href.endsWith(target_url) || + win.location.href.endsWith(target_popup_url)) && win.document && win.document.body && - (win.document.body.textContent == body || - win.document.body.textContent == popup_body) && + (win.document.body.textContent.trim() == body || + win.document.body.textContent.trim() == popup_body) && win.document.readyState == "complete") { var util = win.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor) diff --git a/docshell/test/navigation/file_scrollRestoration.html b/docshell/test/navigation/file_scrollRestoration.html index 92e43d7fbb..766949d134 100644 --- a/docshell/test/navigation/file_scrollRestoration.html +++ b/docshell/test/navigation/file_scrollRestoration.html @@ -40,7 +40,7 @@ document.getElementById("bottom").scrollIntoView(); window.onunload = null; // Should get bfcache behavior. opener.setTimeout("testWindow.history.back();", 250); - window.location.href = 'data:text/html,'; + window.location.href = 'about:blank'; break; } case 4: { @@ -57,7 +57,7 @@ opener.is(history.scrollRestoration, "manual", "Should have the same scrollRestoration mode as before fragment navigation."); window.onunload = function() {} // Disable bfcache. opener.setTimeout("is(testWindow.history.scrollRestoration, 'auto'); testWindow.history.back();", 250); - window.location.href = 'data:text/html,'; + window.location.href = 'about:blank'; break; } case 6: { diff --git a/docshell/test/navigation/mochitest.ini b/docshell/test/navigation/mochitest.ini index 764e400a8f..1b5f33c7f5 100644 --- a/docshell/test/navigation/mochitest.ini +++ b/docshell/test/navigation/mochitest.ini @@ -1,6 +1,8 @@ [DEFAULT] support-files = NavigationUtils.js + navigation_target_url.html + navigation_target_popup_url.html blank.html file_bug462076_1.html file_bug462076_2.html diff --git a/docshell/test/navigation/navigation_target_popup_url.html b/docshell/test/navigation/navigation_target_popup_url.html new file mode 100644 index 0000000000..cfe6de009d --- /dev/null +++ b/docshell/test/navigation/navigation_target_popup_url.html @@ -0,0 +1 @@ +<html><body>This is a popup</body></html> diff --git a/docshell/test/navigation/navigation_target_url.html b/docshell/test/navigation/navigation_target_url.html new file mode 100644 index 0000000000..a485e8133f --- /dev/null +++ b/docshell/test/navigation/navigation_target_url.html @@ -0,0 +1 @@ +<html><body>This frame was navigated.</body></html> diff --git a/docshell/test/navigation/open.html b/docshell/test/navigation/open.html index 1bb70f865b..97eb9b76e1 100644 --- a/docshell/test/navigation/open.html +++ b/docshell/test/navigation/open.html @@ -3,7 +3,7 @@ <script> var target = window.location.hash.substring(1); document.write("target=" + target); -window.open("data:text/html,<html><body>This is a popup</body></html>", target, "width=10,height=10"); +window.open("navigation_target_popup_url.html", target, "width=10,height=10"); </script> </body> </html> diff --git a/docshell/test/navigation/test_triggeringprincipal_window_open.html b/docshell/test/navigation/test_triggeringprincipal_window_open.html index d5d7f210be..dbee217775 100644 --- a/docshell/test/navigation/test_triggeringprincipal_window_open.html +++ b/docshell/test/navigation/test_triggeringprincipal_window_open.html @@ -13,8 +13,7 @@ /* We call window.open() using different URIs and make sure the triggeringPrincipal * loadingPrincipal are correct. * Test1: window.open(http:) - * Test2: window.open(data:) - * Test3: window.open(javascript:) + * Test2: window.open(javascript:) */ const TRIGGERING_PRINCIPAL_URI = @@ -22,7 +21,7 @@ const TRIGGERING_PRINCIPAL_URI = SimpleTest.waitForExplicitFinish(); -const NUM_TESTS = 3; +const NUM_TESTS = 2; var test_counter = 0; function checkFinish() { @@ -54,28 +53,7 @@ httpWin.onload = function() { } // ---------------------------------------------------------------------------- -// Test 2: window.open(data:) -var dataWin = window.open("data:text/html,<html><body>data</body></html>", "_blank", "width=10,height=10"); -dataWin.onload = function() { - var dataChannel = SpecialPowers.wrap(dataWin.document).docShell.currentDocumentChannel; - var dataTriggeringPrincipal = dataChannel.loadInfo.triggeringPrincipal.URI.asciiSpec; - var dataLoadingPrincipal = dataChannel.loadInfo.loadingPrincipal; - - is(dataTriggeringPrincipal, TRIGGERING_PRINCIPAL_URI, - "TriggeringPrincipal for window.open(data:) should be the principal of the document"); - - is(dataWin.document.referrer, "", - "Referrer for window.open(data:) should be empty"); - - is(dataLoadingPrincipal, null, - "LoadingPrincipal for window.open(data:) should be null"); - - dataWin.close(); - checkFinish(); -} - -// ---------------------------------------------------------------------------- -// Test 3: window.open(javascript:) +// Test 2: window.open(javascript:) var jsWin = window.open("javascript:'<html><body>js</body></html>';", "_blank", "width=10,height=10"); jsWin.onload = function() { var jsChannel = SpecialPowers.wrap(jsWin.document).docShell.currentDocumentChannel; diff --git a/docshell/test/test_bug598895.html b/docshell/test/test_bug598895.html index 52b9537be0..5cc74e42c0 100644 --- a/docshell/test/test_bug598895.html +++ b/docshell/test/test_bug598895.html @@ -43,9 +43,8 @@ window.onmessage = function (ev) { } } -var win2 = window.open("data:text/html,<script>window.onload = function() { opener.postMessage('loaded', '*'); }</" + "script><body>Should show</body>"); - -var win3 = window.open("data:text/html,<script>window.onload = function() { opener.postMessage('loaded', '*'); }</" + "script><body></body>"); +var win2 = window.open("file_bug598895_1.html"); +var win3 = window.open("file_bug598895_2.html"); }); </script> </pre> diff --git a/docshell/test/test_bug637644.html b/docshell/test/test_bug637644.html index d172ada4a1..4192fae22c 100644 --- a/docshell/test/test_bug637644.html +++ b/docshell/test/test_bug637644.html @@ -43,9 +43,8 @@ window.onmessage = function (ev) { } } -var win2 = window.open("data:text/html,<script>window.onload = function() { opener.postMessage('loaded', '*'); }</" + "script><body>Should show</body>", "", "height=500,width=500"); - -var win3 = window.open("data:text/html,<script>window.onload = function() { opener.postMessage('loaded', '*'); }</" + "script><body></body>", "", "height=500,width=500"); +var win2 = window.open("file_bug637644_1.html", "", "height=500,width=500"); +var win3 = window.open("file_bug637644_2.html", "", "height=500,width=500"); }); </script> </pre> diff --git a/dom/base/test/file_ipc_messagemanager_blob.html b/dom/base/test/file_ipc_messagemanager_blob.html new file mode 100644 index 0000000000..dbdd64a34b --- /dev/null +++ b/dom/base/test/file_ipc_messagemanager_blob.html @@ -0,0 +1 @@ +<!DOCTYPE HTML><html><body></body></html> diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini index ddfd574433..b3b804ce4f 100644 --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -676,6 +676,7 @@ skip-if = (toolkit == 'android') # Android: Bug 775227 [test_intersectionobservers.html] skip-if = true # Track Bug 1320704 [test_ipc_messagemanager_blob.html] +support-files = file_ipc_messagemanager_blob.html [test_link_prefetch.html] skip-if = !e10s # Track Bug 1281415 [test_link_stylesheet.html] diff --git a/dom/base/test/test_ipc_messagemanager_blob.html b/dom/base/test/test_ipc_messagemanager_blob.html index 74eab29459..77d6c767f8 100644 --- a/dom/base/test/test_ipc_messagemanager_blob.html +++ b/dom/base/test/test_ipc_messagemanager_blob.html @@ -14,8 +14,7 @@ SimpleTest.waitForExplicitFinish(); - const childFrameURL = - "data:text/html,<!DOCTYPE HTML><html><body></body></html>"; + const childFrameURL = "file_ipc_messagemanager_blob.html"; function childFrameScript() { "use strict"; diff --git a/dom/base/test/test_x-frame-options.html b/dom/base/test/test_x-frame-options.html index 8e24d8a78e..a0c7acdc32 100644 --- a/dom/base/test/test_x-frame-options.html +++ b/dom/base/test/test_x-frame-options.html @@ -147,7 +147,11 @@ var testFrameInDataURI = function() { 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> diff --git a/dom/browser-element/mochitest/browserElementTestHelpers.js b/dom/browser-element/mochitest/browserElementTestHelpers.js index 004b25333d..8df1476acd 100644 --- a/dom/browser-element/mochitest/browserElementTestHelpers.js +++ b/dom/browser-element/mochitest/browserElementTestHelpers.js @@ -84,6 +84,10 @@ const browserElementTestHelpers = { this.unlockTestReady.bind(this)); }, + allowTopLevelDataURINavigation: function() { + this._setPref("security.data_uri.block_toplevel_data_uri_navigations", false); + }, + _observers: [], // This function is a wrapper which lets you register an observer to one of diff --git a/dom/browser-element/mochitest/browserElement_BrowserWindowResize.js b/dom/browser-element/mochitest/browserElement_BrowserWindowResize.js index 420b4bc34e..65a7778616 100644 --- a/dom/browser-element/mochitest/browserElement_BrowserWindowResize.js +++ b/dom/browser-element/mochitest/browserElement_BrowserWindowResize.js @@ -7,6 +7,7 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.addPermission(); +browserElementTestHelpers.allowTopLevelDataURINavigation(); function runTest() { var srcResizeTo = "data:text/html, \ diff --git a/dom/browser-element/mochitest/browserElement_Close.js b/dom/browser-element/mochitest/browserElement_Close.js index 57bdf384d1..1038054045 100644 --- a/dom/browser-element/mochitest/browserElement_Close.js +++ b/dom/browser-element/mochitest/browserElement_Close.js @@ -7,6 +7,7 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.addPermission(); +browserElementTestHelpers.allowTopLevelDataURINavigation(); function runTest() { var iframe = document.createElement('iframe'); diff --git a/dom/browser-element/mochitest/browserElement_ContextmenuEvents.js b/dom/browser-element/mochitest/browserElement_ContextmenuEvents.js index 66aa8e0159..a8c361ebd4 100644 --- a/dom/browser-element/mochitest/browserElement_ContextmenuEvents.js +++ b/dom/browser-element/mochitest/browserElement_ContextmenuEvents.js @@ -4,6 +4,7 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.setClipboardPlainTextOnlyPref(false); browserElementTestHelpers.addPermission(); +browserElementTestHelpers.allowTopLevelDataURINavigation(); var audioUrl = 'http://mochi.test:8888/tests/dom/browser-element/mochitest/audio.ogg'; var videoUrl = 'http://mochi.test:8888/tests/dom/browser-element/mochitest/short-video.ogv'; diff --git a/dom/browser-element/mochitest/browserElement_CopyPaste.js b/dom/browser-element/mochitest/browserElement_CopyPaste.js index b23feef590..97a37be8ba 100644 --- a/dom/browser-element/mochitest/browserElement_CopyPaste.js +++ b/dom/browser-element/mochitest/browserElement_CopyPaste.js @@ -9,6 +9,7 @@ SimpleTest.requestFlakyTimeout("untriaged"); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.setupAccessibleCaretPref(); browserElementTestHelpers.addPermission(); +browserElementTestHelpers.allowTopLevelDataURINavigation(); const { Services } = SpecialPowers.Cu.import('resource://gre/modules/Services.jsm'); var gTextarea = null; diff --git a/dom/browser-element/mochitest/browserElement_DataURI.js b/dom/browser-element/mochitest/browserElement_DataURI.js index f57f4566a9..d31678f89b 100644 --- a/dom/browser-element/mochitest/browserElement_DataURI.js +++ b/dom/browser-element/mochitest/browserElement_DataURI.js @@ -7,6 +7,7 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.addPermission(); +browserElementTestHelpers.allowTopLevelDataURINavigation(); function runTest() { var iframe1 = document.createElement('iframe'); diff --git a/dom/browser-element/mochitest/browserElement_Iconchange.js b/dom/browser-element/mochitest/browserElement_Iconchange.js index 367a2de15c..283331d3cc 100644 --- a/dom/browser-element/mochitest/browserElement_Iconchange.js +++ b/dom/browser-element/mochitest/browserElement_Iconchange.js @@ -7,6 +7,7 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.addPermission(); +browserElementTestHelpers.allowTopLevelDataURINavigation(); function createHtml(link) { return 'data:text/html,<html><head>' + link + '<body></body></html>'; diff --git a/dom/browser-element/mochitest/browserElement_Manifestchange.js b/dom/browser-element/mochitest/browserElement_Manifestchange.js index 22cf8fe7c3..5b3733d14f 100644 --- a/dom/browser-element/mochitest/browserElement_Manifestchange.js +++ b/dom/browser-element/mochitest/browserElement_Manifestchange.js @@ -7,6 +7,7 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.addPermission(); +browserElementTestHelpers.allowTopLevelDataURINavigation(); function createHtml(manifest) { return 'data:text/html,<html xmlns:xml="http://www.w3.org/XML/1998/namespace"><head>' + manifest + '<body></body></html>'; diff --git a/dom/browser-element/mochitest/browserElement_Metachange.js b/dom/browser-element/mochitest/browserElement_Metachange.js index 7789a3e18c..53c8d2397f 100644 --- a/dom/browser-element/mochitest/browserElement_Metachange.js +++ b/dom/browser-element/mochitest/browserElement_Metachange.js @@ -7,6 +7,7 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.addPermission(); +browserElementTestHelpers.allowTopLevelDataURINavigation(); function createHtml(meta) { return 'data:text/html,<html xmlns:xml="http://www.w3.org/XML/1998/namespace"><head>' + meta + '<body></body></html>'; diff --git a/dom/browser-element/mochitest/browserElement_Opensearch.js b/dom/browser-element/mochitest/browserElement_Opensearch.js index 8df44d2a9e..5762e6f0eb 100644 --- a/dom/browser-element/mochitest/browserElement_Opensearch.js +++ b/dom/browser-element/mochitest/browserElement_Opensearch.js @@ -7,6 +7,7 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.addPermission(); +browserElementTestHelpers.allowTopLevelDataURINavigation(); function createHtml(link) { return 'data:text/html,<html><head>' + link + '<body></body></html>'; diff --git a/dom/browser-element/mochitest/browserElement_PromptCheck.js b/dom/browser-element/mochitest/browserElement_PromptCheck.js index d6edde09f2..952f4468ea 100644 --- a/dom/browser-element/mochitest/browserElement_PromptCheck.js +++ b/dom/browser-element/mochitest/browserElement_PromptCheck.js @@ -13,6 +13,7 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.addPermission(); +browserElementTestHelpers.allowTopLevelDataURINavigation(); function runTest() { diff --git a/dom/browser-element/mochitest/browserElement_PromptConfirm.js b/dom/browser-element/mochitest/browserElement_PromptConfirm.js index c01836a251..b920a6d269 100644 --- a/dom/browser-element/mochitest/browserElement_PromptConfirm.js +++ b/dom/browser-element/mochitest/browserElement_PromptConfirm.js @@ -11,6 +11,7 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.addPermission(); +browserElementTestHelpers.allowTopLevelDataURINavigation(); function runTest() { var iframe = document.createElement('iframe'); diff --git a/dom/browser-element/mochitest/browserElement_RemoveBrowserElement.js b/dom/browser-element/mochitest/browserElement_RemoveBrowserElement.js index 583d587346..3ab206388b 100644 --- a/dom/browser-element/mochitest/browserElement_RemoveBrowserElement.js +++ b/dom/browser-element/mochitest/browserElement_RemoveBrowserElement.js @@ -9,6 +9,7 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.addPermission(); +browserElementTestHelpers.allowTopLevelDataURINavigation(); function runTest() { var iframe = document.createElement('iframe'); diff --git a/dom/browser-element/mochitest/browserElement_ScrollEvent.js b/dom/browser-element/mochitest/browserElement_ScrollEvent.js index 06dc91b862..5230c524a3 100644 --- a/dom/browser-element/mochitest/browserElement_ScrollEvent.js +++ b/dom/browser-element/mochitest/browserElement_ScrollEvent.js @@ -7,6 +7,7 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.addPermission(); +browserElementTestHelpers.allowTopLevelDataURINavigation(); function runTest() { var iframe = document.createElement('iframe'); diff --git a/dom/browser-element/mochitest/browserElement_Titlechange.js b/dom/browser-element/mochitest/browserElement_Titlechange.js index 78c939ad83..145e9baa8e 100644 --- a/dom/browser-element/mochitest/browserElement_Titlechange.js +++ b/dom/browser-element/mochitest/browserElement_Titlechange.js @@ -7,6 +7,7 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.addPermission(); +browserElementTestHelpers.allowTopLevelDataURINavigation(); function runTest() { var iframe1 = document.createElement('iframe'); diff --git a/dom/browser-element/mochitest/browserElement_TopBarrier.js b/dom/browser-element/mochitest/browserElement_TopBarrier.js index 3bd68854cd..186622b338 100644 --- a/dom/browser-element/mochitest/browserElement_TopBarrier.js +++ b/dom/browser-element/mochitest/browserElement_TopBarrier.js @@ -7,6 +7,7 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.addPermission(); +browserElementTestHelpers.allowTopLevelDataURINavigation(); var iframe; function runTest() { diff --git a/dom/html/test/test_fullscreen-api-race.html b/dom/html/test/test_fullscreen-api-race.html index 03c6c6da3a..6664e2ab52 100644 --- a/dom/html/test/test_fullscreen-api-race.html +++ b/dom/html/test/test_fullscreen-api-race.html @@ -35,7 +35,9 @@ addLoadEvent(function () { SpecialPowers.pushPrefEnv({ "set": [ ["full-screen-api.unprefix.enabled", true], - ["full-screen-api.allow-trusted-requests-only", false] + ["full-screen-api.allow-trusted-requests-only", false], + // Use legacy data: URI behavior to run test. + ["security.data_uri.block_toplevel_data_uri_navigations", false] ] }, next); }); diff --git a/dom/plugins/test/mochitest/test_pluginstream_err.html b/dom/plugins/test/mochitest/test_pluginstream_err.html index 0ac2a5efc2..79f06154c9 100644 --- a/dom/plugins/test/mochitest/test_pluginstream_err.html +++ b/dom/plugins/test/mochitest/test_pluginstream_err.html @@ -13,7 +13,7 @@ Tests for plugin stream error conditions. <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> @@ -158,6 +158,12 @@ function continueTest() { index++; } +function startTests() { + SpecialPowers.pushPrefEnv({"set": [ + ["security.data_uri.block_toplevel_data_uri_navigations", false], + ]}, runNextTest); +} + </script> </div> </body> diff --git a/dom/tests/mochitest/bugs/test_resize_move_windows.html b/dom/tests/mochitest/bugs/test_resize_move_windows.html index 0762e92313..f84b4fde84 100644 --- a/dom/tests/mochitest/bugs/test_resize_move_windows.html +++ b/dom/tests/mochitest/bugs/test_resize_move_windows.html @@ -312,7 +312,10 @@ function checkChangeIsEnabled(aWindow, aNext) .then(aNext); } -SpecialPowers.pushPrefEnv({"set": [["dom.disable_window_move_resize", false]]}, function() { +SpecialPowers.pushPrefEnv({ + "set": [["dom.disable_window_move_resize", false], + ["security.data_uri.block_toplevel_data_uri_navigations", false],]}, + function() { SimpleTest.waitForFocus(function() { if (screen.width <= 200 || screen.height <= 200) { todo(false, "The screen needs to be bigger than 200px*200px to run this test."); diff --git a/editor/libeditor/tests/browser.ini b/editor/libeditor/tests/browser.ini index 249f59aa8f..bd234fc8dc 100644 --- a/editor/libeditor/tests/browser.ini +++ b/editor/libeditor/tests/browser.ini @@ -1,6 +1,8 @@ [browser_bug527935.js] skip-if = toolkit == 'android' -support-files = bug527935.html +support-files = + bug527935.html + bug527935_2.html [browser_bug629172.js] skip-if = toolkit == 'android' support-files = bug629172.html diff --git a/editor/libeditor/tests/bug527935.html b/editor/libeditor/tests/bug527935.html index 4bfa1bac23..1731734d29 100644 --- a/editor/libeditor/tests/bug527935.html +++ b/editor/libeditor/tests/bug527935.html @@ -3,7 +3,7 @@ <body> <div id="content"> <iframe id="formTarget" name="formTarget"></iframe> - <form action="data:text/html," target="formTarget"> + <form action="bug527935_2.html" target="formTarget"> <input name="test" id="initValue"><input type="submit"> </form> </div> diff --git a/editor/libeditor/tests/bug527935_2.html b/editor/libeditor/tests/bug527935_2.html new file mode 100644 index 0000000000..96af0721d4 --- /dev/null +++ b/editor/libeditor/tests/bug527935_2.html @@ -0,0 +1 @@ +<html><body>dummy page</body></html> diff --git a/editor/libeditor/tests/file_bug635636_2.html b/editor/libeditor/tests/file_bug635636_2.html new file mode 100644 index 0000000000..bf0c8101f9 --- /dev/null +++ b/editor/libeditor/tests/file_bug635636_2.html @@ -0,0 +1 @@ +<html><body>2</body></html> diff --git a/editor/libeditor/tests/file_bug966155.html b/editor/libeditor/tests/file_bug966155.html new file mode 100644 index 0000000000..04f55a9188 --- /dev/null +++ b/editor/libeditor/tests/file_bug966155.html @@ -0,0 +1 @@ +<input><iframe onload="contentDocument.designMode = 'on';"> diff --git a/editor/libeditor/tests/file_bug966552.html b/editor/libeditor/tests/file_bug966552.html new file mode 100644 index 0000000000..5061c2e40d --- /dev/null +++ b/editor/libeditor/tests/file_bug966552.html @@ -0,0 +1 @@ +<body onload="document.designMode='on'">test</body> diff --git a/editor/libeditor/tests/test_bug966155.html b/editor/libeditor/tests/test_bug966155.html index 524b15d694..1e7ed67f3f 100644 --- a/editor/libeditor/tests/test_bug966155.html +++ b/editor/libeditor/tests/test_bug966155.html @@ -18,13 +18,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=966155 <script class="testbody" type="text/javascript"> SimpleTest.waitForExplicitFinish(); -addLoadEvent(function() { - var win = window.open("data:text/html,<input><iframe onload=\"contentDocument.designMode = 'on';\">", "", "test-966155"); - win.addEventListener("load", function onLoad() { - win.removeEventListener("load", onLoad); - runTest(win); - }, false); -}); +var win = window.open("file_bug966155.html", "", "test-966155"); +win.addEventListener("load", function() { + runTest(win); +}, {once: true}); function runTest(win) { SimpleTest.waitForFocus(function() { @@ -38,14 +35,14 @@ function runTest(win) { "test".split("").forEach(function(letter) { synthesizeKey(letter, {}, win); }); - is(iframeDoc.body.textContent, "test", "entered the text"); + is(iframeDoc.body.textContent.trim(), "test", "entered the text"); // focus the input box input.focus(); // press tab synthesizeKey("VK_TAB", {}, win); // Now press Ctrl+Backspace synthesizeKey("VK_BACK_SPACE", {ctrlKey: true}, win); - is(iframeDoc.body.textContent, "", "deleted the text"); + is(iframeDoc.body.textContent.trim(), "", "deleted the text"); win.close(); SimpleTest.finish(); }, win); diff --git a/editor/libeditor/tests/test_bug966552.html b/editor/libeditor/tests/test_bug966552.html index 3d0ec5fe32..e18883aad2 100644 --- a/editor/libeditor/tests/test_bug966552.html +++ b/editor/libeditor/tests/test_bug966552.html @@ -18,13 +18,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=966552 <script class="testbody" type="text/javascript"> SimpleTest.waitForExplicitFinish(); -addLoadEvent(function() { - var win = window.open("data:text/html,<body onload=\"document.designMode='on'\">test</body>", "", "test-966552"); - win.addEventListener("load", function onLoad() { - win.removeEventListener("load", onLoad); - runTest(win); - }, false); -}); +var win = window.open("file_bug966552.html", "", "test-966552"); +win.addEventListener("load", function() { + runTest(win); +}, {once: true}); function runTest(win) { SimpleTest.waitForFocus(function() { @@ -33,7 +30,7 @@ function runTest(win) { doc.body.focus(); sel.collapse(doc.body.firstChild, 2); synthesizeKey("VK_BACK_SPACE", {ctrlKey: true}, win); - is(doc.body.textContent, "st"); + is(doc.body.textContent.trim(), "st"); win.close(); SimpleTest.finish(); }, win); diff --git a/testing/talos/talos/test.py b/testing/talos/talos/test.py index 0de9f19bb3..dc1306b8ed 100644 --- a/testing/talos/talos/test.py +++ b/testing/talos/talos/test.py @@ -194,6 +194,7 @@ class tpaint(TsBase): tpmozafterpaint = True filters = filter.ignore_first.prepare(5) + filter.median.prepare() unit = 'ms' + preferences = {'security.data_uri.block_toplevel_data_uri_navigations': False} @register_test() diff --git a/testing/web-platform/tests/websockets/unload-a-document/001-1.html b/testing/web-platform/tests/websockets/unload-a-document/001-1.html index 214246b2ee..926a68a065 100644 --- a/testing/web-platform/tests/websockets/unload-a-document/001-1.html +++ b/testing/web-platform/tests/websockets/unload-a-document/001-1.html @@ -22,7 +22,7 @@ t.step(function() { }), 1000); controller.navigate(); }) - ws.onerror = ws.onmessage = ws.onclose = t.step_func(function(e) {assert_unreached("Got unexpected event " + e.type)}); + ws.onerror = ws.onmessage = t.step_func(e => assert_unreached("Got unexpected event " + e.type)); } }); </script> diff --git a/testing/web-platform/tests/websockets/unload-a-document/001-2.html b/testing/web-platform/tests/websockets/unload-a-document/001-2.html new file mode 100644 index 0000000000..24c419ce18 --- /dev/null +++ b/testing/web-platform/tests/websockets/unload-a-document/001-2.html @@ -0,0 +1,4 @@ +<!doctype html> +<title>WebSockets: navigating top-level browsing context</title> +<body onload="history.back()"></body> +</html> diff --git a/testing/web-platform/tests/websockets/unload-a-document/001.html b/testing/web-platform/tests/websockets/unload-a-document/001.html index d949b6eba0..56e883c649 100644 --- a/testing/web-platform/tests/websockets/unload-a-document/001.html +++ b/testing/web-platform/tests/websockets/unload-a-document/001.html @@ -20,6 +20,6 @@ t.step(function() { }); }); navigate = t.step_func(function() { - w.location = 'data:text/html,<body onload="history.back()">'; + w.location = w.location.href.replace("001-1.html", "001-2.html"); }); </script> diff --git a/testing/web-platform/tests/websockets/unload-a-document/002-1.html b/testing/web-platform/tests/websockets/unload-a-document/002-1.html index 86a852b101..52f188fa48 100644 --- a/testing/web-platform/tests/websockets/unload-a-document/002-1.html +++ b/testing/web-platform/tests/websockets/unload-a-document/002-1.html @@ -28,7 +28,7 @@ t.step(function() { controller.navigate(); }); }) - ws.onerror = ws.onmessage = ws.onclose = t.step_func(function(e) {assert_unreached("Got unexpected event " + e.type)}); + ws.onerror = ws.onmessage = t.step_func(e => assert_unreached("Got unexpected event " + e.type)); } }); </script> diff --git a/testing/web-platform/tests/websockets/unload-a-document/002-2.html b/testing/web-platform/tests/websockets/unload-a-document/002-2.html new file mode 100644 index 0000000000..9a246a1dd8 --- /dev/null +++ b/testing/web-platform/tests/websockets/unload-a-document/002-2.html @@ -0,0 +1,4 @@ +<!doctype html> +<title>WebSockets: navigating top-level browsing context with closed websocket</title> +<body onload="history.back()"></body> +</html> diff --git a/testing/web-platform/tests/websockets/unload-a-document/002.html b/testing/web-platform/tests/websockets/unload-a-document/002.html index df35192d6a..03764c345e 100644 --- a/testing/web-platform/tests/websockets/unload-a-document/002.html +++ b/testing/web-platform/tests/websockets/unload-a-document/002.html @@ -21,6 +21,6 @@ t.step(function() { }); }); navigate = t.step_func(function() { - w.location = 'data:text/html,<body onload="history.back()">'; + w.location = w.location.href.replace("002-1.html", "002-2.html"); }); </script> diff --git a/toolkit/components/printing/tests/browser.ini b/toolkit/components/printing/tests/browser.ini index 88d6bb454c..5f2867189a 100644 --- a/toolkit/components/printing/tests/browser.ini +++ b/toolkit/components/printing/tests/browser.ini @@ -1,2 +1,5 @@ [browser_page_change_print_original.js] +support-files = + file_page_change_print_original_1.html + file_page_change_print_original_2.html skip-if = os == "mac" diff --git a/toolkit/components/printing/tests/browser_page_change_print_original.js b/toolkit/components/printing/tests/browser_page_change_print_original.js index 5990a486b7..8641504519 100644 --- a/toolkit/components/printing/tests/browser_page_change_print_original.js +++ b/toolkit/components/printing/tests/browser_page_change_print_original.js @@ -3,8 +3,11 @@ * and we re-initialize print preview (e.g. by changing page orientation), * we still show (and will therefore print) the original contents. */ +const TEST_PATH = getRootDirectory(gTestPath) + .replace("chrome://mochitests/content", "http://example.com"); + add_task(function* pp_after_orientation_change() { - const DATA_URI = `data:text/html,<script>window.onafterprint = function() { setTimeout("window.location = 'data:text/plain,REPLACED PAGE!'", 0); }</script><pre>INITIAL PAGE</pre>`; + const URI = TEST_PATH + "file_page_change_print_original_1.html"; // Can only do something if we have a print preview UI: if (AppConstants.platform != "win" && AppConstants.platform != "linux") { ok(true, "Can't test if there's no print preview."); @@ -12,7 +15,7 @@ add_task(function* pp_after_orientation_change() { } // Ensure we get a browserStopped for this browser - let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, DATA_URI, false, true); + let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, URI, false, true); let browserToPrint = tab.linkedBrowser; let ppBrowser = PrintPreviewListener.getPrintPreviewBrowser(); @@ -26,7 +29,7 @@ add_task(function* pp_after_orientation_change() { // Assert that we are showing the original page yield ContentTask.spawn(ppBrowser, null, function* () { - is(content.document.body.textContent, "INITIAL PAGE", "Should have initial page print previewed."); + is(content.document.body.textContent.trim(), "INITIAL PAGE", "Should have initial page print previewed."); }); yield originalTabNavigated; @@ -43,12 +46,12 @@ add_task(function* pp_after_orientation_change() { // Check that we're still showing the original page. yield ContentTask.spawn(ppBrowser, null, function* () { - is(content.document.body.textContent, "INITIAL PAGE", "Should still have initial page print previewed."); + is(content.document.body.textContent.trim(), "INITIAL PAGE", "Should still have initial page print previewed."); }); // Check that the other tab is definitely showing the new page: yield ContentTask.spawn(browserToPrint, null, function* () { - is(content.document.body.textContent, "REPLACED PAGE!", "Original page should have changed."); + is(content.document.body.textContent.trim(), "REPLACED PAGE!", "Original page should have changed."); }); PrintUtils.exitPrintPreview(); diff --git a/toolkit/components/printing/tests/file_page_change_print_original_1.html b/toolkit/components/printing/tests/file_page_change_print_original_1.html new file mode 100644 index 0000000000..76e3be1374 --- /dev/null +++ b/toolkit/components/printing/tests/file_page_change_print_original_1.html @@ -0,0 +1,8 @@ +<script> +window.onafterprint = function() { + setTimeout(function() { + window.location = "file_page_change_print_original_2.html" + }, 0); +} +</script> +<pre>INITIAL PAGE</pre> diff --git a/toolkit/components/printing/tests/file_page_change_print_original_2.html b/toolkit/components/printing/tests/file_page_change_print_original_2.html new file mode 100644 index 0000000000..44f33281c9 --- /dev/null +++ b/toolkit/components/printing/tests/file_page_change_print_original_2.html @@ -0,0 +1 @@ +REPLACED PAGE! diff --git a/toolkit/mozapps/extensions/test/xpinstall/browser_datauri.js b/toolkit/mozapps/extensions/test/xpinstall/browser_datauri.js index 917f2465d1..b24bce4b50 100644 --- a/toolkit/mozapps/extensions/test/xpinstall/browser_datauri.js +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_datauri.js @@ -13,6 +13,13 @@ function setup_redirect(aSettings) { } function test() { + waitForExplicitFinish(); + SpecialPowers.pushPrefEnv({ + "set": [["security.data_uri.block_toplevel_data_uri_navigations", false]] + }, runTest); +} + +function runTest() { Harness.installOriginBlockedCallback = install_blocked; Harness.installsCompletedCallback = finish_test; Harness.setup(); @@ -33,4 +40,5 @@ function finish_test(count) { gBrowser.removeCurrentTab(); Harness.finish(); + finish(); } |