forked from mirrors/gecko-dev
Backed out 2 changesets (bug 1496082) for test_bug270414.html failures CLOSED TREE
Backed out changeset 74780d0a4848 (bug 1496082) Backed out changeset 4f87e383a807 (bug 1496082)
This commit is contained in:
parent
ac49075905
commit
98c46b95b5
56 changed files with 427 additions and 437 deletions
|
|
@ -14,11 +14,7 @@ obj*/**
|
||||||
# We ignore all these directories by default, until we get them enabled.
|
# We ignore all these directories by default, until we get them enabled.
|
||||||
# If you are enabling a directory, please add directory specific exclusions
|
# If you are enabling a directory, please add directory specific exclusions
|
||||||
# below.
|
# below.
|
||||||
docshell/resources/**
|
docshell/**
|
||||||
docshell/test/browser/**
|
|
||||||
docshell/test/chrome/**
|
|
||||||
docshell/test/iframesandbox/**
|
|
||||||
docshell/test/mochitest/**
|
|
||||||
extensions/cookie/**
|
extensions/cookie/**
|
||||||
extensions/spellcheck/**
|
extensions/spellcheck/**
|
||||||
extensions/universalchardet/**
|
extensions/universalchardet/**
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,5 @@ module.exports = {
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:mozilla/browser-test",
|
"plugin:mozilla/browser-test",
|
||||||
"plugin:mozilla/mochitest-test",
|
"plugin:mozilla/mochitest-test",
|
||||||
],
|
]
|
||||||
|
|
||||||
"plugins": [
|
|
||||||
"no-unsanitized",
|
|
||||||
],
|
|
||||||
|
|
||||||
"rules": {
|
|
||||||
"no-unsanitized/method": "off",
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,26 +2,26 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
// /////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Utilities for navigation tests
|
// Utilities for navigation tests
|
||||||
//
|
//
|
||||||
// /////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
var body = "This frame was navigated.";
|
var body = "This frame was navigated.";
|
||||||
var target_url = "navigation_target_url.html";
|
var target_url = "navigation_target_url.html"
|
||||||
|
|
||||||
var popup_body = "This is a popup";
|
var popup_body = "This is a popup";
|
||||||
var target_popup_url = "navigation_target_popup_url.html";
|
var target_popup_url = "navigation_target_popup_url.html";
|
||||||
|
|
||||||
// /////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Functions that navigate frames
|
// Functions that navigate frames
|
||||||
// /////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
function navigateByLocation(wnd) {
|
function navigateByLocation(wnd) {
|
||||||
try {
|
try {
|
||||||
wnd.location = target_url;
|
wnd.location = target_url;
|
||||||
} catch (ex) {
|
} catch(ex) {
|
||||||
// We need to keep our finished frames count consistent.
|
// We need to keep our finished frames count consistent.
|
||||||
// Oddly, this ends up simulating the behavior of IE7.
|
// Oddly, this ends up simulating the behavior of IE7.
|
||||||
window.open(target_url, "_blank", "width=10,height=10");
|
window.open(target_url, "_blank", "width=10,height=10");
|
||||||
|
|
@ -48,18 +48,18 @@ function navigateByHyperlink(name) {
|
||||||
link.target = name;
|
link.target = name;
|
||||||
link.id = "navigation_hyperlink_" + hyperlink_count++;
|
link.id = "navigation_hyperlink_" + hyperlink_count++;
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
sendMouseEvent({type: "click"}, link.id);
|
sendMouseEvent({type:"click"}, link.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Functions that call into Mochitest framework
|
// Functions that call into Mochitest framework
|
||||||
// /////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
function isNavigated(wnd, message) {
|
function isNavigated(wnd, message) {
|
||||||
var result = null;
|
var result = null;
|
||||||
try {
|
try {
|
||||||
result = SpecialPowers.wrap(wnd).document.body.innerHTML.trim();
|
result = SpecialPowers.wrap(wnd).document.body.innerHTML.trim();
|
||||||
} catch (ex) {
|
} catch(ex) {
|
||||||
result = ex;
|
result = ex;
|
||||||
}
|
}
|
||||||
is(result, body, message);
|
is(result, body, message);
|
||||||
|
|
@ -69,7 +69,7 @@ function isBlank(wnd, message) {
|
||||||
var result = null;
|
var result = null;
|
||||||
try {
|
try {
|
||||||
result = wnd.document.body.innerHTML.trim();
|
result = wnd.document.body.innerHTML.trim();
|
||||||
} catch (ex) {
|
} catch(ex) {
|
||||||
result = ex;
|
result = ex;
|
||||||
}
|
}
|
||||||
is(result, "This is a blank document.", message);
|
is(result, "This is a blank document.", message);
|
||||||
|
|
@ -79,7 +79,7 @@ function isAccessible(wnd, message) {
|
||||||
try {
|
try {
|
||||||
wnd.document.body.innerHTML;
|
wnd.document.body.innerHTML;
|
||||||
ok(true, message);
|
ok(true, message);
|
||||||
} catch (ex) {
|
} catch(ex) {
|
||||||
ok(false, message);
|
ok(false, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -88,19 +88,18 @@ function isInaccessible(wnd, message) {
|
||||||
try {
|
try {
|
||||||
wnd.document.body.innerHTML;
|
wnd.document.body.innerHTML;
|
||||||
ok(false, message);
|
ok(false, message);
|
||||||
} catch (ex) {
|
} catch(ex) {
|
||||||
ok(true, message);
|
ok(true, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// /////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Functions that require UniversalXPConnect privilege
|
// Functions that require UniversalXPConnect privilege
|
||||||
// /////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
/* eslint-disable mozilla/use-services */
|
|
||||||
function xpcEnumerateContentWindows(callback) {
|
function xpcEnumerateContentWindows(callback) {
|
||||||
|
|
||||||
var Ci = SpecialPowers.Ci;
|
var Ci = SpecialPowers.Ci;
|
||||||
// Replacing this with Services.ww format causes test errors, so ignore for now
|
|
||||||
var ww = SpecialPowers.Cc["@mozilla.org/embedcomp/window-watcher;1"]
|
var ww = SpecialPowers.Cc["@mozilla.org/embedcomp/window-watcher;1"]
|
||||||
.getService(Ci.nsIWindowWatcher);
|
.getService(Ci.nsIWindowWatcher);
|
||||||
|
|
||||||
|
|
@ -128,7 +127,6 @@ function xpcEnumerateContentWindows(callback) {
|
||||||
while (contentWindows.length > 0)
|
while (contentWindows.length > 0)
|
||||||
callback(contentWindows.pop());
|
callback(contentWindows.pop());
|
||||||
}
|
}
|
||||||
/* eslint-enable mozilla/use-services */
|
|
||||||
|
|
||||||
// Note: This only searches for top-level frames with this name.
|
// Note: This only searches for top-level frames with this name.
|
||||||
function xpcGetFramesByName(name) {
|
function xpcGetFramesByName(name) {
|
||||||
|
|
@ -180,10 +178,10 @@ function xpcWaitForFinishedFrames(callback, numFrames) {
|
||||||
function searchForFinishedFrames(win) {
|
function searchForFinishedFrames(win) {
|
||||||
if ((win.location.href.endsWith(target_url) ||
|
if ((win.location.href.endsWith(target_url) ||
|
||||||
win.location.href.endsWith(target_popup_url)) &&
|
win.location.href.endsWith(target_popup_url)) &&
|
||||||
win.document &&
|
win.document &&
|
||||||
win.document.body &&
|
win.document.body &&
|
||||||
(win.document.body.textContent.trim() == body ||
|
(win.document.body.textContent.trim() == body ||
|
||||||
win.document.body.textContent.trim() == popup_body) &&
|
win.document.body.textContent.trim() == popup_body) &&
|
||||||
win.document.readyState == "complete") {
|
win.document.readyState == "complete") {
|
||||||
|
|
||||||
var windowId = win.windowUtils.outerWindowID;
|
var windowId = win.windowUtils.outerWindowID;
|
||||||
|
|
@ -201,7 +199,7 @@ function xpcWaitForFinishedFrames(callback, numFrames) {
|
||||||
// This only gives us UniversalXPConnect for the current stack frame
|
// This only gives us UniversalXPConnect for the current stack frame
|
||||||
// We're using setInterval, so the main page's privileges are still normal
|
// We're using setInterval, so the main page's privileges are still normal
|
||||||
xpcEnumerateContentWindows(searchForFinishedFrames);
|
xpcEnumerateContentWindows(searchForFinishedFrames);
|
||||||
} catch (ex) {
|
} catch(ex) {
|
||||||
// We might be accessing windows before they are fully constructed,
|
// We might be accessing windows before they are fully constructed,
|
||||||
// which can throw. We'll find those frames on our next poll().
|
// which can throw. We'll find those frames on our next poll().
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<html><head>
|
<html><head>
|
||||||
<script> window.addEventListener("pageshow", function() { opener.nextTest(); }); </script>
|
<script> window.addEventListener("pageshow", function(){opener.nextTest();}, false); </script>
|
||||||
</head><body>
|
</head><body>
|
||||||
<div style="position:absolute; left:0px; top:0px; width:50%; height:150%; background-color:blue">
|
<div style="position:absolute; left:0px; top:0px; width:50%; height:150%; background-color:blue">
|
||||||
<p>This is a very tall blue box.</p>
|
<p>This is a very tall blue box.</p>
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,8 @@ function step3() {
|
||||||
Assert.equal(content.frames.length, 2, "Tab 2 should have 2 iframes");
|
Assert.equal(content.frames.length, 2, "Tab 2 should have 2 iframes");
|
||||||
for (var i = 0; i < content.frames.length; i++) {
|
for (var i = 0; i < content.frames.length; i++) {
|
||||||
info("step 3, frame " + i + " info: " + content.frames[i].location);
|
info("step 3, frame " + i + " info: " + content.frames[i].location);
|
||||||
let docShell = content.frames[i].docShell;
|
let docshell = content.frames[i].docShell;
|
||||||
|
|
||||||
Assert.ok(!docShell.isActive, `Tab2 iframe ${i} should be inactive`);
|
Assert.ok(!docShell.isActive, `Tab2 iframe ${i} should be inactive`);
|
||||||
}
|
}
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
|
@ -109,7 +110,6 @@ function step3() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function step4() {
|
function step4() {
|
||||||
/* eslint-disable no-shadow */
|
|
||||||
function checkTab2Active(expected) {
|
function checkTab2Active(expected) {
|
||||||
return ContentTask.spawn(ctx.tab2Browser, expected, async function(expected) {
|
return ContentTask.spawn(ctx.tab2Browser, expected, async function(expected) {
|
||||||
function isActive(aWindow) {
|
function isActive(aWindow) {
|
||||||
|
|
@ -128,7 +128,7 @@ function step4() {
|
||||||
Assert.equal(isActive(content.frames[1]), expected, `Tab2 iframe 1 should be ${active}`);
|
Assert.equal(isActive(content.frames[1]), expected, `Tab2 iframe 1 should be ${active}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/* eslint-enable no-shadow */
|
|
||||||
is(testPath + "bug343515_pg3.html", ctx.tab2Browser.currentURI.spec,
|
is(testPath + "bug343515_pg3.html", ctx.tab2Browser.currentURI.spec,
|
||||||
"Got expected tab 2 url in step 4");
|
"Got expected tab 2 url in step 4");
|
||||||
|
|
||||||
|
|
@ -161,7 +161,8 @@ function step5() {
|
||||||
ok(ctx.tab2Browser.docShellIsActive, "Tab 2 should be active");
|
ok(ctx.tab2Browser.docShellIsActive, "Tab 2 should be active");
|
||||||
ContentTask.spawn(ctx.tab2Browser, null, async function() {
|
ContentTask.spawn(ctx.tab2Browser, null, async function() {
|
||||||
for (var i = 0; i < content.frames.length; i++) {
|
for (var i = 0; i < content.frames.length; i++) {
|
||||||
let docShell = content.frames[i].docShell;
|
let docshell = content.frames[i].docShell;
|
||||||
|
|
||||||
Assert.ok(docShell.isActive, `Tab2 iframe ${i} should be active`);
|
Assert.ok(docShell.isActive, `Tab2 iframe ${i} should be active`);
|
||||||
}
|
}
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
|
@ -195,7 +196,8 @@ function step6() {
|
||||||
ok(!ctx.tab2Browser.docShellIsActive, "Tab 2 should be inactive");
|
ok(!ctx.tab2Browser.docShellIsActive, "Tab 2 should be inactive");
|
||||||
return ContentTask.spawn(ctx.tab2Browser, null, async function() {
|
return ContentTask.spawn(ctx.tab2Browser, null, async function() {
|
||||||
for (var i = 0; i < content.frames.length; i++) {
|
for (var i = 0; i < content.frames.length; i++) {
|
||||||
let docShell = content.frames[i].docShell;
|
let docshell = content.frames[i].docShell;
|
||||||
|
|
||||||
Assert.ok(!docShell.isActive, `Tab2 iframe ${i} should be inactive`);
|
Assert.ok(!docShell.isActive, `Tab2 iframe ${i} should be inactive`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -207,7 +209,6 @@ function step6() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function step7() {
|
function step7() {
|
||||||
/* eslint-disable no-shadow */
|
|
||||||
function checkBrowser(browser, tabNum, active) {
|
function checkBrowser(browser, tabNum, active) {
|
||||||
return ContentTask.spawn(browser, { tabNum, active },
|
return ContentTask.spawn(browser, { tabNum, active },
|
||||||
async function({ tabNum, active }) {
|
async function({ tabNum, active }) {
|
||||||
|
|
@ -225,7 +226,7 @@ function step7() {
|
||||||
`Tab${tabNum} iframe 1 should be ${activestr}`);
|
`Tab${tabNum} iframe 1 should be ${activestr}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/* eslint-enable no-shadow */
|
|
||||||
// Check everything
|
// Check everything
|
||||||
ok(!ctx.tab0Browser.docShellIsActive, "Tab 0 should be inactive");
|
ok(!ctx.tab0Browser.docShellIsActive, "Tab 0 should be inactive");
|
||||||
ok(ctx.tab1Browser.docShellIsActive, "Tab 1 should be active");
|
ok(ctx.tab1Browser.docShellIsActive, "Tab 1 should be active");
|
||||||
|
|
@ -238,7 +239,6 @@ function step7() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function allDone() {
|
function allDone() {
|
||||||
|
|
||||||
// Close the tabs we made
|
// Close the tabs we made
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,13 @@ add_task(async function() {
|
||||||
SpecialPowers.pushPrefEnv({
|
SpecialPowers.pushPrefEnv({
|
||||||
"set": [
|
"set": [
|
||||||
["browser.link.open_newwindow", 2],
|
["browser.link.open_newwindow", 2],
|
||||||
],
|
]
|
||||||
}, resolve);
|
}, resolve);
|
||||||
});
|
});
|
||||||
|
|
||||||
await BrowserTestUtils.withNewTab({
|
await BrowserTestUtils.withNewTab({
|
||||||
gBrowser,
|
gBrowser,
|
||||||
url: TEST_PAGE,
|
url: TEST_PAGE
|
||||||
}, async function(browser) {
|
}, async function(browser) {
|
||||||
let openedPromise = BrowserTestUtils.waitForNewWindow();
|
let openedPromise = BrowserTestUtils.waitForNewWindow();
|
||||||
BrowserTestUtils.synthesizeMouse("a", 0, 0, {}, browser);
|
BrowserTestUtils.synthesizeMouse("a", 0, 0, {}, browser);
|
||||||
|
|
|
||||||
|
|
@ -30,31 +30,31 @@
|
||||||
let shistory = webNav.sessionHistory;
|
let shistory = webNav.sessionHistory;
|
||||||
let testSteps = [
|
let testSteps = [
|
||||||
function() {
|
function() {
|
||||||
opener.is(shistory.count, 1, "check history length");
|
opener.is(shistory.count, 1, 'check history length');
|
||||||
opener.is(shistory.index, 0, "check history index");
|
opener.is(shistory.index, 0, 'check history index');
|
||||||
opener.ok(!webNav.canGoForward, "check canGoForward");
|
opener.ok(!webNav.canGoForward, 'check canGoForward');
|
||||||
setTimeout(() => window.location = "file_bug1300461_back.html", 0);
|
setTimeout(() => window.location = 'file_bug1300461_back.html', 0);
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
opener.is(shistory.count, 2, "check history length");
|
opener.is(shistory.count, 2, 'check history length');
|
||||||
opener.is(shistory.index, 0, "check history index");
|
opener.is(shistory.index, 0, 'check history index');
|
||||||
opener.ok(webNav.canGoForward, "check canGoForward");
|
opener.ok(webNav.canGoForward, 'check canGoForward');
|
||||||
window.history.forward();
|
window.history.forward();
|
||||||
opener.is(shistory.legacySHistory.requestedIndex, 1, "check requestedIndex");
|
opener.is(shistory.legacySHistory.requestedIndex, 1, 'check requestedIndex');
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
opener.is(shistory.count, 2, "check history length");
|
opener.is(shistory.count, 2, 'check history length');
|
||||||
opener.is(shistory.index, 0, "check history index");
|
opener.is(shistory.index, 0, 'check history index');
|
||||||
opener.ok(webNav.canGoForward, "check canGoForward");
|
opener.ok(webNav.canGoForward, 'check canGoForward');
|
||||||
opener.info("file_bug1300461.html tests finished");
|
opener.info('file_bug1300461.html tests finished');
|
||||||
opener.nextTest();
|
opener.nextTest();
|
||||||
window.close();
|
window.close();
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
if (opener) {
|
if (opener) {
|
||||||
opener.info("file_bug1300461.html test " + opener.testCount);
|
opener.info('file_bug1300461.html test ' + opener.testCount);
|
||||||
testSteps[opener.testCount++]();
|
testSteps[opener.testCount++]();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,13 @@
|
||||||
function test() {
|
function test() {
|
||||||
if (opener) {
|
if (opener) {
|
||||||
opener.info("file_bug1300461_back.html");
|
opener.info("file_bug1300461_back.html");
|
||||||
opener.is(shistory.count, 2, "check history length");
|
opener.is(shistory.count, 2, 'check history length');
|
||||||
opener.is(shistory.index, 1, "check history index");
|
opener.is(shistory.index, 1, 'check history index');
|
||||||
opener.is(shistory.legacySHistory.requestedIndex, -1, "check requestedIndex");
|
opener.is(shistory.legacySHistory.requestedIndex, -1, 'check requestedIndex');
|
||||||
opener.ok(webNav.canGoBack, "check canGoBack");
|
opener.ok(webNav.canGoBack, 'check canGoBack');
|
||||||
if (opener.testCount == 1) {
|
if (opener.testCount == 1) {
|
||||||
opener.info("replaceState to redirect.html");
|
opener.info('replaceState to redirect.html');
|
||||||
window.history.replaceState({}, "", "file_bug1300461_redirect.html");
|
window.history.replaceState({}, '', 'file_bug1300461_redirect.html');
|
||||||
}
|
}
|
||||||
window.history.back();
|
window.history.back();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Bug 1326251</title>
|
<title>Bug 1326251</title>
|
||||||
<script>
|
<script>
|
||||||
const BASE_URL = "http://mochi.test:8888/tests/docshell/test/navigation/";
|
const BASE_URL = 'http://mochi.test:8888/tests/docshell/test/navigation/';
|
||||||
let testSteps = [
|
let testSteps = [
|
||||||
async function() {
|
async function() {
|
||||||
// Test 1: Create dynamic iframe with bfcache enabled.
|
// Test 1: Create dynamic iframe with bfcache enabled.
|
||||||
|
|
@ -12,36 +12,36 @@
|
||||||
// and navigate back. Both iframes should still exist with history
|
// and navigate back. Both iframes should still exist with history
|
||||||
// entries preserved.
|
// entries preserved.
|
||||||
window.onunload = null; // enable bfcache
|
window.onunload = null; // enable bfcache
|
||||||
await createDynamicFrame(document);
|
let dynamicFrame = await createDynamicFrame(document);
|
||||||
await loadUriInFrame(document.getElementById("staticFrame"), "frame1.html");
|
await loadUriInFrame(document.getElementById('staticFrame'), 'frame1.html');
|
||||||
await loadUriInFrame(document.getElementById("dynamicFrame"), "frame1.html");
|
await loadUriInFrame(document.getElementById('dynamicFrame'), 'frame1.html');
|
||||||
await loadUriInFrame(document.getElementById("staticFrame"), "frame2.html");
|
await loadUriInFrame(document.getElementById('staticFrame'), 'frame2.html');
|
||||||
await loadUriInFrame(document.getElementById("dynamicFrame"), "frame2.html");
|
await loadUriInFrame(document.getElementById('dynamicFrame'), 'frame2.html');
|
||||||
opener.is(history.length, 5, "history.length");
|
opener.is(history.length, 5, 'history.length');
|
||||||
window.location = "goback.html";
|
window.location = 'goback.html';
|
||||||
},
|
},
|
||||||
async function() {
|
async function() {
|
||||||
let webNav = SpecialPowers.wrap(window)
|
let webNav = SpecialPowers.wrap(window)
|
||||||
.docShell
|
.docShell
|
||||||
.QueryInterface(SpecialPowers.Ci.nsIWebNavigation);
|
.QueryInterface(SpecialPowers.Ci.nsIWebNavigation);
|
||||||
let shistory = webNav.sessionHistory;
|
let shistory = webNav.sessionHistory;
|
||||||
opener.is(webNav.canGoForward, true, "canGoForward");
|
opener.is(webNav.canGoForward, true, 'canGoForward');
|
||||||
opener.is(shistory.index, 4, "shistory.index");
|
opener.is(shistory.index, 4, 'shistory.index');
|
||||||
opener.is(history.length, 6, "history.length");
|
opener.is(history.length, 6, 'history.length');
|
||||||
opener.is(document.getElementById("staticFrame").contentWindow.location.href, BASE_URL + "frame2.html", "staticFrame location");
|
opener.is(document.getElementById('staticFrame').contentWindow.location.href, BASE_URL + 'frame2.html', 'staticFrame location');
|
||||||
opener.is(document.getElementById("dynamicFrame").contentWindow.location.href, BASE_URL + "frame2.html", "dynamicFrame location");
|
opener.is(document.getElementById('dynamicFrame').contentWindow.location.href, BASE_URL + 'frame2.html', 'dynamicFrame location');
|
||||||
|
|
||||||
// Test 2: Load another page in dynamic iframe, canGoForward should be
|
// Test 2: Load another page in dynamic iframe, canGoForward should be
|
||||||
// false.
|
// false.
|
||||||
await loadUriInFrame(document.getElementById("dynamicFrame"), "frame3.html");
|
await loadUriInFrame(document.getElementById('dynamicFrame'), 'frame3.html');
|
||||||
opener.is(webNav.canGoForward, false, "canGoForward");
|
opener.is(webNav.canGoForward, false, 'canGoForward');
|
||||||
opener.is(shistory.index, 5, "shistory.index");
|
opener.is(shistory.index, 5, 'shistory.index');
|
||||||
opener.is(history.length, 6, "history.length");
|
opener.is(history.length, 6, 'history.length');
|
||||||
|
|
||||||
// Test 3: Navigate to antoher page with bfcache disabled, all dynamic
|
// Test 3: Navigate to antoher page with bfcache disabled, all dynamic
|
||||||
// iframe entries should be removed.
|
// iframe entries should be removed.
|
||||||
window.onunload = function() {}; // disable bfcache
|
window.onunload = function(){}; // disable bfcache
|
||||||
window.location = "goback.html";
|
window.location = 'goback.html';
|
||||||
},
|
},
|
||||||
async function() {
|
async function() {
|
||||||
let windowWrap = SpecialPowers.wrap(window);
|
let windowWrap = SpecialPowers.wrap(window);
|
||||||
|
|
@ -49,58 +49,58 @@
|
||||||
let shistory = docShell.QueryInterface(SpecialPowers.Ci.nsIWebNavigation)
|
let shistory = docShell.QueryInterface(SpecialPowers.Ci.nsIWebNavigation)
|
||||||
.sessionHistory;
|
.sessionHistory;
|
||||||
// Now staticFrame has frame0 -> frame1 -> frame2.
|
// Now staticFrame has frame0 -> frame1 -> frame2.
|
||||||
opener.is(docShell.previousEntryIndex, 3, "docShell.previousEntryIndex");
|
opener.is(docShell.previousEntryIndex, 3, 'docShell.previousEntryIndex');
|
||||||
opener.is(docShell.loadedEntryIndex, 2, "docShell.loadedEntryIndex");
|
opener.is(docShell.loadedEntryIndex, 2, 'docShell.loadedEntryIndex');
|
||||||
opener.is(shistory.index, 2, "shistory.index");
|
opener.is(shistory.index, 2, 'shistory.index');
|
||||||
opener.is(history.length, 4, "history.length");
|
opener.is(history.length, 4, 'history.length');
|
||||||
opener.is(document.getElementById("staticFrame").contentWindow.location.href, BASE_URL + "frame2.html", "staticFrame location");
|
opener.is(document.getElementById('staticFrame').contentWindow.location.href, BASE_URL + 'frame2.html', 'staticFrame location');
|
||||||
opener.ok(!document.getElementById("dynamicFrame"), "dynamicFrame should not exist");
|
opener.ok(!document.getElementById('dynamicFrame'), 'dynamicFrame should not exist');
|
||||||
|
|
||||||
// Test 4: Load a nested frame in the static frame, navigate the inner
|
// Test 4: Load a nested frame in the static frame, navigate the inner
|
||||||
// static frame, add a inner dynamic frame and navigate the dynamic
|
// static frame, add a inner dynamic frame and navigate the dynamic
|
||||||
// frame. Then navigate the outer static frame and go back. The inner
|
// frame. Then navigate the outer static frame and go back. The inner
|
||||||
// iframe should show the last entry of inner static frame.
|
// iframe should show the last entry of inner static frame.
|
||||||
let staticFrame = document.getElementById("staticFrame");
|
let staticFrame = document.getElementById('staticFrame');
|
||||||
staticFrame.width = "320px";
|
staticFrame.width = '320px';
|
||||||
staticFrame.height = "360px";
|
staticFrame.height = '360px';
|
||||||
await loadUriInFrame(staticFrame, "iframe_static.html");
|
await loadUriInFrame(staticFrame, 'iframe_static.html');
|
||||||
let innerStaticFrame = staticFrame.contentDocument.getElementById("staticFrame");
|
let innerStaticFrame = staticFrame.contentDocument.getElementById('staticFrame');
|
||||||
await loadUriInFrame(innerStaticFrame, "frame1.html");
|
await loadUriInFrame(innerStaticFrame, 'frame1.html');
|
||||||
let innerDynamicFrame = await createDynamicFrame(staticFrame.contentDocument, "frame2.html");
|
let innerDynamicFrame = await createDynamicFrame(staticFrame.contentDocument, 'frame2.html');
|
||||||
await loadUriInFrame(innerDynamicFrame, "frame3.html");
|
await loadUriInFrame(innerDynamicFrame, 'frame3.html');
|
||||||
// staticFrame: frame0 -> frame1 -> frame2 -> iframe_static
|
// staticFrame: frame0 -> frame1 -> frame2 -> iframe_static
|
||||||
// innerStaticFrame: frame0 -> frame1
|
// innerStaticFrame: frame0 -> frame1
|
||||||
// innerDynamicFrame: frame2 -> frame3
|
// innerDynamicFrame: frame2 -> frame3
|
||||||
opener.is(shistory.index, 5, "shistory.index");
|
opener.is(shistory.index, 5, 'shistory.index');
|
||||||
opener.is(history.length, 6, "history.length");
|
opener.is(history.length, 6, 'history.length');
|
||||||
|
|
||||||
// Wait for 2 load events - navigation and goback.
|
// Wait for 2 load events - navigation and goback.
|
||||||
let onloadPromise = awaitOnload(staticFrame, 2);
|
let onloadPromise = awaitOnload(staticFrame, 2);
|
||||||
await loadUriInFrame(staticFrame, "goback.html");
|
await loadUriInFrame(staticFrame, 'goback.html');
|
||||||
await onloadPromise;
|
await onloadPromise;
|
||||||
// staticFrame: frame0 -> frame1 -> frame2 -> iframe_static -> goback
|
// staticFrame: frame0 -> frame1 -> frame2 -> iframe_static -> goback
|
||||||
// innerStaticFrame: frame0 -> frame1
|
// innerStaticFrame: frame0 -> frame1
|
||||||
opener.is(shistory.index, 4, "shistory.index");
|
opener.is(shistory.index, 4, 'shistory.index');
|
||||||
opener.is(history.length, 6, "history.length");
|
opener.is(history.length, 6, 'history.length');
|
||||||
innerStaticFrame = staticFrame.contentDocument.getElementById("staticFrame");
|
innerStaticFrame = staticFrame.contentDocument.getElementById('staticFrame');
|
||||||
opener.is(innerStaticFrame.contentDocument.location.href, BASE_URL + "frame1.html", "innerStaticFrame location");
|
opener.is(innerStaticFrame.contentDocument.location.href, BASE_URL + 'frame1.html', 'innerStaticFrame location');
|
||||||
opener.ok(!staticFrame.contentDocument.getElementById("dynamicFrame"), "innerDynamicFrame should not exist");
|
opener.ok(!staticFrame.contentDocument.getElementById('dynamicFrame'), 'innerDynamicFrame should not exist');
|
||||||
|
|
||||||
// Test 5: Insert and navigate inner dynamic frame again with bfcache
|
// Test 5: Insert and navigate inner dynamic frame again with bfcache
|
||||||
// enabled, and navigate top level window to a special page which will
|
// enabled, and navigate top level window to a special page which will
|
||||||
// evict bfcache then goback. Verify that dynamic entries are correctly
|
// evict bfcache then goback. Verify that dynamic entries are correctly
|
||||||
// removed in this case.
|
// removed in this case.
|
||||||
window.onunload = null; // enable bfcache
|
window.onunload = null; // enable bfcache
|
||||||
staticFrame.width = "320px";
|
staticFrame.width = '320px';
|
||||||
staticFrame.height = "360px";
|
staticFrame.height = '360px';
|
||||||
innerDynamicFrame = await createDynamicFrame(staticFrame.contentDocument, "frame2.html");
|
innerDynamicFrame = await createDynamicFrame(staticFrame.contentDocument, 'frame2.html');
|
||||||
await loadUriInFrame(innerDynamicFrame, "frame3.html");
|
await loadUriInFrame(innerDynamicFrame, 'frame3.html');
|
||||||
// staticFrame: frame0 -> frame1 -> frame2 -> iframe_static
|
// staticFrame: frame0 -> frame1 -> frame2 -> iframe_static
|
||||||
// innerStaticFrame: frame0 -> frame1
|
// innerStaticFrame: frame0 -> frame1
|
||||||
// innerDynamicFrame: frame2 -> frame3
|
// innerDynamicFrame: frame2 -> frame3
|
||||||
opener.is(shistory.index, 5, "shistory.index");
|
opener.is(shistory.index, 5, 'shistory.index');
|
||||||
opener.is(history.length, 6, "history.length");
|
opener.is(history.length, 6, 'history.length');
|
||||||
window.location = "file_bug1326251_evict_cache.html";
|
window.location = 'file_bug1326251_evict_cache.html';
|
||||||
},
|
},
|
||||||
async function() {
|
async function() {
|
||||||
let windowWrap = SpecialPowers.wrap(window);
|
let windowWrap = SpecialPowers.wrap(window);
|
||||||
|
|
@ -109,26 +109,26 @@
|
||||||
.sessionHistory;
|
.sessionHistory;
|
||||||
// staticFrame: frame0 -> frame1 -> frame2 -> iframe_static
|
// staticFrame: frame0 -> frame1 -> frame2 -> iframe_static
|
||||||
// innerStaticFrame: frame0 -> frame1
|
// innerStaticFrame: frame0 -> frame1
|
||||||
opener.is(docShell.previousEntryIndex, 5, "docShell.previousEntryIndex");
|
opener.is(docShell.previousEntryIndex, 5, 'docShell.previousEntryIndex');
|
||||||
opener.is(docShell.loadedEntryIndex, 4, "docShell.loadedEntryIndex");
|
opener.is(docShell.loadedEntryIndex, 4, 'docShell.loadedEntryIndex');
|
||||||
opener.is(shistory.index, 4, "shistory.index");
|
opener.is(shistory.index, 4, 'shistory.index');
|
||||||
opener.is(history.length, 6, "history.length");
|
opener.is(history.length, 6, 'history.length');
|
||||||
let staticFrame = document.getElementById("staticFrame");
|
let staticFrame = document.getElementById('staticFrame');
|
||||||
let innerStaticFrame = staticFrame.contentDocument.getElementById("staticFrame");
|
let innerStaticFrame = staticFrame.contentDocument.getElementById('staticFrame');
|
||||||
opener.is(innerStaticFrame.contentDocument.location.href, BASE_URL + "frame1.html", "innerStaticFrame location");
|
opener.is(innerStaticFrame.contentDocument.location.href, BASE_URL + 'frame1.html', 'innerStaticFrame location');
|
||||||
opener.ok(!staticFrame.contentDocument.getElementById("dynamicFrame"), "innerDynamicFrame should not exist");
|
opener.ok(!staticFrame.contentDocument.getElementById('dynamicFrame'), 'innerDynamicFrame should not exist');
|
||||||
|
|
||||||
// Test 6: Insert and navigate inner dynamic frame and then reload outer
|
// Test 6: Insert and navigate inner dynamic frame and then reload outer
|
||||||
// frame. Verify that inner dynamic frame entries are all removed.
|
// frame. Verify that inner dynamic frame entries are all removed.
|
||||||
staticFrame.width = "320px";
|
staticFrame.width = '320px';
|
||||||
staticFrame.height = "360px";
|
staticFrame.height = '360px';
|
||||||
let innerDynamicFrame = await createDynamicFrame(staticFrame.contentDocument, "frame2.html");
|
let innerDynamicFrame = await createDynamicFrame(staticFrame.contentDocument, 'frame2.html');
|
||||||
await loadUriInFrame(innerDynamicFrame, "frame3.html");
|
await loadUriInFrame(innerDynamicFrame, 'frame3.html');
|
||||||
// staticFrame: frame0 -> frame1 -> frame2 -> iframe_static
|
// staticFrame: frame0 -> frame1 -> frame2 -> iframe_static
|
||||||
// innerStaticFrame: frame0 -> frame1
|
// innerStaticFrame: frame0 -> frame1
|
||||||
// innerDynamicFrame: frame2 -> frame3
|
// innerDynamicFrame: frame2 -> frame3
|
||||||
opener.is(shistory.index, 5, "shistory.index");
|
opener.is(shistory.index, 5, 'shistory.index');
|
||||||
opener.is(history.length, 6, "history.length");
|
opener.is(history.length, 6, 'history.length');
|
||||||
let staticFrameLoadPromise = new Promise(resolve => {
|
let staticFrameLoadPromise = new Promise(resolve => {
|
||||||
staticFrame.onload = resolve;
|
staticFrame.onload = resolve;
|
||||||
});
|
});
|
||||||
|
|
@ -136,34 +136,34 @@
|
||||||
await staticFrameLoadPromise;
|
await staticFrameLoadPromise;
|
||||||
// staticFrame: frame0 -> frame1 -> frame2 -> iframe_static
|
// staticFrame: frame0 -> frame1 -> frame2 -> iframe_static
|
||||||
// innerStaticFrame: frame0 -> frame1
|
// innerStaticFrame: frame0 -> frame1
|
||||||
opener.is(shistory.index, 4, "shistory.index");
|
opener.is(shistory.index, 4, 'shistory.index');
|
||||||
opener.is(history.length, 5, "history.length");
|
opener.is(history.length, 5, 'history.length');
|
||||||
innerStaticFrame = staticFrame.contentDocument.getElementById("staticFrame");
|
innerStaticFrame = staticFrame.contentDocument.getElementById('staticFrame');
|
||||||
opener.is(innerStaticFrame.contentDocument.location.href, BASE_URL + "frame1.html", "innerStaticFrame location");
|
opener.is(innerStaticFrame.contentDocument.location.href, BASE_URL + 'frame1.html', 'innerStaticFrame location');
|
||||||
opener.ok(!staticFrame.contentDocument.getElementById("dynamicFrame"), "innerDynamicFrame should not exist");
|
opener.ok(!staticFrame.contentDocument.getElementById('dynamicFrame'), 'innerDynamicFrame should not exist');
|
||||||
opener.nextTest();
|
opener.nextTest();
|
||||||
window.close();
|
window.close();
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
function awaitOnload(frame, occurances = 1) {
|
function awaitOnload(frame, occurances=1) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
frame.addEventListener("load", function listener(e) {
|
frame.addEventListener('load', function listener(e) {
|
||||||
if (++count == occurances) {
|
if (++count == occurances) {
|
||||||
frame.removeEventListener("load", listener);
|
frame.removeEventListener('load', listener);
|
||||||
setTimeout(resolve, 0);
|
setTimeout(resolve, 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createDynamicFrame(targetDocument, frameSrc = "frame0.html") {
|
async function createDynamicFrame(targetDocument, frameSrc='frame0.html') {
|
||||||
let dynamicFrame = targetDocument.createElement("iframe");
|
let dynamicFrame = targetDocument.createElement('iframe');
|
||||||
let onloadPromise = awaitOnload(dynamicFrame);
|
let onloadPromise = awaitOnload(dynamicFrame);
|
||||||
dynamicFrame.id = "dynamicFrame";
|
dynamicFrame.id = 'dynamicFrame';
|
||||||
dynamicFrame.src = frameSrc;
|
dynamicFrame.src = frameSrc;
|
||||||
let container = targetDocument.getElementById("frameContainer");
|
let container = targetDocument.getElementById('frameContainer');
|
||||||
container.appendChild(dynamicFrame);
|
container.appendChild(dynamicFrame);
|
||||||
await onloadPromise;
|
await onloadPromise;
|
||||||
return dynamicFrame;
|
return dynamicFrame;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
iframe.onload = function() {
|
iframe.onload = function() {
|
||||||
opener.postMessage(iframe.contentWindow.location.href, "*");
|
opener.postMessage(iframe.contentWindow.location.href, "*");
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@
|
||||||
++opener.testCount;
|
++opener.testCount;
|
||||||
if (opener.testCount == 1) {
|
if (opener.testCount == 1) {
|
||||||
// Navigate forward and then back.
|
// Navigate forward and then back.
|
||||||
// eslint-disable-next-line no-global-assign
|
|
||||||
setTimeout(function() { location = "goback.html"; }, 0);
|
setTimeout(function() { location = "goback.html"; }, 0);
|
||||||
} else if (opener.testCount == 2) {
|
} else if (opener.testCount == 2) {
|
||||||
// Do this async so our load event gets a chance to fire if it plans to
|
// Do this async so our load event gets a chance to fire if it plans to
|
||||||
|
|
@ -28,6 +27,6 @@
|
||||||
onload = function() {
|
onload = function() {
|
||||||
++loadCount;
|
++loadCount;
|
||||||
opener.is(loadCount, 1, "Should only get one onload");
|
opener.is(loadCount, 1, "Should only get one onload");
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@
|
||||||
var data = document.querySelector("script[type='text/just-data']").textContent;
|
var data = document.querySelector("script[type='text/just-data']").textContent;
|
||||||
// Store the string that does all out work in a global variable, so we can
|
// Store the string that does all out work in a global variable, so we can
|
||||||
// get at it later.
|
// get at it later.
|
||||||
// eslint-disable-next-line no-useless-concat
|
|
||||||
var testScript = "<script>" + data + "</" + "script>";
|
var testScript = "<script>" + data + "</" + "script>";
|
||||||
document.write(testScript);
|
document.write(testScript);
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
<html><head><meta charset="utf-8"><script>window.addEventListener("pageshow", function(event) { window.opener.postMessage({persisted: event.persisted}, "*"); });</script></head><body contentEditable="true"><p>contentEditable</p></body></html>
|
<html><head><meta charset="utf-8"><script>window.addEventListener("pageshow", function(event) { window.opener.postMessage({persisted:event.persisted}, "*"); });</script></head><body contentEditable="true"><p>contentEditable</p></body></html>
|
||||||
|
|
@ -1 +1 @@
|
||||||
<html><head><meta charset="utf-8"><script>window.addEventListener("pageshow", function(event) { window.opener.postMessage({persisted: event.persisted}, "*"); });</script></head><body><p>designModeDocument</p></body></html>
|
<html><head><meta charset="utf-8"><script>window.addEventListener("pageshow", function(event) { window.opener.postMessage({persisted:event.persisted}, "*"); });</script></head><body><p>designModeDocument</p></body></html>
|
||||||
|
|
@ -21,15 +21,15 @@
|
||||||
for (var i = randomNumber; i < 4; ++i) {
|
for (var i = randomNumber; i < 4; ++i) {
|
||||||
makeFrame(i);
|
makeFrame(i);
|
||||||
}
|
}
|
||||||
for (var k = 0; k < randomNumber; ++k) {
|
for (var i = 0; i < randomNumber; ++i) {
|
||||||
makeFrame(k);
|
makeFrame(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkFrame(evt) {
|
function checkFrame(evt) {
|
||||||
var ifr = evt.target;
|
var ifr = evt.target;
|
||||||
opener.ok(String(ifr.contentWindow.location).includes(ifr.src),
|
opener.ok(new String(ifr.contentWindow.location).includes(ifr.src),
|
||||||
"Wrong document loaded (" + ifr.src + ", " +
|
"Wrong document loaded (" + ifr.src + ", " +
|
||||||
ifr.contentWindow.location + ")!");
|
ifr.contentWindow.location + ")!");
|
||||||
|
|
||||||
if (++checkCount == 4) {
|
if (++checkCount == 4) {
|
||||||
|
|
|
||||||
|
|
@ -21,15 +21,15 @@
|
||||||
for (var i = randomNumber; i < 4; ++i) {
|
for (var i = randomNumber; i < 4; ++i) {
|
||||||
makeFrame(i);
|
makeFrame(i);
|
||||||
}
|
}
|
||||||
for (var k = 0; k < randomNumber; ++k) {
|
for (var i = 0; i < randomNumber; ++i) {
|
||||||
makeFrame(k);
|
makeFrame(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkFrame(evt) {
|
function checkFrame(evt) {
|
||||||
var ifr = evt.target;
|
var ifr = evt.target;
|
||||||
opener.ok(String(ifr.contentWindow.location).includes(ifr.src),
|
opener.ok(new String(ifr.contentWindow.location).includes(ifr.src),
|
||||||
"Wrong document loaded (" + ifr.src + ", " +
|
"Wrong document loaded (" + ifr.src + ", " +
|
||||||
ifr.contentWindow.location + ")!");
|
ifr.contentWindow.location + ")!");
|
||||||
|
|
||||||
if (++checkCount == 4) {
|
if (++checkCount == 4) {
|
||||||
|
|
|
||||||
|
|
@ -21,15 +21,15 @@
|
||||||
for (var i = randomNumber; i < 4; ++i) {
|
for (var i = randomNumber; i < 4; ++i) {
|
||||||
makeFrame(i);
|
makeFrame(i);
|
||||||
}
|
}
|
||||||
for (var k = 0; k < randomNumber; ++k) {
|
for (var i = 0; i < randomNumber; ++i) {
|
||||||
makeFrame(k);
|
makeFrame(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkFrame(evt) {
|
function checkFrame(evt) {
|
||||||
var ifr = evt.target;
|
var ifr = evt.target;
|
||||||
opener.ok(String(ifr.contentWindow.location).includes(ifr.src),
|
opener.ok(new String(ifr.contentWindow.location).includes(ifr.src),
|
||||||
"Wrong document loaded (" + ifr.src + ", " +
|
"Wrong document loaded (" + ifr.src + ", " +
|
||||||
ifr.contentWindow.location + ")!");
|
ifr.contentWindow.location + ")!");
|
||||||
|
|
||||||
if (++checkCount == 4) {
|
if (++checkCount == 4) {
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
<script>
|
<script>
|
||||||
function dynFrameLoad() {
|
function dynFrameLoad() {
|
||||||
var ifrs = document.getElementsByTagName("iframe");
|
var ifrs = document.getElementsByTagName("iframe");
|
||||||
opener.ok(String(ifrs[0].contentWindow.location).includes(ifrs[0].src),
|
opener.ok(new String(ifrs[0].contentWindow.location).includes(ifrs[0].src),
|
||||||
"Wrong document loaded (1)\n");
|
"Wrong document loaded (1)\n");
|
||||||
opener.ok(String(ifrs[1].contentWindow.location).includes(ifrs[1].src),
|
opener.ok(new String(ifrs[1].contentWindow.location).includes(ifrs[1].src),
|
||||||
"Wrong document loaded (2)\n");
|
"Wrong document loaded (2)\n");
|
||||||
if (opener && ++opener.testCount == 1) {
|
if (opener && ++opener.testCount == 1) {
|
||||||
window.location = "goback.html";
|
window.location = "goback.html";
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("load",
|
window.addEventListener("load",
|
||||||
function() {
|
function () {
|
||||||
var container = document.getElementById("t1");
|
var container = document.getElementById("t1");
|
||||||
container.addEventListener("load", dynFrameLoad, true);
|
container.addEventListener("load", dynFrameLoad, true);
|
||||||
container.appendChild(container.appendChild(document.getElementById("i1")));
|
container.appendChild(container.appendChild(document.getElementById("i1")));
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
var isOK = false;
|
var isOK = false;
|
||||||
try {
|
try {
|
||||||
isOK = history.previous != location;
|
isOK = history.previous != location;
|
||||||
} catch (ex) {
|
} catch(ex) {
|
||||||
// history.previous should throw if this is the first page in shistory.
|
// history.previous should throw if this is the first page in shistory.
|
||||||
isOK = true;
|
isOK = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
opener.isnot(Math.round(window.scrollY), 0, "Should have restored scrolling.");
|
opener.isnot(Math.round(window.scrollY), 0, "Should have restored scrolling.");
|
||||||
opener.is(history.scrollRestoration, "auto", "Should have the same scrollRestoration as before reload.");
|
opener.is(history.scrollRestoration, "auto", "Should have the same scrollRestoration as before reload.");
|
||||||
history.scrollRestoration = "manual";
|
history.scrollRestoration = "manual";
|
||||||
window.onunload = function() {}; // Disable bfcache.
|
window.onunload = function() {} // Disable bfcache.
|
||||||
window.location.reload(false);
|
window.location.reload(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
document.getElementById("bottom").scrollIntoView();
|
document.getElementById("bottom").scrollIntoView();
|
||||||
window.onunload = null; // Should get bfcache behavior.
|
window.onunload = null; // Should get bfcache behavior.
|
||||||
opener.setTimeout("SpecialPowers.wrap(testWindow).history.back();", 250);
|
opener.setTimeout("SpecialPowers.wrap(testWindow).history.back();", 250);
|
||||||
window.location.href = "about:blank";
|
window.location.href = 'about:blank';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
|
|
@ -55,9 +55,9 @@
|
||||||
case 5: {
|
case 5: {
|
||||||
opener.isnot(Math.round(window.scrollY), 0, "Should have scrolled to #hash.");
|
opener.isnot(Math.round(window.scrollY), 0, "Should have scrolled to #hash.");
|
||||||
opener.is(history.scrollRestoration, "manual", "Should have the same scrollRestoration mode as before fragment navigation.");
|
opener.is(history.scrollRestoration, "manual", "Should have the same scrollRestoration mode as before fragment navigation.");
|
||||||
window.onunload = function() {}; // Disable bfcache.
|
window.onunload = function() {} // Disable bfcache.
|
||||||
opener.setTimeout("is(SpecialPowers.wrap(testWindow).history.scrollRestoration, 'auto'); SpecialPowers.wrap(testWindow).history.back();", 250);
|
opener.setTimeout("is(SpecialPowers.wrap(testWindow).history.scrollRestoration, 'auto'); SpecialPowers.wrap(testWindow).history.back();", 250);
|
||||||
window.location.href = "about:blank";
|
window.location.href = 'about:blank';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 6: {
|
case 6: {
|
||||||
|
|
@ -104,15 +104,15 @@
|
||||||
}
|
}
|
||||||
case 8: {
|
case 8: {
|
||||||
try {
|
try {
|
||||||
oldHistoryObject.scrollRestoration;
|
var sr = oldHistoryObject.scrollRestoration;
|
||||||
opener.ok(false, "Should have thrown an exception.");
|
opener.ok(false, "Should have thrown an exception.");
|
||||||
} catch (ex) {
|
} catch(ex) {
|
||||||
opener.isnot(ex, null, "Did get an exception");
|
opener.isnot(ex, null, "Did get an exception");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
oldHistoryObject.scrollRestoration = "auto";
|
oldHistoryObject.scrollRestoration = "auto";
|
||||||
opener.ok(false, "Should have thrown an exception.");
|
opener.ok(false, "Should have thrown an exception.");
|
||||||
} catch (ex) {
|
} catch(ex) {
|
||||||
opener.isnot(ex, null, "Did get an exception");
|
opener.isnot(ex, null, "Did get an exception");
|
||||||
}
|
}
|
||||||
opener.nextTest();
|
opener.nextTest();
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
function test() {
|
function test() {
|
||||||
try {
|
try {
|
||||||
frames[0].history.pushState({}, "state", "?pushed");
|
frames[0].history.pushState({}, "state", "?pushed");
|
||||||
} catch (ex) {
|
} catch(ex) {
|
||||||
opener.ok(false, "history.pushState shouldn't throw");
|
opener.ok(false, "history.pushState shouldn't throw");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
test();
|
test();
|
||||||
} else {
|
} else {
|
||||||
var staticFrame = document.getElementById("staticframe");
|
var staticFrame = document.getElementById("staticframe");
|
||||||
opener.ok(String(staticFrame.contentWindow.location).includes(staticFrame.src),
|
opener.ok(new String(staticFrame.contentWindow.location).includes(staticFrame.src),
|
||||||
"Wrong document loaded!");
|
"Wrong document loaded!");
|
||||||
opener.nextTest();
|
opener.nextTest();
|
||||||
window.close();
|
window.close();
|
||||||
|
|
|
||||||
|
|
@ -8,18 +8,18 @@
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
// make sure to set document.domain to the same domain as the subframe
|
// make sure to set document.domain to the same domain as the subframe
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
document.domain = "mochi.test";
|
document.domain = 'mochi.test';
|
||||||
};
|
};
|
||||||
window.addEventListener("message", receiveMessage);
|
window.addEventListener('message', receiveMessage);
|
||||||
function receiveMessage(event) {
|
function receiveMessage(event) {
|
||||||
// make sure to get the right start command, otherwise
|
// make sure to get the right start command, otherwise
|
||||||
// let the parent know and fail the test
|
// let the parent know and fail the test
|
||||||
if (event.data.start !== "startTest") {
|
if (event.data.start !== 'startTest') {
|
||||||
window.removeEventListener("message", receiveMessage);
|
window.removeEventListener("message", receiveMessage);
|
||||||
window.parent.postMessage({triggeringPrincipalURI: "false"}, "*");
|
window.parent.postMessage({triggeringPrincipalURI: 'false'}, '*');
|
||||||
}
|
}
|
||||||
// click the link to navigate the subframe
|
// click the link to navigate the subframe
|
||||||
document.getElementById("testlink").click();
|
document.getElementById('testlink').click();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@
|
||||||
<script type='application/javascript'>
|
<script type='application/javascript'>
|
||||||
// make sure to set document.domain to same domain as frame 1
|
// make sure to set document.domain to same domain as frame 1
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
document.domain = "mochi.test";
|
document.domain = 'mochi.test';
|
||||||
// let Frame 1 know that we are ready to run the test
|
// let Frame 1 know that we are ready to run the test
|
||||||
window.parent.parent.frames[0].postMessage({start: "startTest"}, "*");
|
window.parent.parent.frames[0].postMessage({start: 'startTest'}, '*');
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -6,15 +6,15 @@
|
||||||
|
|
||||||
<script type='application/javascript'>
|
<script type='application/javascript'>
|
||||||
function checkResults() {
|
function checkResults() {
|
||||||
// query the uri of the loadingPrincipal and the TriggeringPrincipal and pass
|
// query the uri of the loadingPrincipal and the TriggeringPrincipal and pass
|
||||||
// that information on to the parent for verification.
|
// that information on to the parent for verification.
|
||||||
var channel = SpecialPowers.wrap(window).docShell.currentDocumentChannel;
|
var channel = SpecialPowers.wrap(window).docShell.currentDocumentChannel;
|
||||||
var triggeringPrincipalURI = channel.loadInfo.triggeringPrincipal.URI.asciiSpec;
|
var triggeringPrincipalURI = channel.loadInfo.triggeringPrincipal.URI.asciiSpec;
|
||||||
var loadingPrincipalURI = channel.loadInfo.loadingPrincipal.URI.asciiSpec;
|
var loadingPrincipalURI = channel.loadInfo.loadingPrincipal.URI.asciiSpec;
|
||||||
var referrerURI = document.referrer;
|
var referrerURI = document.referrer;
|
||||||
window.parent.parent.postMessage({triggeringPrincipalURI,
|
window.parent.parent.postMessage({triggeringPrincipalURI,
|
||||||
loadingPrincipalURI,
|
loadingPrincipalURI,
|
||||||
referrerURI}, "*");
|
referrerURI}, '*');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,12 @@
|
||||||
<script src="NavigationUtils.js"></script>
|
<script src="NavigationUtils.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function navigate() {
|
function navigate() {
|
||||||
var args = window.location.hash.substring(1).split(",");
|
var arguments = window.location.hash.substring(1).split(",");
|
||||||
var target = args[0];
|
var target = arguments[0];
|
||||||
var mechanism = args[1];
|
var mechanism = arguments[1];
|
||||||
|
|
||||||
switch (mechanism) {
|
switch(mechanism) {
|
||||||
case "location":
|
case "location":
|
||||||
// eslint-disable-next-line no-eval
|
|
||||||
navigateByLocation(eval(target));
|
navigateByLocation(eval(target));
|
||||||
break;
|
break;
|
||||||
case "open":
|
case "open":
|
||||||
|
|
@ -28,9 +27,9 @@
|
||||||
</head>
|
</head>
|
||||||
<body onload="navigate();">
|
<body onload="navigate();">
|
||||||
<script>
|
<script>
|
||||||
var args = window.location.hash.substring(1).split(",");
|
var arguments = window.location.hash.substring(1).split(",");
|
||||||
var target = args[0];
|
var target = arguments[0];
|
||||||
var mechanism = args[1];
|
var mechanism = arguments[1];
|
||||||
document.write("target=" + target + " mechanism=" + mechanism);
|
document.write("target=" + target + " mechanism=" + mechanism);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<html><head>
|
<html><head>
|
||||||
<script> window.addEventListener("pageshow", function() { opener.nextTest(); }); </script>
|
<script> window.addEventListener("pageshow", function(){opener.nextTest();}, false); </script>
|
||||||
</head><body>
|
</head><body>
|
||||||
<div style="position:absolute; left:0px; top:0px; width:50%; height:150%; background-color:red">
|
<div style="position:absolute; left:0px; top:0px; width:50%; height:150%; background-color:red">
|
||||||
<p>This is a very tall red box.</p>
|
<p>This is a very tall red box.</p>
|
||||||
|
|
|
||||||
|
|
@ -9,18 +9,12 @@
|
||||||
iframe { width: 90%; height: 50px; }
|
iframe { width: 90%; height: 50px; }
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
/* eslint-disable no-useless-concat */
|
|
||||||
var headerHTML = "<html><head>" +
|
var headerHTML = "<html><head>" +
|
||||||
"<script src='/tests/SimpleTest/EventUtils.js'></scr" + "ipt>" +
|
"<script src='/tests/SimpleTest/EventUtils.js'></scr" + "ipt>" +
|
||||||
"<script src='NavigationUtils.js'></scr" + "ipt>" +
|
"<script src='NavigationUtils.js'></scr" + "ipt>" +
|
||||||
"</head><body>";
|
"</head><body>";
|
||||||
var footerHTML = "</body></html>";
|
var footerHTML = "</body></html>";
|
||||||
|
|
||||||
let window0 = null;
|
|
||||||
let window1 = null;
|
|
||||||
let window2 = null;
|
|
||||||
let window3 = null;
|
|
||||||
|
|
||||||
function testChild0() {
|
function testChild0() {
|
||||||
if (!window.window0) {
|
if (!window.window0) {
|
||||||
window0 = window.open("", "window0", "width=10,height=10");
|
window0 = window.open("", "window0", "width=10,height=10");
|
||||||
|
|
|
||||||
|
|
@ -6,21 +6,21 @@
|
||||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||||
<script type="text/javascript" src="NavigationUtils.js"></script>
|
<script type="text/javascript" src="NavigationUtils.js"></script>
|
||||||
<script>
|
<script>
|
||||||
window.onload = function() {
|
window.onload = function () {
|
||||||
document.getElementById("link0").href = target_url;
|
document.getElementById("link0").href = target_url;
|
||||||
sendMouseEvent({type: "click"}, "link0");
|
sendMouseEvent({type:"click"}, "link0");
|
||||||
|
|
||||||
xpcWaitForFinishedFrames(function() {
|
xpcWaitForFinishedFrames(function() {
|
||||||
var array_of_frames = xpcGetFramesByName("window0");
|
var array_of_frames = xpcGetFramesByName("window0");
|
||||||
is(array_of_frames.length, 1, "Should only open one window using a fancy hyperlink.");
|
is(array_of_frames.length, 1, "Should only open one window using a fancy hyperlink.");
|
||||||
|
|
||||||
for (var i = 0; i < array_of_frames.length; ++i)
|
for (var i=0; i < array_of_frames.length; ++i)
|
||||||
array_of_frames[i].close();
|
array_of_frames[i].close();
|
||||||
|
|
||||||
xpcCleanupWindows();
|
xpcCleanupWindows();
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}, 1);
|
}, 1);
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,12 @@
|
||||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||||
<script type="text/javascript" src="NavigationUtils.js"></script>
|
<script type="text/javascript" src="NavigationUtils.js"></script>
|
||||||
<script>
|
<script>
|
||||||
window.onload = function() {
|
window.onload = function () {
|
||||||
document.getElementById("link0").href = target_url;
|
document.getElementById("link0").href = target_url;
|
||||||
document.getElementById("link1").href = target_url;
|
document.getElementById("link1").href = target_url;
|
||||||
|
|
||||||
sendMouseEvent({type: "click"}, "link0");
|
sendMouseEvent({type:"click"}, "link0");
|
||||||
sendMouseEvent({type: "click"}, "link1");
|
sendMouseEvent({type:"click"}, "link1");
|
||||||
|
|
||||||
xpcWaitForFinishedFrames(function() {
|
xpcWaitForFinishedFrames(function() {
|
||||||
countAndClose("window0", 1);
|
countAndClose("window0", 1);
|
||||||
|
|
@ -20,7 +20,7 @@ window.onload = function() {
|
||||||
xpcCleanupWindows();
|
xpcCleanupWindows();
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}, 2);
|
}, 2);
|
||||||
};
|
}
|
||||||
|
|
||||||
function countAndClose(name, expected_count) {
|
function countAndClose(name, expected_count) {
|
||||||
var array_of_frames = xpcGetFramesByName(name);
|
var array_of_frames = xpcGetFramesByName(name);
|
||||||
|
|
@ -28,7 +28,7 @@ function countAndClose(name, expected_count) {
|
||||||
"Should only open " + expected_count +
|
"Should only open " + expected_count +
|
||||||
" window(s) with name " + name + " using a fancy hyperlink.");
|
" window(s) with name " + name + " using a fancy hyperlink.");
|
||||||
|
|
||||||
for (var i = 0; i < array_of_frames.length; ++i)
|
for (var i=0; i < array_of_frames.length; ++i)
|
||||||
array_of_frames[i].close();
|
array_of_frames[i].close();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=344861
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
var newwindow = window.open("/", "testwindow", "width=200,height=200");
|
var newwindow = window.open("/", "testwindow", "width=200,height=200");
|
||||||
newwindow.onload = function() {
|
newwindow.onload = function() {
|
||||||
is(newwindow.innerHeight, 200, "window.open has correct height dimensions");
|
is(newwindow.innerHeight, 200, "window.open has correct height dimensions");
|
||||||
is(newwindow.innerWidth, 200, "window.open has correct width dimensions");
|
is(newwindow.innerWidth, 200, "window.open has correct width dimensions");
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
newwindow.close();
|
newwindow.close();
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
</pre>
|
</pre>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -21,20 +21,20 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=386782
|
||||||
{
|
{
|
||||||
// <html><body><p>designModeDocument</p></body></html>
|
// <html><body><p>designModeDocument</p></body></html>
|
||||||
url: "file_bug386782_designmode.html",
|
url: "file_bug386782_designmode.html",
|
||||||
name: "designModeNavigate",
|
name: 'designModeNavigate',
|
||||||
onload(doc) { doc.designMode = "on"; },
|
onload(doc) { doc.designMode = "on"; },
|
||||||
expectedBodyBeforeEdit: "<p>designModeDocument</p>",
|
expectedBodyBeforeEdit: '<p>designModeDocument</p>',
|
||||||
expectedBodyAfterEdit: "<p>EDITED designModeDocument</p>",
|
expectedBodyAfterEdit: '<p>EDITED designModeDocument</p>',
|
||||||
expectedBodyAfterSecondEdit: "<p>EDITED TWICE designModeDocument</p>",
|
expectedBodyAfterSecondEdit: '<p>EDITED TWICE designModeDocument</p>',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// <html><body contentEditable="true"><p>contentEditable</p></body></html>
|
// <html><body contentEditable="true"><p>contentEditable</p></body></html>
|
||||||
url: "file_bug386782_contenteditable.html",
|
url: "file_bug386782_contenteditable.html",
|
||||||
name: "contentEditableNavigate",
|
name: 'contentEditableNavigate',
|
||||||
expectedBodyBeforeEdit: "<p>contentEditable</p>",
|
expectedBodyBeforeEdit: '<p>contentEditable</p>',
|
||||||
expectedBodyAfterEdit: "EDITED <br><p>contentEditable</p>",
|
expectedBodyAfterEdit: 'EDITED <br><p>contentEditable</p>',
|
||||||
expectedBodyAfterSecondEdit: "EDITED TWICE <br><p>contentEditable</p>",
|
expectedBodyAfterSecondEdit: 'EDITED TWICE <br><p>contentEditable</p>',
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
var gTestNum = -1;
|
var gTestNum = -1;
|
||||||
|
|
@ -66,10 +66,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=386782
|
||||||
// WARNING: If the following test fails, give the setTimeout() in the onload()
|
// WARNING: If the following test fails, give the setTimeout() in the onload()
|
||||||
// a bit longer; the doc hasn't had enough time to setup its editor.
|
// a bit longer; the doc hasn't had enough time to setup its editor.
|
||||||
is(gTest.window.document.body.innerHTML, gTest.expectedBodyBeforeEdit, "Is doc setup yet");
|
is(gTest.window.document.body.innerHTML, gTest.expectedBodyBeforeEdit, "Is doc setup yet");
|
||||||
sendString("EDITED ", gTest.window);
|
sendString('EDITED ', gTest.window);
|
||||||
is(gTest.window.document.body.innerHTML, gTest.expectedBodyAfterEdit, "Editing failed.");
|
is(gTest.window.document.body.innerHTML, gTest.expectedBodyAfterEdit, "Editing failed.");
|
||||||
|
|
||||||
gTest.window.location = "about:blank";
|
gTest.window.location = 'about:blank';
|
||||||
SimpleTest.waitForFocus(goBack, gTest.window);
|
SimpleTest.waitForFocus(goBack, gTest.window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -101,7 +101,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=386782
|
||||||
|
|
||||||
// Check that we can still edit the page.
|
// Check that we can still edit the page.
|
||||||
gTest.window.document.body.focus();
|
gTest.window.document.body.focus();
|
||||||
sendString("TWICE ", gTest.window);
|
sendString('TWICE ', gTest.window);
|
||||||
is(gTest.window.document.body.innerHTML, gTest.expectedBodyAfterSecondEdit, "Can we still edit?");
|
is(gTest.window.document.body.innerHTML, gTest.expectedBodyAfterSecondEdit, "Can we still edit?");
|
||||||
|
|
||||||
gTest.window.close();
|
gTest.window.close();
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=430624
|
||||||
|
|
||||||
function onLoad() {
|
function onLoad() {
|
||||||
window.frames[0].frameElement.onload = onReload;
|
window.frames[0].frameElement.onload = onReload;
|
||||||
// eslint-disable-next-line no-self-assign
|
|
||||||
window.frames[0].frameElement.srcdoc = window.frames[0].frameElement.srcdoc;
|
window.frames[0].frameElement.srcdoc = window.frames[0].frameElement.srcdoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -38,7 +37,7 @@ function onReload() {
|
||||||
function doTest() {
|
function doTest() {
|
||||||
var bodyElement = window.frames[0].frameElement.contentDocument.body;
|
var bodyElement = window.frames[0].frameElement.contentDocument.body;
|
||||||
bodyElement.focus();
|
bodyElement.focus();
|
||||||
sendString("Still ", window.frames[0].frameElement.contentWindow);
|
sendString('Still ', window.frames[0].frameElement.contentWindow);
|
||||||
|
|
||||||
is(bodyElement.innerHTML, "Still contentEditable", "Check we're contentEditable after reload");
|
is(bodyElement.innerHTML, "Still contentEditable", "Check we're contentEditable after reload");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=430723
|
||||||
</div>
|
</div>
|
||||||
<pre id="test">
|
<pre id="test">
|
||||||
<script class="testbody" type="text/javascript">
|
<script class="testbody" type="text/javascript">
|
||||||
// <![CDATA[
|
//<![CDATA[
|
||||||
|
|
||||||
/** Test for Bug 430723 **/
|
/** Test for Bug 430723 **/
|
||||||
|
|
||||||
|
|
@ -32,58 +32,59 @@ var testNum = 0;
|
||||||
|
|
||||||
var smoothScrollPref = "general.smoothScroll";
|
var smoothScrollPref = "general.smoothScroll";
|
||||||
function runTest() {
|
function runTest() {
|
||||||
SpecialPowers.pushPrefEnv({"set": [[smoothScrollPref, false]]}, function() {
|
SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, function(){
|
||||||
testWindow = window.open(gTallRedBoxURI, "testWindow", "width=300,height=300,location=yes,scrollbars=yes");
|
testWindow = window.open(gTallRedBoxURI, "testWindow", "width=300,height=300,location=yes,scrollbars=yes");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var nextTest = function() {
|
var nextTest =function() {
|
||||||
testNum++;
|
testNum++;
|
||||||
switch (testNum) {
|
switch (testNum) {
|
||||||
case 1: setTimeout(step1, 0); break;
|
case 1: setTimeout(step1, 0); break;
|
||||||
case 2: setTimeout(step2, 0); break;
|
case 2: setTimeout(step2, 0); break;
|
||||||
case 3: setTimeout(step3, 0); break;
|
case 3: setTimeout(step3, 0); break;
|
||||||
}
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
var step1 = function() {
|
var step1 =function() {
|
||||||
window.is(String(testWindow.location), gTallRedBoxURI, "Ensure red page loaded.");
|
window.is(String(testWindow.location), gTallRedBoxURI, "Ensure red page loaded.");
|
||||||
|
|
||||||
// Navigate down and up.
|
// Navigate down and up.
|
||||||
is(testWindow.document.body.scrollTop, 0,
|
is(testWindow.document.body.scrollTop, 0,
|
||||||
"Page1: Ensure the scrollpane is at the top before we start scrolling.");
|
"Page1: Ensure the scrollpane is at the top before we start scrolling.");
|
||||||
testWindow.addEventListener("scroll", function() {
|
testWindow.addEventListener("scroll", function () {
|
||||||
isnot(testWindow.document.body.scrollTop, 0,
|
isnot(testWindow.document.body.scrollTop, 0,
|
||||||
"Page1: Ensure we can scroll down.");
|
"Page1: Ensure we can scroll down.");
|
||||||
SimpleTest.executeSoon(step1_2);
|
SimpleTest.executeSoon(step1_2);
|
||||||
}, {capture: true, once: true});
|
}, {capture: true, once: true});
|
||||||
sendKey("DOWN", testWindow);
|
sendKey('DOWN', testWindow);
|
||||||
|
|
||||||
function step1_2() {
|
function step1_2() {
|
||||||
testWindow.addEventListener("scroll", function() {
|
testWindow.addEventListener("scroll", function () {
|
||||||
is(testWindow.document.body.scrollTop, 0,
|
is(testWindow.document.body.scrollTop, 0,
|
||||||
"Page1: Ensure we can scroll up, back to the top.");
|
"Page1: Ensure we can scroll up, back to the top.");
|
||||||
|
|
||||||
// Nav to blue box page. This should fire step2.
|
// Nav to blue box page. This should fire step2.
|
||||||
testWindow.location = gTallBlueBoxURI;
|
testWindow.location = gTallBlueBoxURI;
|
||||||
}, {capture: true, once: true});
|
}, {capture: true, once: true});
|
||||||
sendKey("UP", testWindow);
|
sendKey('UP', testWindow);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
var step2 = function() {
|
var step2 =function() {
|
||||||
window.is(String(testWindow.location), gTallBlueBoxURI, "Ensure blue page loaded.");
|
window.is(String(testWindow.location), gTallBlueBoxURI, "Ensure blue page loaded.");
|
||||||
|
|
||||||
// Scroll around a bit.
|
// Scroll around a bit.
|
||||||
is(testWindow.document.body.scrollTop, 0,
|
is(testWindow.document.body.scrollTop, 0,
|
||||||
"Page2: Ensure the scrollpane is at the top before we start scrolling.");
|
"Page2: Ensure the scrollpane is at the top before we start scrolling.");
|
||||||
|
|
||||||
var scrollTest = function() {
|
var count = 0;
|
||||||
|
testWindow.addEventListener("scroll", function () {
|
||||||
if (++count < 2) {
|
if (++count < 2) {
|
||||||
SimpleTest.executeSoon(function() { sendKey("DOWN", testWindow); });
|
SimpleTest.executeSoon(function () { sendKey('DOWN', testWindow); });
|
||||||
} else {
|
} else {
|
||||||
testWindow.removeEventListener("scroll", scrollTest, true);
|
testWindow.removeEventListener("scroll", arguments.callee, true);
|
||||||
|
|
||||||
isnot(testWindow.document.body.scrollTop, 0,
|
isnot(testWindow.document.body.scrollTop, 0,
|
||||||
"Page2: Ensure we could scroll.");
|
"Page2: Ensure we could scroll.");
|
||||||
|
|
@ -91,33 +92,30 @@ var step2 = function() {
|
||||||
// Navigate backwards. This should fire step3.
|
// Navigate backwards. This should fire step3.
|
||||||
testWindow.history.back();
|
testWindow.history.back();
|
||||||
}
|
}
|
||||||
};
|
}, true);
|
||||||
|
sendKey('DOWN', testWindow);
|
||||||
|
}
|
||||||
|
|
||||||
var count = 0;
|
var step3 =function() {
|
||||||
testWindow.addEventListener("scroll", scrollTest, true);
|
|
||||||
sendKey("DOWN", testWindow);
|
|
||||||
};
|
|
||||||
|
|
||||||
var step3 = function() {
|
|
||||||
window.is(String(testWindow.location), gTallRedBoxURI,
|
window.is(String(testWindow.location), gTallRedBoxURI,
|
||||||
"Ensure red page restored from history.");
|
"Ensure red page restored from history.");
|
||||||
|
|
||||||
// Check we can still scroll with the keys.
|
// Check we can still scroll with the keys.
|
||||||
is(testWindow.document.body.scrollTop, 0,
|
is(testWindow.document.body.scrollTop, 0,
|
||||||
"Page1Again: Ensure scroll pane at top before we scroll.");
|
"Page1Again: Ensure scroll pane at top before we scroll.");
|
||||||
testWindow.addEventListener("scroll", function() {
|
testWindow.addEventListener("scroll", function () {
|
||||||
isnot(testWindow.document.body.scrollTop, 0,
|
isnot(testWindow.document.body.scrollTop, 0,
|
||||||
"Page2Again: Ensure we can still scroll.");
|
"Page2Again: Ensure we can still scroll.");
|
||||||
|
|
||||||
testWindow.close();
|
testWindow.close();
|
||||||
window.SimpleTest.finish();
|
window.SimpleTest.finish();
|
||||||
}, {capture: true, once: true});
|
}, {capture: true, once: true});
|
||||||
sendKey("DOWN", testWindow);
|
sendKey('DOWN', testWindow);
|
||||||
};
|
}
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
// ]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
</pre>
|
</pre>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ window.onload = function() {
|
||||||
xpcCleanupWindows();
|
xpcCleanupWindows();
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}, 4);
|
}, 4);
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1329288
|
||||||
* gets called with the right (a non null) 'context' for the TYPE_DOCUMENT load.
|
* gets called with the right (a non null) 'context' for the TYPE_DOCUMENT load.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Services.jsm is disabled as ChromeUtils appears to be out of scope
|
|
||||||
/* eslint-disable mozilla/use-services */
|
|
||||||
|
|
||||||
const Cc = SpecialPowers.Cc;
|
const Cc = SpecialPowers.Cc;
|
||||||
const Ci = SpecialPowers.Ci;
|
const Ci = SpecialPowers.Ci;
|
||||||
|
|
||||||
|
|
@ -39,8 +36,7 @@ var policyID = SpecialPowers.wrap(SpecialPowers.Components).ID("{b80e19d0-878f-d
|
||||||
var policyName = "@mozilla.org/testpolicy;1";
|
var policyName = "@mozilla.org/testpolicy;1";
|
||||||
var policy = {
|
var policy = {
|
||||||
// nsISupports implementation
|
// nsISupports implementation
|
||||||
// eslint-disable-next-line mozilla/use-chromeutils-generateqi
|
QueryInterface: function(iid) {
|
||||||
QueryInterface(iid) {
|
|
||||||
iid = SpecialPowers.wrap(iid);
|
iid = SpecialPowers.wrap(iid);
|
||||||
if (iid.equals(Ci.nsISupports) ||
|
if (iid.equals(Ci.nsISupports) ||
|
||||||
iid.equals(Ci.nsIFactory) ||
|
iid.equals(Ci.nsIFactory) ||
|
||||||
|
|
@ -50,12 +46,12 @@ var policy = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsIFactory implementation
|
// nsIFactory implementation
|
||||||
createInstance(outer, iid) {
|
createInstance: function(outer, iid) {
|
||||||
return this.QueryInterface(iid);
|
return this.QueryInterface(iid);
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsIContentPolicy implementation
|
// nsIContentPolicy implementation
|
||||||
shouldLoad(contentLocation, loadInfo, mimeTypeGuess) {
|
shouldLoad: function(contentLocation, loadInfo, mimeTypeGuess) {
|
||||||
let contentType = loadInfo.externalContentPolicyType;
|
let contentType = loadInfo.externalContentPolicyType;
|
||||||
let context = loadInfo.loadingContext;
|
let context = loadInfo.loadingContext;
|
||||||
|
|
||||||
|
|
@ -83,10 +79,10 @@ var policy = {
|
||||||
return Ci.nsIContentPolicy.REJECT_REQUEST;
|
return Ci.nsIContentPolicy.REJECT_REQUEST;
|
||||||
},
|
},
|
||||||
|
|
||||||
shouldProcess(contentLocation, loadInfo, mimeTypeGuess) {
|
shouldProcess: function(contentLocation, loadInfo, mimeTypeGuess) {
|
||||||
return Ci.nsIContentPolicy.ACCEPT;
|
return Ci.nsIContentPolicy.ACCEPT;
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
policy = SpecialPowers.wrapCallbackObject(policy);
|
policy = SpecialPowers.wrapCallbackObject(policy);
|
||||||
componentManager.registerFactory(policyID, "Test content policy", policyName, policy);
|
componentManager.registerFactory(policyID, "Test content policy", policyName, policy);
|
||||||
|
|
@ -95,7 +91,7 @@ categoryManager.addCategoryEntry("content-policy", policyName, policyName, false
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
// now everything is set up, let's start the test
|
// now everything is set up, let's start the test
|
||||||
document.getElementById("testlink").click();
|
document.getElementById("testlink").click()
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ if (!navigator.platform.startsWith("Win")) {
|
||||||
SimpleTest.expectAssertions(0, 1);
|
SimpleTest.expectAssertions(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onload = function() {
|
window.onload = function () {
|
||||||
navigateByLocation(frames[0].frames[0]);
|
navigateByLocation(frames[0].frames[0]);
|
||||||
navigateByOpen("child1_child0");
|
navigateByOpen("child1_child0");
|
||||||
navigateByForm("child2_child0");
|
navigateByForm("child2_child0");
|
||||||
|
|
@ -28,7 +28,7 @@ window.onload = function() {
|
||||||
xpcCleanupWindows();
|
xpcCleanupWindows();
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}, 4);
|
}, 4);
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ if (!navigator.platform.startsWith("Win")) {
|
||||||
SimpleTest.expectAssertions(0, 1);
|
SimpleTest.expectAssertions(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onload = function() {
|
window.onload = function () {
|
||||||
// navigateByLocation(window0); // Don't have a handle to the window.
|
//navigateByLocation(window0); // Don't have a handle to the window.
|
||||||
navigateByOpen("window1");
|
navigateByOpen("window1");
|
||||||
navigateByForm("window2");
|
navigateByForm("window2");
|
||||||
navigateByHyperlink("window3");
|
navigateByHyperlink("window3");
|
||||||
|
|
@ -24,7 +24,7 @@ window.onload = function() {
|
||||||
is(xpcGetFramesByName("window2").length, 2, "Should not be able to navigate popup's popup by submitting form.");
|
is(xpcGetFramesByName("window2").length, 2, "Should not be able to navigate popup's popup by submitting form.");
|
||||||
is(xpcGetFramesByName("window3").length, 2, "Should not be able to navigate popup's popup by targeted hyperlink.");
|
is(xpcGetFramesByName("window3").length, 2, "Should not be able to navigate popup's popup by targeted hyperlink.");
|
||||||
|
|
||||||
// opener0.close();
|
//opener0.close();
|
||||||
opener1.close();
|
opener1.close();
|
||||||
opener2.close();
|
opener2.close();
|
||||||
opener3.close();
|
opener3.close();
|
||||||
|
|
@ -32,12 +32,12 @@ window.onload = function() {
|
||||||
xpcCleanupWindows();
|
xpcCleanupWindows();
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}, 6);
|
}, 6);
|
||||||
};
|
}
|
||||||
|
|
||||||
// opener0 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window0", "_blank", "width=10,height=10");
|
//opener0 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window0", "_blank", "width=10,height=10");
|
||||||
let opener1 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window1", "_blank", "width=10,height=10");
|
opener1 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window1", "_blank", "width=10,height=10");
|
||||||
let opener2 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window2", "_blank", "width=10,height=10");
|
opener2 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window2", "_blank", "width=10,height=10");
|
||||||
let opener3 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window3", "_blank", "width=10,height=10");
|
opener3 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window3", "_blank", "width=10,height=10");
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ if (navigator.platform.startsWith("Linux")) {
|
||||||
SimpleTest.expectAssertions(0, 1);
|
SimpleTest.expectAssertions(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onload = function() {
|
window.onload = function () {
|
||||||
navigateByLocation(window0);
|
navigateByLocation(window0);
|
||||||
navigateByOpen("window1");
|
navigateByOpen("window1");
|
||||||
navigateByForm("window2");
|
navigateByForm("window2");
|
||||||
|
|
@ -33,7 +33,7 @@ window.onload = function() {
|
||||||
xpcCleanupWindows();
|
xpcCleanupWindows();
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}, 4);
|
}, 4);
|
||||||
};
|
}
|
||||||
|
|
||||||
var window0 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/blank.html", "window0", "width=10,height=10");
|
var window0 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/blank.html", "window0", "width=10,height=10");
|
||||||
var window1 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/blank.html", "window1", "width=10,height=10");
|
var window1 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/blank.html", "window1", "width=10,height=10");
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,6 @@
|
||||||
iframe { width: 90%; height: 50px; }
|
iframe { width: 90%; height: 50px; }
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
let window0 = null;
|
|
||||||
let window1 = null;
|
|
||||||
let window2 = null;
|
|
||||||
let window3 = null;
|
|
||||||
|
|
||||||
function testChild0() {
|
function testChild0() {
|
||||||
if (!window.window0)
|
if (!window.window0)
|
||||||
window0 = window.open("navigate.html#opener.frames[0],location", "window0", "width=10,height=10");
|
window0 = window.open("navigate.html#opener.frames[0],location", "window0", "width=10,height=10");
|
||||||
|
|
|
||||||
|
|
@ -14,28 +14,28 @@ if (navigator.platform.startsWith("Mac")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function testTop() {
|
function testTop() {
|
||||||
let window0 = window.open("iframe.html#http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#top,location", "_blank", "width=10,height=10");
|
window0 = window.open("iframe.html#http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#top,location", "_blank", "width=10,height=10");
|
||||||
|
|
||||||
xpcWaitForFinishedFrames(function() {
|
xpcWaitForFinishedFrames(function() {
|
||||||
isInaccessible(window0, "Should be able to navigate off-domain top by setting location.");
|
isInaccessible(window0, "Should be able to navigate off-domain top by setting location.");
|
||||||
window0.close();
|
window0.close();
|
||||||
xpcCleanupWindows();
|
xpcCleanupWindows();
|
||||||
|
|
||||||
let window1 = window.open("iframe.html#http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#_top,open", "_blank", "width=10,height=10");
|
window1 = window.open("iframe.html#http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#_top,open", "_blank", "width=10,height=10");
|
||||||
|
|
||||||
xpcWaitForFinishedFrames(function() {
|
xpcWaitForFinishedFrames(function() {
|
||||||
isInaccessible(window1, "Should be able to navigate off-domain top by calling window.open.");
|
isInaccessible(window1, "Should be able to navigate off-domain top by calling window.open.");
|
||||||
window1.close();
|
window1.close();
|
||||||
xpcCleanupWindows();
|
xpcCleanupWindows();
|
||||||
|
|
||||||
let window2 = window.open("iframe.html#http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#_top,form", "_blank", "width=10,height=10");
|
window2 = window.open("iframe.html#http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#_top,form", "_blank", "width=10,height=10");
|
||||||
|
|
||||||
xpcWaitForFinishedFrames(function() {
|
xpcWaitForFinishedFrames(function() {
|
||||||
isInaccessible(window2, "Should be able to navigate off-domain top by submitting form.");
|
isInaccessible(window2, "Should be able to navigate off-domain top by submitting form.");
|
||||||
window2.close();
|
window2.close();
|
||||||
xpcCleanupWindows();
|
xpcCleanupWindows();
|
||||||
|
|
||||||
let window3 = window.open("iframe.html#http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#_top,hyperlink", "_blank", "width=10,height=10");
|
window3 = window.open("iframe.html#http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#_top,hyperlink", "_blank", "width=10,height=10");
|
||||||
|
|
||||||
xpcWaitForFinishedFrames(function() {
|
xpcWaitForFinishedFrames(function() {
|
||||||
isInaccessible(window3, "Should be able to navigate off-domain top by targeted hyperlink.");
|
isInaccessible(window3, "Should be able to navigate off-domain top by targeted hyperlink.");
|
||||||
|
|
@ -84,7 +84,7 @@ function testParent() {
|
||||||
|
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
testTop();
|
testTop();
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ var testFiles =
|
||||||
"file_bug462076_3.html", // Dynamic frames after onload
|
"file_bug462076_3.html", // Dynamic frames after onload
|
||||||
"file_bug508537_1.html", // Dynamic frames and forward-back
|
"file_bug508537_1.html", // Dynamic frames and forward-back
|
||||||
"file_document_write_1.html", // Session history + document.write
|
"file_document_write_1.html", // Session history + document.write
|
||||||
// "file_static_and_dynamic_1.html",// Static and dynamic frames and forward-back
|
//"file_static_and_dynamic_1.html",// Static and dynamic frames and forward-back
|
||||||
"file_bug534178.html", // Session history entry clean-up.
|
"file_bug534178.html", // Session history entry clean-up.
|
||||||
"file_fragment_handling_during_load.html",
|
"file_fragment_handling_during_load.html",
|
||||||
"file_nested_frames.html",
|
"file_nested_frames.html",
|
||||||
|
|
@ -48,7 +48,7 @@ function nextTest_() {
|
||||||
let nextFile = testFiles.shift();
|
let nextFile = testFiles.shift();
|
||||||
info("Running " + nextFile);
|
info("Running " + nextFile);
|
||||||
testWindow = window.open(nextFile, "", "width=360,height=480");
|
testWindow = window.open(nextFile, "", "width=360,height=480");
|
||||||
testWindow.onunload = function() { }; // to prevent bfcache
|
testWindow.onunload = function () { } // to prevent bfcache
|
||||||
} else {
|
} else {
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
iframe { width: 90%; height: 50px; }
|
iframe { width: 90%; height: 50px; }
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
window.onload = function() {
|
window.onload = function () {
|
||||||
document.getElementById("active").innerHTML =
|
document.getElementById('active').innerHTML =
|
||||||
'<iframe src="navigate.html#parent.frames[0],location"></iframe>' +
|
'<iframe src="navigate.html#parent.frames[0],location"></iframe>' +
|
||||||
'<iframe src="navigate.html#child1,open"></iframe>' +
|
'<iframe src="navigate.html#child1,open"></iframe>' +
|
||||||
'<iframe src="navigate.html#child2,form"></iframe>' +
|
'<iframe src="navigate.html#child2,form"></iframe>' +
|
||||||
|
|
@ -25,7 +25,7 @@ window.onload = function() {
|
||||||
xpcCleanupWindows();
|
xpcCleanupWindows();
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}, 4);
|
}, 4);
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
iframe { width: 90%; height: 50px; }
|
iframe { width: 90%; height: 50px; }
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
window.onload = function() {
|
window.onload = function () {
|
||||||
document.getElementById("active").innerHTML =
|
document.getElementById('active').innerHTML =
|
||||||
'<iframe src="http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#parent.frames[0],location"></iframe>' +
|
'<iframe src="http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#parent.frames[0],location"></iframe>' +
|
||||||
'<iframe src="http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#child1,open"></iframe>' +
|
'<iframe src="http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#child1,open"></iframe>' +
|
||||||
'<iframe src="http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#child2,form"></iframe>' +
|
'<iframe src="http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#child2,form"></iframe>' +
|
||||||
|
|
@ -25,7 +25,7 @@ window.onload = function() {
|
||||||
xpcCleanupWindows();
|
xpcCleanupWindows();
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}, 4);
|
}, 4);
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,9 @@ window.addEventListener("message", receiveMessage);
|
||||||
|
|
||||||
function receiveMessage(event) {
|
function receiveMessage(event) {
|
||||||
is(event.data.triggeringPrincipalURI, TRIGGERINGPRINCIPALURI,
|
is(event.data.triggeringPrincipalURI, TRIGGERINGPRINCIPALURI,
|
||||||
"TriggeringPrincipal should be the navigating iframe (Frame 1)");
|
"TriggeringPrincipal should be the navigating iframe (Frame 1)");
|
||||||
is(event.data.loadingPrincipalURI, LOADINGPRINCIPALURI,
|
is(event.data.loadingPrincipalURI, LOADINGPRINCIPALURI,
|
||||||
"LoadingPrincipal should be the enclosing iframe (Frame 2)");
|
"LoadingPrincipal should be the enclosing iframe (Frame 2)");
|
||||||
is(event.data.referrerURI, TRIGGERINGPRINCIPALURI,
|
is(event.data.referrerURI, TRIGGERINGPRINCIPALURI,
|
||||||
"Referrer and TriggeringPrincipal should be identical (Frame 1)");
|
"Referrer and TriggeringPrincipal should be identical (Frame 1)");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,16 @@
|
||||||
* TriggeringPrincipal and LoadingPrincipal of the navigated iframe (Frame A).
|
* TriggeringPrincipal and LoadingPrincipal of the navigated iframe (Frame A).
|
||||||
*
|
*
|
||||||
* +---------------------------------------+
|
* +---------------------------------------+
|
||||||
* | Parent |
|
* | Parent |
|
||||||
* | |
|
* | |
|
||||||
* | +----------------------------+ |
|
* | +----------------------------+ |
|
||||||
* | | Frame A | |
|
* | | Frame A | |
|
||||||
* | | | |
|
* | | | |
|
||||||
* | | | |
|
* | | | |
|
||||||
* | +----------------------------+ |
|
* | +----------------------------+ |
|
||||||
* | |
|
* | |
|
||||||
* | +----------------------------+ |
|
* | +----------------------------+ |
|
||||||
* | | Frame B | |
|
* | | Frame B | |
|
||||||
* | | | |
|
* | | | |
|
||||||
* | | win.open("http://", "A") | |
|
* | | win.open("http://", "A") | |
|
||||||
* | +----------------------------+ |
|
* | +----------------------------+ |
|
||||||
|
|
@ -49,7 +49,7 @@ const LOADING_PRINCIPAL_URI =
|
||||||
var frameA = document.getElementById("framea");
|
var frameA = document.getElementById("framea");
|
||||||
|
|
||||||
function checkResults() {
|
function checkResults() {
|
||||||
frameA.removeEventListener("load", checkResults);
|
frameA.removeEventListener('load', checkResults);
|
||||||
|
|
||||||
var channel = SpecialPowers.wrap(frameA.contentWindow).docShell.currentDocumentChannel;
|
var channel = SpecialPowers.wrap(frameA.contentWindow).docShell.currentDocumentChannel;
|
||||||
var triggeringPrincipal = channel.loadInfo.triggeringPrincipal.URI.asciiSpec;
|
var triggeringPrincipal = channel.loadInfo.triggeringPrincipal.URI.asciiSpec;
|
||||||
|
|
@ -63,13 +63,13 @@ function checkResults() {
|
||||||
|
|
||||||
is(loadingPrincipal, LOADING_PRINCIPAL_URI,
|
is(loadingPrincipal, LOADING_PRINCIPAL_URI,
|
||||||
"LoadingPrincipal for targeted window.open() should be the containing document");
|
"LoadingPrincipal for targeted window.open() should be the containing document");
|
||||||
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
function performNavigation() {
|
function performNavigation() {
|
||||||
frameA.removeEventListener("load", performNavigation);
|
frameA.removeEventListener('load', performNavigation);
|
||||||
frameA.addEventListener("load", checkResults);
|
frameA.addEventListener('load', checkResults);
|
||||||
|
|
||||||
// load Frame B which then navigates Frame A
|
// load Frame B which then navigates Frame A
|
||||||
var frameB = document.getElementById("frameb");
|
var frameB = document.getElementById("frameb");
|
||||||
|
|
@ -79,7 +79,7 @@ function performNavigation() {
|
||||||
// start the test
|
// start the test
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
frameA.addEventListener("load", performNavigation);
|
frameA.addEventListener('load', performNavigation);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,13 @@
|
||||||
* TriggeringPrincipal and LoadingPrincipal of the navigated iframe.
|
* TriggeringPrincipal and LoadingPrincipal of the navigated iframe.
|
||||||
*
|
*
|
||||||
* +------------------------------------------+
|
* +------------------------------------------+
|
||||||
* | |
|
* | |
|
||||||
* | +------------------+ |
|
* | +------------------+ |
|
||||||
* | | testframe | |
|
* | | testframe | |
|
||||||
* | +------------------+ |
|
* | +------------------+ |
|
||||||
* | |
|
* | |
|
||||||
* | window.open("http://", "testframe"); |
|
* | window.open("http://", "testframe"); |
|
||||||
* | |
|
* | |
|
||||||
* +------------------------------------------+
|
* +------------------------------------------+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -35,7 +35,7 @@ const LOADING_PRINCIPAL_URI = TRIGGERING_PRINCIPAL_URI;
|
||||||
var testframe = document.getElementById("testframe");
|
var testframe = document.getElementById("testframe");
|
||||||
|
|
||||||
function checkResults() {
|
function checkResults() {
|
||||||
testframe.removeEventListener("load", checkResults);
|
testframe.removeEventListener('load', checkResults);
|
||||||
|
|
||||||
var channel = SpecialPowers.wrap(testframe.contentWindow).docShell.currentDocumentChannel;
|
var channel = SpecialPowers.wrap(testframe.contentWindow).docShell.currentDocumentChannel;
|
||||||
var triggeringPrincipal = channel.loadInfo.triggeringPrincipal.URI.asciiSpec;
|
var triggeringPrincipal = channel.loadInfo.triggeringPrincipal.URI.asciiSpec;
|
||||||
|
|
@ -49,20 +49,20 @@ function checkResults() {
|
||||||
|
|
||||||
is(loadingPrincipal, LOADING_PRINCIPAL_URI,
|
is(loadingPrincipal, LOADING_PRINCIPAL_URI,
|
||||||
"LoadingPrincipal for targeted window.open() should be the <iframe>.ownerDocument");
|
"LoadingPrincipal for targeted window.open() should be the <iframe>.ownerDocument");
|
||||||
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
function performNavigation() {
|
function performNavigation() {
|
||||||
testframe.removeEventListener("load", performNavigation);
|
testframe.removeEventListener('load', performNavigation);
|
||||||
testframe.addEventListener("load", checkResults);
|
testframe.addEventListener('load', checkResults);
|
||||||
window.open("file_triggeringprincipal_parent_iframe_window_open_nav.html", "testframe");
|
win = window.open("file_triggeringprincipal_parent_iframe_window_open_nav.html", "testframe");
|
||||||
}
|
}
|
||||||
|
|
||||||
// start the test
|
// start the test
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
testframe.addEventListener("load", performNavigation);
|
testframe.addEventListener('load', performNavigation);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ httpWin.onload = function() {
|
||||||
|
|
||||||
httpWin.close();
|
httpWin.close();
|
||||||
checkFinish();
|
checkFinish();
|
||||||
};
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Test 2: window.open(javascript:)
|
// Test 2: window.open(javascript:)
|
||||||
|
|
@ -71,7 +71,7 @@ jsWin.onload = function() {
|
||||||
|
|
||||||
jsWin.close();
|
jsWin.close();
|
||||||
checkFinish();
|
checkFinish();
|
||||||
};
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|
||||||
|
|
||||||
var dirSvc = Services.dirSvc;
|
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||||
|
getService(Ci.nsIProperties);
|
||||||
var profileDir = do_get_profile();
|
var profileDir = do_get_profile();
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|
||||||
|
|
||||||
var prefetch = Cc["@mozilla.org/prefetch-service;1"].
|
var prefetch = Cc["@mozilla.org/prefetch-service;1"].
|
||||||
getService(Ci.nsIPrefetchService);
|
getService(Ci.nsIPrefetchService);
|
||||||
|
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||||
|
getService(Ci.nsIIOService);
|
||||||
|
var prefs = Cc["@mozilla.org/preferences-service;1"].
|
||||||
|
getService(Ci.nsIPrefBranch);
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
// Fill up the queue
|
// Fill up the queue
|
||||||
Services.prefs.setBoolPref("network.prefetch-next", true);
|
prefs.setBoolPref("network.prefetch-next", true);
|
||||||
for (var i = 0; i < 5; i++) {
|
for (var i = 0; i < 5; i++) {
|
||||||
var uri = Services.io.newURI("http://localhost/" + i);
|
var uri = ios.newURI("http://localhost/" + i);
|
||||||
prefetch.prefetchURI(uri, uri, null, true);
|
prefetch.prefetchURI(uri, uri, null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -15,14 +17,14 @@ function run_test() {
|
||||||
Assert.ok(prefetch.hasMoreElements());
|
Assert.ok(prefetch.hasMoreElements());
|
||||||
|
|
||||||
// Now disable the pref to force the queue to empty...
|
// Now disable the pref to force the queue to empty...
|
||||||
Services.prefs.setBoolPref("network.prefetch-next", false);
|
prefs.setBoolPref("network.prefetch-next", false);
|
||||||
Assert.ok(!prefetch.hasMoreElements());
|
Assert.ok(!prefetch.hasMoreElements());
|
||||||
|
|
||||||
// Now reenable the pref, and add more items to the queue.
|
// Now reenable the pref, and add more items to the queue.
|
||||||
Services.prefs.setBoolPref("network.prefetch-next", true);
|
prefs.setBoolPref("network.prefetch-next", true);
|
||||||
for (var k = 0; k < 5; k++) {
|
for (var i = 0; i < 5; i++) {
|
||||||
var uri2 = Services.io.newURI("http://localhost/" + k);
|
var uri = ios.newURI("http://localhost/" + i);
|
||||||
prefetch.prefetchURI(uri2, uri2, null, true);
|
prefetch.prefetchURI(uri, uri, null, true);
|
||||||
}
|
}
|
||||||
Assert.ok(prefetch.hasMoreElements());
|
Assert.ok(prefetch.hasMoreElements());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,83 +1,90 @@
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
var urifixup = Cc["@mozilla.org/docshell/urifixup;1"].
|
||||||
|
getService(Ci.nsIURIFixup);
|
||||||
|
var prefs = Cc["@mozilla.org/preferences-service;1"].
|
||||||
|
getService(Ci.nsIPrefBranch);
|
||||||
|
|
||||||
var pref = "browser.fixup.typo.scheme";
|
var pref = "browser.fixup.typo.scheme";
|
||||||
|
|
||||||
var data = [
|
var data = [
|
||||||
{
|
{
|
||||||
// ttp -> http.
|
// ttp -> http.
|
||||||
wrong: "ttp://www.example.com/",
|
wrong: 'ttp://www.example.com/',
|
||||||
fixed: "http://www.example.com/",
|
fixed: 'http://www.example.com/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// htp -> http.
|
// htp -> http.
|
||||||
wrong: "htp://www.example.com/",
|
wrong: 'htp://www.example.com/',
|
||||||
fixed: "http://www.example.com/",
|
fixed: 'http://www.example.com/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// ttps -> https.
|
// ttps -> https.
|
||||||
wrong: "ttps://www.example.com/",
|
wrong: 'ttps://www.example.com/',
|
||||||
fixed: "https://www.example.com/",
|
fixed: 'https://www.example.com/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// tps -> https.
|
// tps -> https.
|
||||||
wrong: "tps://www.example.com/",
|
wrong: 'tps://www.example.com/',
|
||||||
fixed: "https://www.example.com/",
|
fixed: 'https://www.example.com/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// ps -> https.
|
// ps -> https.
|
||||||
wrong: "ps://www.example.com/",
|
wrong: 'ps://www.example.com/',
|
||||||
fixed: "https://www.example.com/",
|
fixed: 'https://www.example.com/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// htps -> https.
|
// htps -> https.
|
||||||
wrong: "htps://www.example.com/",
|
wrong: 'htps://www.example.com/',
|
||||||
fixed: "https://www.example.com/",
|
fixed: 'https://www.example.com/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// ile -> file.
|
// ile -> file.
|
||||||
wrong: "ile:///this/is/a/test.html",
|
wrong: 'ile:///this/is/a/test.html',
|
||||||
fixed: "file:///this/is/a/test.html",
|
fixed: 'file:///this/is/a/test.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// le -> file.
|
// le -> file.
|
||||||
wrong: "le:///this/is/a/test.html",
|
wrong: 'le:///this/is/a/test.html',
|
||||||
fixed: "file:///this/is/a/test.html",
|
fixed: 'file:///this/is/a/test.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Valid should not be changed.
|
// Valid should not be changed.
|
||||||
wrong: "https://example.com/this/is/a/test.html",
|
wrong: 'https://example.com/this/is/a/test.html',
|
||||||
fixed: "https://example.com/this/is/a/test.html",
|
fixed: 'https://example.com/this/is/a/test.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Unmatched should not be changed.
|
// Unmatched should not be changed.
|
||||||
wrong: "whatever://this/is/a/test.html",
|
wrong: 'whatever://this/is/a/test.html',
|
||||||
fixed: "whatever://this/is/a/test.html",
|
fixed: 'whatever://this/is/a/test.html',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
var len = data.length;
|
var len = data.length;
|
||||||
|
|
||||||
|
function run_test() {
|
||||||
|
run_next_test();
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure we fix what needs fixing when there is no pref set.
|
// Make sure we fix what needs fixing when there is no pref set.
|
||||||
add_task(function test_unset_pref_fixes_typos() {
|
add_task(function test_unset_pref_fixes_typos() {
|
||||||
Services.prefs.clearUserPref(pref);
|
prefs.clearUserPref(pref);
|
||||||
for (let i = 0; i < len; ++i) {
|
for (let i = 0; i < len; ++i) {
|
||||||
let item = data[i];
|
let item = data[i];
|
||||||
let result =
|
let result =
|
||||||
Services.uriFixup.createFixupURI(item.wrong,
|
urifixup.createFixupURI(item.wrong,
|
||||||
Services.uriFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS).spec;
|
urifixup.FIXUP_FLAG_FIX_SCHEME_TYPOS).spec;
|
||||||
Assert.equal(result, item.fixed);
|
Assert.equal(result, item.fixed);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Make sure we don't do anything when the pref is explicitly
|
// Make sure we don't do anything when the pref is explicitly
|
||||||
// set to false.
|
// set to false.
|
||||||
add_task(function test_false_pref_keeps_typos() {
|
add_task(function test_false_pref_keeps_typos() {
|
||||||
Services.prefs.setBoolPref(pref, false);
|
prefs.setBoolPref(pref, false);
|
||||||
for (let i = 0; i < len; ++i) {
|
for (let i = 0; i < len; ++i) {
|
||||||
let item = data[i];
|
let item = data[i];
|
||||||
let result =
|
let result =
|
||||||
Services.uriFixup.createFixupURI(item.wrong,
|
urifixup.createFixupURI(item.wrong,
|
||||||
Services.uriFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS).spec;
|
urifixup.FIXUP_FLAG_FIX_SCHEME_TYPOS).spec;
|
||||||
Assert.equal(result, item.wrong);
|
Assert.equal(result, item.wrong);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -85,12 +92,12 @@ add_task(function test_false_pref_keeps_typos() {
|
||||||
// Finally, make sure we still fix what needs fixing if the pref is
|
// Finally, make sure we still fix what needs fixing if the pref is
|
||||||
// explicitly set to true.
|
// explicitly set to true.
|
||||||
add_task(function test_true_pref_fixes_typos() {
|
add_task(function test_true_pref_fixes_typos() {
|
||||||
Services.prefs.setBoolPref(pref, true);
|
prefs.setBoolPref(pref, true);
|
||||||
for (let i = 0; i < len; ++i) {
|
for (let i = 0; i < len; ++i) {
|
||||||
let item = data[i];
|
let item = data[i];
|
||||||
let result =
|
let result =
|
||||||
Services.uriFixup.createFixupURI(item.wrong,
|
urifixup.createFixupURI(item.wrong,
|
||||||
Services.uriFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS).spec;
|
urifixup.FIXUP_FLAG_FIX_SCHEME_TYPOS).spec;
|
||||||
Assert.equal(result, item.fixed);
|
Assert.equal(result, item.fixed);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
var urifixup = Cc["@mozilla.org/docshell/urifixup;1"].
|
||||||
|
getService(Ci.nsIURIFixup);
|
||||||
|
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
var prefList = ["browser.fixup.typo.scheme", "keyword.enabled",
|
var prefList = ["browser.fixup.typo.scheme", "keyword.enabled",
|
||||||
|
|
@ -37,16 +40,16 @@ registerCleanupFunction(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
var flagInputs = [
|
var flagInputs = [
|
||||||
Services.uriFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP,
|
urifixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP,
|
||||||
Services.uriFixup.FIXUP_FLAGS_MAKE_ALTERNATE_URI,
|
urifixup.FIXUP_FLAGS_MAKE_ALTERNATE_URI,
|
||||||
Services.uriFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS,
|
urifixup.FIXUP_FLAG_FIX_SCHEME_TYPOS,
|
||||||
];
|
];
|
||||||
|
|
||||||
flagInputs.concat([
|
flagInputs.concat([
|
||||||
flagInputs[0] | flagInputs[1],
|
flagInputs[0] | flagInputs[1],
|
||||||
flagInputs[1] | flagInputs[2],
|
flagInputs[1] | flagInputs[2],
|
||||||
flagInputs[0] | flagInputs[2],
|
flagInputs[0] | flagInputs[2],
|
||||||
flagInputs[0] | flagInputs[1] | flagInputs[2],
|
flagInputs[0] | flagInputs[1] | flagInputs[2]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -202,25 +205,25 @@ var testcases = [ {
|
||||||
input: "[64:ff9b::8.8.8.8]",
|
input: "[64:ff9b::8.8.8.8]",
|
||||||
fixedURI: "http://[64:ff9b::808:808]/",
|
fixedURI: "http://[64:ff9b::808:808]/",
|
||||||
alternateURI: "http://[64:ff9b::808:808]/",
|
alternateURI: "http://[64:ff9b::808:808]/",
|
||||||
protocolChange: true,
|
protocolChange: true
|
||||||
}, {
|
}, {
|
||||||
input: "[64:ff9b::8.8.8.8]/~moz",
|
input: "[64:ff9b::8.8.8.8]/~moz",
|
||||||
fixedURI: "http://[64:ff9b::808:808]/~moz",
|
fixedURI: "http://[64:ff9b::808:808]/~moz",
|
||||||
alternateURI: "http://[64:ff9b::808:808]/~moz",
|
alternateURI: "http://[64:ff9b::808:808]/~moz",
|
||||||
protocolChange: true,
|
protocolChange: true
|
||||||
}, {
|
}, {
|
||||||
input: "[::1][::1]",
|
input: "[::1][::1]",
|
||||||
keywordLookup: true,
|
keywordLookup: true,
|
||||||
protocolChange: true,
|
protocolChange: true
|
||||||
}, {
|
}, {
|
||||||
input: "[::1][100",
|
input: "[::1][100",
|
||||||
fixedURI: null,
|
fixedURI: null,
|
||||||
keywordLookup: true,
|
keywordLookup: true,
|
||||||
protocolChange: true,
|
protocolChange: true
|
||||||
}, {
|
}, {
|
||||||
input: "[::1]]",
|
input: "[::1]]",
|
||||||
keywordLookup: true,
|
keywordLookup: true,
|
||||||
protocolChange: true,
|
protocolChange: true
|
||||||
}, {
|
}, {
|
||||||
input: "1234",
|
input: "1234",
|
||||||
fixedURI: "http://0.0.4.210/",
|
fixedURI: "http://0.0.4.210/",
|
||||||
|
|
@ -341,7 +344,7 @@ var testcases = [ {
|
||||||
input: "café.local",
|
input: "café.local",
|
||||||
fixedURI: "http://xn--caf-dma.local/",
|
fixedURI: "http://xn--caf-dma.local/",
|
||||||
alternateURI: "http://www.xn--caf-dma.local/",
|
alternateURI: "http://www.xn--caf-dma.local/",
|
||||||
protocolChange: true,
|
protocolChange: true
|
||||||
}, {
|
}, {
|
||||||
input: "47.6182,-122.830",
|
input: "47.6182,-122.830",
|
||||||
fixedURI: "http://47.6182,-122.830/",
|
fixedURI: "http://47.6182,-122.830/",
|
||||||
|
|
@ -382,38 +385,38 @@ var testcases = [ {
|
||||||
}, {
|
}, {
|
||||||
input: "moz ?.::%27",
|
input: "moz ?.::%27",
|
||||||
keywordLookup: true,
|
keywordLookup: true,
|
||||||
protocolChange: true,
|
protocolChange: true
|
||||||
}, {
|
}, {
|
||||||
input: "mozilla.com/?q=search",
|
input: "mozilla.com/?q=search",
|
||||||
fixedURI: "http://mozilla.com/?q=search",
|
fixedURI: "http://mozilla.com/?q=search",
|
||||||
alternateURI: "http://www.mozilla.com/?q=search",
|
alternateURI: "http://www.mozilla.com/?q=search",
|
||||||
protocolChange: true,
|
protocolChange: true
|
||||||
}, {
|
}, {
|
||||||
input: "mozilla.com?q=search",
|
input: "mozilla.com?q=search",
|
||||||
fixedURI: "http://mozilla.com/?q=search",
|
fixedURI: "http://mozilla.com/?q=search",
|
||||||
alternateURI: "http://www.mozilla.com/?q=search",
|
alternateURI: "http://www.mozilla.com/?q=search",
|
||||||
protocolChange: true,
|
protocolChange: true
|
||||||
}, {
|
}, {
|
||||||
input: "mozilla.com ?q=search",
|
input: "mozilla.com ?q=search",
|
||||||
keywordLookup: true,
|
keywordLookup: true,
|
||||||
protocolChange: true,
|
protocolChange: true
|
||||||
}, {
|
}, {
|
||||||
input: "mozilla.com.?q=search",
|
input: "mozilla.com.?q=search",
|
||||||
fixedURI: "http://mozilla.com./?q=search",
|
fixedURI: "http://mozilla.com./?q=search",
|
||||||
protocolChange: true,
|
protocolChange: true
|
||||||
}, {
|
}, {
|
||||||
input: "mozilla.com'?q=search",
|
input: "mozilla.com'?q=search",
|
||||||
fixedURI: "http://mozilla.com'/?q=search",
|
fixedURI: "http://mozilla.com'/?q=search",
|
||||||
alternateURI: "http://www.mozilla.com'/?q=search",
|
alternateURI: "http://www.mozilla.com'/?q=search",
|
||||||
protocolChange: true,
|
protocolChange: true
|
||||||
}, {
|
}, {
|
||||||
input: "mozilla.com':search",
|
input: "mozilla.com':search",
|
||||||
keywordLookup: true,
|
keywordLookup: true,
|
||||||
protocolChange: true,
|
protocolChange: true
|
||||||
}, {
|
}, {
|
||||||
input: "[mozilla]",
|
input: "[mozilla]",
|
||||||
keywordLookup: true,
|
keywordLookup: true,
|
||||||
protocolChange: true,
|
protocolChange: true
|
||||||
}, {
|
}, {
|
||||||
input: "':?",
|
input: "':?",
|
||||||
fixedURI: "http://'/?",
|
fixedURI: "http://'/?",
|
||||||
|
|
@ -432,7 +435,7 @@ var testcases = [ {
|
||||||
}, {
|
}, {
|
||||||
input: "' ?.com",
|
input: "' ?.com",
|
||||||
keywordLookup: true,
|
keywordLookup: true,
|
||||||
protocolChange: true,
|
protocolChange: true
|
||||||
}, {
|
}, {
|
||||||
input: "?mozilla",
|
input: "?mozilla",
|
||||||
keywordLookup: true,
|
keywordLookup: true,
|
||||||
|
|
@ -575,14 +578,14 @@ function do_single_test_run() {
|
||||||
let URIInfo;
|
let URIInfo;
|
||||||
let fixupURIOnly = null;
|
let fixupURIOnly = null;
|
||||||
try {
|
try {
|
||||||
fixupURIOnly = Services.uriFixup.createFixupURI(testInput, flags);
|
fixupURIOnly = urifixup.createFixupURI(testInput, flags);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
info("Caught exception: " + ex);
|
info("Caught exception: " + ex);
|
||||||
Assert.equal(expectedFixedURI, null);
|
Assert.equal(expectedFixedURI, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
URIInfo = Services.uriFixup.getFixupURIInfo(testInput, flags);
|
URIInfo = urifixup.getFixupURIInfo(testInput, flags);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
// Both APIs should return an error in the same cases.
|
// Both APIs should return an error in the same cases.
|
||||||
info("Caught exception: " + ex);
|
info("Caught exception: " + ex);
|
||||||
|
|
@ -600,8 +603,10 @@ function do_single_test_run() {
|
||||||
Assert.equal(fixupURIOnly.spec, URIInfo.preferredURI.spec, "Fixed and preferred URI should match");
|
Assert.equal(fixupURIOnly.spec, URIInfo.preferredURI.spec, "Fixed and preferred URI should match");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let isFileURL = expectedFixedURI && expectedFixedURI.startsWith("file");
|
||||||
|
|
||||||
// Check the fixedURI:
|
// Check the fixedURI:
|
||||||
let makeAlternativeURI = flags & Services.uriFixup.FIXUP_FLAGS_MAKE_ALTERNATE_URI;
|
let makeAlternativeURI = flags & urifixup.FIXUP_FLAGS_MAKE_ALTERNATE_URI;
|
||||||
if (makeAlternativeURI && alternativeURI != null) {
|
if (makeAlternativeURI && alternativeURI != null) {
|
||||||
Assert.equal(URIInfo.fixedURI.spec, alternativeURI, "should have gotten alternate URI");
|
Assert.equal(URIInfo.fixedURI.spec, alternativeURI, "should have gotten alternate URI");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -609,7 +614,7 @@ function do_single_test_run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check booleans on input:
|
// Check booleans on input:
|
||||||
let couldDoKeywordLookup = flags & Services.uriFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
|
let couldDoKeywordLookup = flags & urifixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
|
||||||
Assert.equal(!!URIInfo.keywordProviderName, couldDoKeywordLookup && expectKeywordLookup, "keyword lookup as expected");
|
Assert.equal(!!URIInfo.keywordProviderName, couldDoKeywordLookup && expectKeywordLookup, "keyword lookup as expected");
|
||||||
Assert.equal(URIInfo.fixupChangedProtocol, expectProtocolChange, "protocol change as expected");
|
Assert.equal(URIInfo.fixupChangedProtocol, expectProtocolChange, "protocol change as expected");
|
||||||
Assert.equal(URIInfo.fixupCreatedAlternateURI, makeAlternativeURI && alternativeURI != null, "alternative URI as expected");
|
Assert.equal(URIInfo.fixupCreatedAlternateURI, makeAlternativeURI && alternativeURI != null, "alternative URI as expected");
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
var urifixup = Cc["@mozilla.org/docshell/urifixup;1"].
|
||||||
|
getService(Ci.nsIURIFixup);
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||||
|
|
||||||
|
|
@ -35,61 +37,61 @@ var isWin = AppConstants.platform == "win";
|
||||||
var data = [
|
var data = [
|
||||||
{
|
{
|
||||||
// Valid should not be changed.
|
// Valid should not be changed.
|
||||||
wrong: "https://example.com/this/is/a/test.html",
|
wrong: 'https://example.com/this/is/a/test.html',
|
||||||
fixed: "https://example.com/this/is/a/test.html",
|
fixed: 'https://example.com/this/is/a/test.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Unrecognized protocols should be changed.
|
// Unrecognized protocols should be changed.
|
||||||
wrong: "whatever://this/is/a/test.html",
|
wrong: 'whatever://this/is/a/test.html',
|
||||||
fixed: kSearchEngineURL.replace("{searchTerms}", encodeURIComponent("whatever://this/is/a/test.html")),
|
fixed: kSearchEngineURL.replace("{searchTerms}", encodeURIComponent('whatever://this/is/a/test.html')),
|
||||||
},
|
},
|
||||||
|
|
||||||
// The following tests check that when a user:password is present in the URL
|
// The following tests check that when a user:password is present in the URL
|
||||||
// `user:` isn't treated as an unknown protocol thus leaking the user and
|
// `user:` isn't treated as an unknown protocol thus leaking the user and
|
||||||
// password to the search engine.
|
// password to the search engine.
|
||||||
{
|
{
|
||||||
wrong: "user:pass@example.com/this/is/a/test.html",
|
wrong: 'user:pass@example.com/this/is/a/test.html',
|
||||||
fixed: "http://user:pass@example.com/this/is/a/test.html",
|
fixed: 'http://user:pass@example.com/this/is/a/test.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
wrong: "user@example.com:8080/this/is/a/test.html",
|
wrong: 'user@example.com:8080/this/is/a/test.html',
|
||||||
fixed: "http://user@example.com:8080/this/is/a/test.html",
|
fixed: 'http://user@example.com:8080/this/is/a/test.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
wrong: "https:pass@example.com/this/is/a/test.html",
|
wrong: 'https:pass@example.com/this/is/a/test.html',
|
||||||
fixed: "https://pass@example.com/this/is/a/test.html",
|
fixed: 'https://pass@example.com/this/is/a/test.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
wrong: "user:pass@example.com:8080/this/is/a/test.html",
|
wrong: 'user:pass@example.com:8080/this/is/a/test.html',
|
||||||
fixed: "http://user:pass@example.com:8080/this/is/a/test.html",
|
fixed: 'http://user:pass@example.com:8080/this/is/a/test.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
wrong: "http:user:pass@example.com:8080/this/is/a/test.html",
|
wrong: 'http:user:pass@example.com:8080/this/is/a/test.html',
|
||||||
fixed: "http://user:pass@example.com:8080/this/is/a/test.html",
|
fixed: 'http://user:pass@example.com:8080/this/is/a/test.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
wrong: "ttp:user:pass@example.com:8080/this/is/a/test.html",
|
wrong: 'ttp:user:pass@example.com:8080/this/is/a/test.html',
|
||||||
fixed: "http://user:pass@example.com:8080/this/is/a/test.html",
|
fixed: 'http://user:pass@example.com:8080/this/is/a/test.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
wrong: "gobbledygook:user:pass@example.com:8080/this/is/a/test.html",
|
wrong: 'gobbledygook:user:pass@example.com:8080/this/is/a/test.html',
|
||||||
fixed: "http://gobbledygook:user%3Apass@example.com:8080/this/is/a/test.html",
|
fixed: 'http://gobbledygook:user%3Apass@example.com:8080/this/is/a/test.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
wrong: "user:@example.com:8080/this/is/a/test.html",
|
wrong: 'user:@example.com:8080/this/is/a/test.html',
|
||||||
fixed: "http://user@example.com:8080/this/is/a/test.html",
|
fixed: 'http://user@example.com:8080/this/is/a/test.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
wrong: "//user:pass@example.com:8080/this/is/a/test.html",
|
wrong: '//user:pass@example.com:8080/this/is/a/test.html',
|
||||||
fixed: (isWin ? "http:" : "file://") + "//user:pass@example.com:8080/this/is/a/test.html",
|
fixed: (isWin ? "http:" : "file://") + '//user:pass@example.com:8080/this/is/a/test.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
wrong: "://user:pass@example.com:8080/this/is/a/test.html",
|
wrong: '://user:pass@example.com:8080/this/is/a/test.html',
|
||||||
fixed: "http://user:pass@example.com:8080/this/is/a/test.html",
|
fixed: 'http://user:pass@example.com:8080/this/is/a/test.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
wrong: "whatever://this/is/a@b/test.html",
|
wrong: 'whatever://this/is/a@b/test.html',
|
||||||
fixed: kSearchEngineURL.replace("{searchTerms}", encodeURIComponent("whatever://this/is/a@b/test.html")),
|
fixed: kSearchEngineURL.replace("{searchTerms}", encodeURIComponent('whatever://this/is/a@b/test.html')),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -99,18 +101,22 @@ var extProtocolSvc = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
|
||||||
if (extProtocolSvc && extProtocolSvc.externalProtocolHandlerExists("mailto")) {
|
if (extProtocolSvc && extProtocolSvc.externalProtocolHandlerExists("mailto")) {
|
||||||
data.push({
|
data.push({
|
||||||
wrong: "mailto:foo@bar.com",
|
wrong: "mailto:foo@bar.com",
|
||||||
fixed: "mailto:foo@bar.com",
|
fixed: "mailto:foo@bar.com"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function run_test() {
|
||||||
|
run_next_test();
|
||||||
|
}
|
||||||
|
|
||||||
var len = data.length;
|
var len = data.length;
|
||||||
// Make sure we fix what needs fixing
|
// Make sure we fix what needs fixing
|
||||||
add_task(function test_fix_unknown_schemes() {
|
add_task(function test_fix_unknown_schemes() {
|
||||||
for (let i = 0; i < len; ++i) {
|
for (let i = 0; i < len; ++i) {
|
||||||
let item = data[i];
|
let item = data[i];
|
||||||
let result =
|
let result =
|
||||||
Services.uriFixup.createFixupURI(item.wrong,
|
urifixup.createFixupURI(item.wrong,
|
||||||
Services.uriFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS).spec;
|
urifixup.FIXUP_FLAG_FIX_SCHEME_TYPOS).spec;
|
||||||
Assert.equal(result, item.fixed);
|
Assert.equal(result, item.fixed);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
function destroy_transient_docshell() {
|
function destroy_transient_docshell() {
|
||||||
let windowlessBrowser = Services.appShell.createWindowlessBrowser(false);
|
let windowlessBrowser = Services.appShell.createWindowlessBrowser(false);
|
||||||
windowlessBrowser.docShell.setOriginAttributes({privateBrowsingId: 1});
|
windowlessBrowser.docshell.setOriginAttributes({privateBrowsingId : 1});
|
||||||
windowlessBrowser.close();
|
windowlessBrowser.close();
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
do_timeout(0, Cu.forceGC);
|
do_timeout(0, Cu.forceGC);
|
||||||
|
|
@ -8,11 +8,12 @@ function destroy_transient_docshell() {
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
var obs = {
|
var obs = {
|
||||||
observe(aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
Assert.equal(aTopic, "last-pb-context-exited");
|
Assert.equal(aTopic, "last-pb-context-exited");
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
Services.obs.addObserver(obs, "last-pb-context-exited");
|
var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
|
||||||
|
os.addObserver(obs, "last-pb-context-exited");
|
||||||
destroy_transient_docshell();
|
destroy_transient_docshell();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,24 @@ var gNotifications = 0;
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
var observer = {
|
var observer = {
|
||||||
QueryInterface: ChromeUtils.generateQI(["nsIPrivacyTransitionObserver", "nsISupportsWeakReference"]),
|
QueryInterface: function(iid) {
|
||||||
|
if (Ci.nsIPrivacyTransitionObserver.equals(iid) ||
|
||||||
privateModeChanged(enabled) {
|
Ci.nsISupportsWeakReference.equals(iid) ||
|
||||||
gNotifications++;
|
Ci.nsISupports.equals(iid))
|
||||||
|
return this;
|
||||||
|
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||||
},
|
},
|
||||||
};
|
|
||||||
|
privateModeChanged: function(enabled) {
|
||||||
|
gNotifications++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
let windowlessBrowser = Services.appShell.createWindowlessBrowser(false);
|
let windowlessBrowser = Services.appShell.createWindowlessBrowser(false);
|
||||||
windowlessBrowser.docShell.addWeakPrivacyTransitionObserver(observer);
|
windowlessBrowser.docShell.addWeakPrivacyTransitionObserver(observer);
|
||||||
windowlessBrowser.docShell.setOriginAttributes({privateBrowsingId: 1});
|
windowlessBrowser.docShell.setOriginAttributes({privateBrowsingId : 1});
|
||||||
windowlessBrowser.docShell.setOriginAttributes({privateBrowsingId: 0});
|
windowlessBrowser.docShell.setOriginAttributes({privateBrowsingId : 0});
|
||||||
windowlessBrowser.close();
|
windowlessBrowser.close();
|
||||||
Assert.equal(gNotifications, 2);
|
Assert.equal(gNotifications, 2);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,17 @@
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
var notifications = 0;
|
var notifications = 0;
|
||||||
var obs = {
|
var obs = {
|
||||||
observe(aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
Assert.equal(aTopic, "last-pb-context-exited");
|
Assert.equal(aTopic, "last-pb-context-exited");
|
||||||
notifications++;
|
notifications++;
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
Services.os.addObserver(obs, "last-pb-context-exited");
|
var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
|
||||||
|
os.addObserver(obs, "last-pb-context-exited");
|
||||||
|
|
||||||
run_test_in_child("../unit/test_pb_notification.js",
|
run_test_in_child("../unit/test_pb_notification.js",
|
||||||
function() {
|
function() {
|
||||||
Assert.equal(notifications, 1);
|
Assert.equal(notifications, 1);
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue