mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 11:57:32 +09:00
moebius#231: Consider blocking top level window data: URIs (tests)
https://github.com/MoonchildProductions/moebius/pull/231
This commit is contained in:
parent
b6f0383b26
commit
745e1809b0
63 changed files with 157 additions and 83 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
<div id='one' style='color:red;'>ONE</div>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<div id='two' style='color:green;'>TWO</div>
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
1
docshell/test/file_bug598895_1.html
Normal file
1
docshell/test/file_bug598895_1.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<script>window.onload = function() { opener.postMessage('loaded', '*'); }</script><body>Should show</body>
|
||||
1
docshell/test/file_bug598895_2.html
Normal file
1
docshell/test/file_bug598895_2.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<script>window.onload = function() { opener.postMessage('loaded', '*'); }</script><body></body>
|
||||
1
docshell/test/file_bug637644_1.html
Normal file
1
docshell/test/file_bug637644_1.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<script>window.onload = function() { opener.postMessage('loaded', '*'); }</script><body>Should show</body>
|
||||
1
docshell/test/file_bug637644_2.html
Normal file
1
docshell/test/file_bug637644_2.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<script>window.onload = function() { opener.postMessage('loaded', '*'); }</script><body></body>
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
<html><body>This is a popup</body></html>
|
||||
1
docshell/test/navigation/navigation_target_url.html
Normal file
1
docshell/test/navigation/navigation_target_url.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<html><body>This frame was navigated.</body></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>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
1
dom/base/test/file_ipc_messagemanager_blob.html
Normal file
1
dom/base/test/file_ipc_messagemanager_blob.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<!DOCTYPE HTML><html><body></body></html>
|
||||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
browserElementTestHelpers.allowTopLevelDataURINavigation();
|
||||
|
||||
function runTest() {
|
||||
var srcResizeTo = "data:text/html, \
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
browserElementTestHelpers.allowTopLevelDataURINavigation();
|
||||
|
||||
function runTest() {
|
||||
var iframe = document.createElement('iframe');
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
browserElementTestHelpers.allowTopLevelDataURINavigation();
|
||||
|
||||
function runTest() {
|
||||
var iframe1 = document.createElement('iframe');
|
||||
|
|
|
|||
|
|
@ -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>';
|
||||
|
|
|
|||
|
|
@ -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>';
|
||||
|
|
|
|||
|
|
@ -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>';
|
||||
|
|
|
|||
|
|
@ -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>';
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
browserElementTestHelpers.allowTopLevelDataURINavigation();
|
||||
|
||||
function runTest()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
browserElementTestHelpers.allowTopLevelDataURINavigation();
|
||||
|
||||
function runTest() {
|
||||
var iframe = document.createElement('iframe');
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
browserElementTestHelpers.allowTopLevelDataURINavigation();
|
||||
|
||||
function runTest() {
|
||||
var iframe = document.createElement('iframe');
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
browserElementTestHelpers.allowTopLevelDataURINavigation();
|
||||
|
||||
function runTest() {
|
||||
var iframe = document.createElement('iframe');
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
browserElementTestHelpers.allowTopLevelDataURINavigation();
|
||||
|
||||
function runTest() {
|
||||
var iframe1 = document.createElement('iframe');
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
browserElementTestHelpers.allowTopLevelDataURINavigation();
|
||||
|
||||
var iframe;
|
||||
function runTest() {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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.");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
1
editor/libeditor/tests/bug527935_2.html
Normal file
1
editor/libeditor/tests/bug527935_2.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<html><body>dummy page</body></html>
|
||||
1
editor/libeditor/tests/file_bug635636_2.html
Normal file
1
editor/libeditor/tests/file_bug635636_2.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<html><body>2</body></html>
|
||||
1
editor/libeditor/tests/file_bug966155.html
Normal file
1
editor/libeditor/tests/file_bug966155.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<input><iframe onload="contentDocument.designMode = 'on';">
|
||||
1
editor/libeditor/tests/file_bug966552.html
Normal file
1
editor/libeditor/tests/file_bug966552.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<body onload="document.designMode='on'">test</body>
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
<!doctype html>
|
||||
<title>WebSockets: navigating top-level browsing context</title>
|
||||
<body onload="history.back()"></body>
|
||||
</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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
<!doctype html>
|
||||
<title>WebSockets: navigating top-level browsing context with closed websocket</title>
|
||||
<body onload="history.back()"></body>
|
||||
</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>
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1 @@
|
|||
REPLACED PAGE!
|
||||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue