mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 04:38:02 +00:00
Bug 1273255 - Don't try alternate URIs at the end of pageload if the channel was redirected: we don't want to be applying that sort of fixup to the redirect target URI. r=smaug
This commit is contained in:
parent
ee97bc5aed
commit
23ed0206bf
@ -7761,6 +7761,16 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
|
||||
doCreateAlternate = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (doCreateAlternate) {
|
||||
// Skip doing this if our channel was redirected, because we
|
||||
// shouldn't be guessing things about the post-redirect URI.
|
||||
nsLoadFlags loadFlags = 0;
|
||||
if (NS_FAILED(aChannel->GetLoadFlags(&loadFlags)) ||
|
||||
(loadFlags & nsIChannel::LOAD_REPLACE)) {
|
||||
doCreateAlternate = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (doCreateAlternate) {
|
||||
newURI = nullptr;
|
||||
|
@ -76,6 +76,9 @@ skip-if = buildapp == 'mulet'
|
||||
[browser_bug852909.js]
|
||||
[browser_bug92473.js]
|
||||
[browser_uriFixupIntegration.js]
|
||||
[browser_uriFixupAlternateRedirects.js]
|
||||
support-files =
|
||||
redirect_to_example.sjs
|
||||
[browser_loadDisallowInherit.js]
|
||||
[browser_loadURI.js]
|
||||
[browser_multiple_pushState.js]
|
||||
|
24
docshell/test/browser/browser_uriFixupAlternateRedirects.js
Normal file
24
docshell/test/browser/browser_uriFixupAlternateRedirects.js
Normal file
@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
const REDIRECTURL = "http://www.example.com/browser/docshell/test/browser/redirect_to_example.sjs"
|
||||
|
||||
add_task(function* () {
|
||||
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
|
||||
gURLBar.value = REDIRECTURL;
|
||||
gURLBar.select();
|
||||
let errorPageLoaded = BrowserTestUtils.waitForErrorPage(tab.linkedBrowser);
|
||||
EventUtils.sendKey("return");
|
||||
yield errorPageLoaded;
|
||||
let [contentURL, originalURL] = yield ContentTask.spawn(tab.linkedBrowser, null, () => {
|
||||
return [
|
||||
content.document.documentURI,
|
||||
content.document.mozDocumentURIIfNotForErrorPages.spec,
|
||||
];
|
||||
});
|
||||
info("Page that loaded: " + contentURL);
|
||||
ok(contentURL.startsWith("about:neterror?"), "Should be on an error page");
|
||||
originalURL = new URL(originalURL);
|
||||
is(originalURL.host, "example", "Should be an error for http://example, not http://www.example.com/");
|
||||
|
||||
yield BrowserTestUtils.removeTab(tab);
|
||||
});
|
4
docshell/test/browser/redirect_to_example.sjs
Normal file
4
docshell/test/browser/redirect_to_example.sjs
Normal file
@ -0,0 +1,4 @@
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 302, "Moved Permanently");
|
||||
response.setHeader("Location", "http://example");
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user