зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1397652 - Update tests within browser/ to comply with new toplevel data: URI navigation policy. r=gijs
This commit is contained in:
Родитель
6335fa41aa
Коммит
e328a6db15
|
@ -32,6 +32,8 @@ support-files =
|
|||
ctxmenu-image.png
|
||||
discovery.html
|
||||
download_page.html
|
||||
download_page_1.txt
|
||||
download_page_2.txt
|
||||
dummy_page.html
|
||||
feed_tab.html
|
||||
file_generic_favicon.ico
|
||||
|
|
|
@ -5,6 +5,11 @@ const TEST_URL = "http://example.com/browser/browser/base/content/test/general/a
|
|||
add_task(async function() {
|
||||
SimpleTest.requestCompleteLog();
|
||||
|
||||
// allow top level data: URI navigations, otherwise clicking data: link fails
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
"set": [["security.data_uri.block_toplevel_data_uri_navigations", false]]
|
||||
});
|
||||
|
||||
// Pinned: Link to the same domain should not open a new tab
|
||||
// Tests link to http://example.com/browser/browser/base/content/test/general/dummy_page.html
|
||||
await testLink(0, true, false);
|
||||
|
|
|
@ -2,6 +2,13 @@
|
|||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
add_task(async function() {
|
||||
|
||||
// allow top level data: URI navigations, otherwise loading data: URIs
|
||||
// in toplevel windows fail.
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
"set": [["security.data_uri.block_toplevel_data_uri_navigations", false]]
|
||||
});
|
||||
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, null, false);
|
||||
|
||||
let browser = tab.linkedBrowser;
|
||||
|
|
|
@ -6,6 +6,7 @@ var Cc = Components.classes;
|
|||
var Ci = Components.interfaces;
|
||||
|
||||
const PREF_DISABLE_OPEN_NEW_WINDOW = "browser.link.open_newwindow.disabled_in_fullscreen";
|
||||
const PREF_BLOCK_TOPLEVEL_DATA = "security.data_uri.block_toplevel_data_uri_navigations";
|
||||
const isOSX = (Services.appinfo.OS === "Darwin");
|
||||
|
||||
const TEST_FILE = "file_fullscreen-window-open.html";
|
||||
|
@ -19,6 +20,7 @@ async function test() {
|
|||
waitForExplicitFinish();
|
||||
|
||||
Services.prefs.setBoolPref(PREF_DISABLE_OPEN_NEW_WINDOW, true);
|
||||
Services.prefs.setBoolPref(PREF_BLOCK_TOPLEVEL_DATA, false);
|
||||
|
||||
newWin = await BrowserTestUtils.openNewBrowserWindow();
|
||||
newBrowser = newWin.gBrowser;
|
||||
|
@ -37,6 +39,7 @@ registerCleanupFunction(async function() {
|
|||
await BrowserTestUtils.closeWindow(newWin);
|
||||
|
||||
Services.prefs.clearUserPref(PREF_DISABLE_OPEN_NEW_WINDOW);
|
||||
Services.prefs.clearUserPref(PREF_BLOCK_TOPLEVEL_DATA);
|
||||
});
|
||||
|
||||
var gTests = [
|
||||
|
|
|
@ -11,13 +11,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=676619
|
|||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=676619">Bug 676619</a>
|
||||
<br/>
|
||||
<ul>
|
||||
<li><a href="data:text/plain,Hey What are you looking for?"
|
||||
<li><a href="download_page_1.txt"
|
||||
download="test.txt" id="link1">Download "test.txt"</a></li>
|
||||
<li><a href="video.ogg"
|
||||
download id="link2">Download "video.ogg"</a></li>
|
||||
<li><a href="video.ogg"
|
||||
download="just some video" id="link3">Download "just some video"</a></li>
|
||||
<li><a href="data:text/plain,test"
|
||||
<li><a href="download_page_2.txt"
|
||||
download="with-target.txt" id="link4">Download "with-target.txt"</a></li>
|
||||
<li><a href="javascript:(1+2)+''"
|
||||
download="javascript.txt" id="link5">Download "javascript.txt"</a></li>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Hey What are you looking for?
|
|
@ -0,0 +1 @@
|
|||
test
|
|
@ -1,6 +1,12 @@
|
|||
[browser_popupUI.js]
|
||||
[browser_popup_blocker.js]
|
||||
support-files = popup_blocker.html
|
||||
support-files =
|
||||
popup_blocker.html
|
||||
popup_blocker_a.html
|
||||
popup_blocker_b.html
|
||||
skip-if = (os == 'linux') || (e10s && debug) # Frequent bug 1081925 and bug 1125520 failures
|
||||
[browser_popup_frames.js]
|
||||
support-files = popup_blocker.html
|
||||
support-files =
|
||||
popup_blocker.html
|
||||
popup_blocker_a.html
|
||||
popup_blocker_b.html
|
||||
|
|
|
@ -64,8 +64,8 @@ add_task(async function test_opening_blocked_popups() {
|
|||
|
||||
gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen);
|
||||
|
||||
is(popupTabs[0].linkedBrowser.currentURI.spec, "data:text/plain;charset=utf-8,a", "Popup a");
|
||||
is(popupTabs[1].linkedBrowser.currentURI.spec, "data:text/plain;charset=utf-8,b", "Popup b");
|
||||
ok(popupTabs[0].linkedBrowser.currentURI.spec.endsWith("popup_blocker_a.html"), "Popup a");
|
||||
ok(popupTabs[1].linkedBrowser.currentURI.spec.endsWith("popup_blocker_b.html"), "Popup b");
|
||||
|
||||
// Clean up.
|
||||
gBrowser.removeTab(tab);
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
window.open("data:text/plain;charset=utf-8,a", "a");
|
||||
window.open("data:text/plain;charset=utf-8,b", "b");
|
||||
window.open("popup_blocker_a.html", "a");
|
||||
window.open("popup_blocker_b.html", "b");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<html><body>a</body></html>
|
|
@ -0,0 +1 @@
|
|||
<html><body>b</body></html>
|
|
@ -29,6 +29,7 @@ support-files =
|
|||
[browser_bug556061.js]
|
||||
subsuite = clipboard
|
||||
[browser_bug562649.js]
|
||||
support-files = file_bug562649.html
|
||||
[browser_bug623155.js]
|
||||
support-files =
|
||||
redirect_bug623155.sjs
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
function test() {
|
||||
const URI = "data:text/plain,bug562649";
|
||||
const TEST_PATH = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com");
|
||||
const URI = TEST_PATH + "file_bug562649.html";
|
||||
window.browserDOMWindow.openURI(makeURI(URI),
|
||||
null,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<html><body>bug562649</body></html>
|
|
@ -203,6 +203,12 @@ add_task(async function testBadPermissions() {
|
|||
});
|
||||
|
||||
add_task(async function testMatchDataURI() {
|
||||
// allow top level data: URI navigations, otherwise
|
||||
// window.location.href = data: would be blocked
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
"set": [["security.data_uri.block_toplevel_data_uri_navigations", false]],
|
||||
});
|
||||
|
||||
const target = ExtensionTestUtils.loadExtension({
|
||||
files: {
|
||||
"page.html": `<!DOCTYPE html>
|
||||
|
|
|
@ -68,6 +68,11 @@ function frame_script() {
|
|||
* Check if data: URI inherits firstPartyDomain from about:blank correctly.
|
||||
*/
|
||||
add_task(async function test_remote_window_open_data_uri() {
|
||||
// allow top level data: URI navigations, otherwise
|
||||
// <a href="data:" would fail.
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
"set": [["security.data_uri.block_toplevel_data_uri_navigations", false]]
|
||||
});
|
||||
let win = await BrowserTestUtils.openNewBrowserWindow({ remote: true });
|
||||
let browser = win.gBrowser.selectedBrowser;
|
||||
let mm = browser.messageManager;
|
||||
|
|
|
@ -22,6 +22,10 @@ const WINDOW_BODY = `data:text/html,
|
|||
</a>`;
|
||||
|
||||
add_task(async function test_private_popup_window_opens_private_tabs() {
|
||||
// allow top level data: URI navigations, otherwise clicking a data: link fails
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
"set": [["security.data_uri.block_toplevel_data_uri_navigations", false]]
|
||||
});
|
||||
let privWin = await BrowserTestUtils.openNewBrowserWindow({ private: true });
|
||||
|
||||
// Sanity check - this browser better be private.
|
||||
|
|
|
@ -70,7 +70,9 @@ support-files =
|
|||
[browser_aboutPrivateBrowsing.js]
|
||||
[browser_aboutSessionRestore.js]
|
||||
[browser_async_duplicate_tab.js]
|
||||
support-files = file_async_duplicate_tab.html
|
||||
[browser_async_flushes.js]
|
||||
support-files = file_async_flushes.html
|
||||
run-if = e10s && crashreporter
|
||||
skip-if = debug # bug 1167933
|
||||
[browser_async_remove_tab.js]
|
||||
|
@ -111,6 +113,8 @@ skip-if = e10s # Bug 1271024
|
|||
[browser_scrollPositions.js]
|
||||
[browser_scrollPositionsReaderMode.js]
|
||||
[browser_sessionHistory.js]
|
||||
support-files =
|
||||
file_sessionHistory_hashchange.html
|
||||
[browser_sessionStorage.js]
|
||||
[browser_sessionStorage_size.js]
|
||||
[browser_tab_label_during_restore.js]
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
// it's enclosing context.
|
||||
|
||||
add_task(async function test() {
|
||||
// allow top level data: URI navigations, otherwise clicking a data: link fails
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
"set": [["security.data_uri.block_toplevel_data_uri_navigations", false]]
|
||||
});
|
||||
let dataURIPref = Services.prefs.getBoolPref("security.data_uri.unique_opaque_origin");
|
||||
// create a tab that has a CSP
|
||||
let testURL = "http://mochi.test:8888/browser/browser/components/sessionstore/test/browser_911547_sample.html";
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
const URL = "data:text/html;charset=utf-8,<a href=%23>clickme</a>";
|
||||
const PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content/", "http://example.com/");
|
||||
const URL = PATH + "file_async_duplicate_tab.html";
|
||||
|
||||
add_task(async function test_duplicate() {
|
||||
// Create new tab.
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
const URL = "data:text/html;charset=utf-8,<a href=%23>clickme</a>";
|
||||
const PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content/", "http://example.com/");
|
||||
const URL = PATH + "file_async_flushes.html";
|
||||
|
||||
add_task(async function test_flush() {
|
||||
// Create new tab.
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
* inserted iframes are ignored.
|
||||
*/
|
||||
add_task(async function() {
|
||||
// allow top level data: URI navigations, otherwise clicking a data: link fails
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
"set": [["security.data_uri.block_toplevel_data_uri_navigations", false]]
|
||||
});
|
||||
// This URL has the following frames:
|
||||
// + data:text/html,A (static)
|
||||
// + data:text/html,B (static)
|
||||
|
@ -46,6 +50,10 @@ add_task(async function() {
|
|||
* create a second root entry that doesn't contain any dynamic children either.
|
||||
*/
|
||||
add_task(async function() {
|
||||
// allow top level data: URI navigations, otherwise clicking a data: link fails
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
"set": [["security.data_uri.block_toplevel_data_uri_navigations", false]]
|
||||
});
|
||||
// This URL has the following frames:
|
||||
// + data:text/html,A (static)
|
||||
// + data:text/html,C (dynamic iframe)
|
||||
|
|
|
@ -37,8 +37,9 @@ add_task(async function test_load_start() {
|
|||
* Ensure that anchor navigation invalidates shistory.
|
||||
*/
|
||||
add_task(async function test_hashchange() {
|
||||
const URL = "data:text/html;charset=utf-8,<a id=a href=%23>clickme</a>";
|
||||
|
||||
const PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content/", "http://example.com/");
|
||||
const URL = PATH + "file_sessionHistory_hashchange.html";
|
||||
// Create a new tab.
|
||||
let tab = BrowserTestUtils.addTab(gBrowser, URL);
|
||||
let browser = tab.linkedBrowser;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<a href=#>clickme</a>
|
|
@ -0,0 +1 @@
|
|||
<a href=#>clickme</a>
|
|
@ -0,0 +1 @@
|
|||
<a id=a href=#>clickme</a>
|
Загрузка…
Ссылка в новой задаче