зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1114040 - Test for bug 1114040 (r=ttaubert)
This commit is contained in:
Родитель
a98467ac06
Коммит
9bcda8d560
|
@ -48,6 +48,10 @@ support-files =
|
|||
browser_739531_sample.html
|
||||
browser_911547_sample.html
|
||||
browser_911547_sample.html^headers^
|
||||
restore_redirect_http.html
|
||||
restore_redirect_http.html^headers^
|
||||
restore_redirect_js.html
|
||||
restore_redirect_target.html
|
||||
|
||||
#NB: the following are disabled
|
||||
# browser_464620_a.html
|
||||
|
@ -85,6 +89,7 @@ skip-if = buildapp == 'mulet'
|
|||
[browser_merge_closed_tabs.js]
|
||||
[browser_pageStyle.js]
|
||||
[browser_privatetabs.js]
|
||||
[browser_restore_redirect.js]
|
||||
[browser_scrollPositions.js]
|
||||
[browser_sessionHistory.js]
|
||||
# Disabled because of bug 1077581
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
"use strict";
|
||||
|
||||
const BASE = "http://example.com/browser/browser/components/sessionstore/test/";
|
||||
const TARGET = BASE + "restore_redirect_target.html";
|
||||
|
||||
/**
|
||||
* Ensure that a http redirect leaves a working tab.
|
||||
*/
|
||||
add_task(function check_http_redirect() {
|
||||
let state = {
|
||||
entries: [{ url: BASE + "restore_redirect_http.html" }]
|
||||
};
|
||||
|
||||
// Open a new tab to restore into.
|
||||
let tab = gBrowser.addTab("about:blank");
|
||||
let browser = tab.linkedBrowser;
|
||||
yield promiseTabState(tab, state);
|
||||
|
||||
info("Restored tab");
|
||||
|
||||
TabState.flush(browser);
|
||||
let data = TabState.collect(tab);
|
||||
is(data.entries.length, 1, "Should be one entry in session history");
|
||||
is(data.entries[0].url, TARGET, "Should be the right session history entry");
|
||||
|
||||
ok(!("__SS_data" in browser), "Temporary restore data should have been cleared");
|
||||
|
||||
// Cleanup.
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
||||
|
||||
/**
|
||||
* Ensure that a js redirect leaves a working tab.
|
||||
*/
|
||||
add_task(function check_js_redirect() {
|
||||
let state = {
|
||||
entries: [{ url: BASE + "restore_redirect_js.html" }]
|
||||
};
|
||||
|
||||
let loadPromise = new Promise(resolve => {
|
||||
function listener(msg) {
|
||||
if (msg.data.url.endsWith("restore_redirect_target.html")) {
|
||||
window.messageManager.removeMessageListener("ss-test:loadEvent", listener);
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
|
||||
window.messageManager.addMessageListener("ss-test:loadEvent", listener);
|
||||
});
|
||||
|
||||
// Open a new tab to restore into.
|
||||
let tab = gBrowser.addTab("about:blank");
|
||||
let browser = tab.linkedBrowser;
|
||||
yield promiseTabState(tab, state);
|
||||
|
||||
info("Restored tab");
|
||||
|
||||
yield loadPromise;
|
||||
|
||||
TabState.flush(browser);
|
||||
let data = TabState.collect(tab);
|
||||
is(data.entries.length, 1, "Should be one entry in session history");
|
||||
is(data.entries[0].url, TARGET, "Should be the right session history entry");
|
||||
|
||||
ok(!("__SS_data" in browser), "Temporary restore data should have been cleared");
|
||||
|
||||
// Cleanup.
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
|
@ -261,5 +261,5 @@ addMessageListener("ss-test:run", function({data, objects}) {
|
|||
|
||||
addEventListener("load", function(event) {
|
||||
let subframe = event.target != content.document;
|
||||
sendAsyncMessage("ss-test:loadEvent", {subframe: subframe});
|
||||
sendAsyncMessage("ss-test:loadEvent", {subframe: subframe, url: event.target.documentURI});
|
||||
}, true);
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
HTTP 302 Moved Temporarily
|
||||
Location: restore_redirect_target.html
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
var newLocation = window.location.toString().replace("restore_redirect_js.html", "restore_redirect_target.html");
|
||||
window.location.replace(newLocation);
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Test page</title>
|
||||
</head>
|
||||
<body>Test page</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче