summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-05-06 20:45:22 +0200
committerGitHub <noreply@github.com>2018-05-06 20:45:22 +0200
commit5390888b97ecbd4135049c0b4a2ae0b103052a4a (patch)
treef3ddb622b21bd336384972e5461402d247478f85 /dom
parent61394bf4ff79650ee4b3f3951331c8a8775de6e3 (diff)
parent26a032c080c91ee9da347893362d5b08bc759c10 (diff)
downloadUXP-5390888b97ecbd4135049c0b4a2ae0b103052a4a.tar
UXP-5390888b97ecbd4135049c0b4a2ae0b103052a4a.tar.gz
UXP-5390888b97ecbd4135049c0b4a2ae0b103052a4a.tar.lz
UXP-5390888b97ecbd4135049c0b4a2ae0b103052a4a.tar.xz
UXP-5390888b97ecbd4135049c0b4a2ae0b103052a4a.zip
Merge pull request #335 from janekptacijarabaci/security_blocking_data_3
moebius#231: Consider blocking top level window data: URIs (tests)
Diffstat (limited to 'dom')
-rw-r--r--dom/base/test/file_ipc_messagemanager_blob.html1
-rw-r--r--dom/base/test/mochitest.ini1
-rw-r--r--dom/base/test/test_ipc_messagemanager_blob.html3
-rw-r--r--dom/base/test/test_x-frame-options.html6
-rw-r--r--dom/browser-element/mochitest/browserElementTestHelpers.js4
-rw-r--r--dom/browser-element/mochitest/browserElement_BrowserWindowResize.js1
-rw-r--r--dom/browser-element/mochitest/browserElement_Close.js1
-rw-r--r--dom/browser-element/mochitest/browserElement_ContextmenuEvents.js1
-rw-r--r--dom/browser-element/mochitest/browserElement_CopyPaste.js1
-rw-r--r--dom/browser-element/mochitest/browserElement_DataURI.js1
-rw-r--r--dom/browser-element/mochitest/browserElement_Iconchange.js1
-rw-r--r--dom/browser-element/mochitest/browserElement_Manifestchange.js1
-rw-r--r--dom/browser-element/mochitest/browserElement_Metachange.js1
-rw-r--r--dom/browser-element/mochitest/browserElement_Opensearch.js1
-rw-r--r--dom/browser-element/mochitest/browserElement_PromptCheck.js1
-rw-r--r--dom/browser-element/mochitest/browserElement_PromptConfirm.js1
-rw-r--r--dom/browser-element/mochitest/browserElement_RemoveBrowserElement.js1
-rw-r--r--dom/browser-element/mochitest/browserElement_ScrollEvent.js1
-rw-r--r--dom/browser-element/mochitest/browserElement_Titlechange.js1
-rw-r--r--dom/browser-element/mochitest/browserElement_TopBarrier.js1
-rw-r--r--dom/html/test/test_fullscreen-api-race.html4
-rw-r--r--dom/ipc/tests/test_cpow_cookies.html3
-rw-r--r--dom/plugins/test/mochitest/test_pluginstream_err.html8
-rw-r--r--dom/tests/mochitest/bugs/test_resize_move_windows.html5
24 files changed, 43 insertions, 7 deletions
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 000000000..dbdd64a34
--- /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 ddfd57443..b3b804ce4 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 74eab2945..77d6c767f 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 8e24d8a78..a0c7acdc3 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 004b25333..8df1476ac 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 420b4bc34..65a777861 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 57bdf384d..103805404 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 66aa8e015..a8c361ebd 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 b23feef59..97a37be8b 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 f57f4566a..d31678f89 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 367a2de15..283331d3c 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 22cf8fe7c..5b3733d14 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 7789a3e18..53c8d2397 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 8df44d2a9..5762e6f0e 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 d6edde09f..952f4468e 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 c01836a25..b920a6d26 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 583d58734..3ab206388 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 06dc91b86..5230c524a 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 78c939ad8..145e9baa8 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 3bd68854c..186622b33 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 03c6c6da3..6664e2ab5 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/ipc/tests/test_cpow_cookies.html b/dom/ipc/tests/test_cpow_cookies.html
index 1e55d3878..d8f87cced 100644
--- a/dom/ipc/tests/test_cpow_cookies.html
+++ b/dom/ipc/tests/test_cpow_cookies.html
@@ -81,7 +81,8 @@
["dom.ipc.browser_frames.oop_by_default", true],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
- ["browser.pagethumbnails.capturing_disabled", true]
+ ["browser.pagethumbnails.capturing_disabled", true],
+ ["security.data_uri.block_toplevel_data_uri_navigations", false],
]
}, runTests);
});
diff --git a/dom/plugins/test/mochitest/test_pluginstream_err.html b/dom/plugins/test/mochitest/test_pluginstream_err.html
index 0ac2a5efc..79f06154c 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 0762e9231..f84b4fde8 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.");