зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset bb1f3463f21d (bug 1804684
) for causing Bug 1823765 a=backout
This commit is contained in:
Родитель
dd2fe65d79
Коммит
678c52f5e7
|
@ -8713,35 +8713,14 @@ bool nsDocShell::IsSameDocumentNavigation(nsDocShellLoadState* aLoadState,
|
|||
// fact that the new URI is currently http), then set mSameExceptHashes to
|
||||
// true and only perform a fragment navigation.
|
||||
if (!aState.mSameExceptHashes) {
|
||||
if (nsCOMPtr<nsIChannel> docChannel = GetCurrentDocChannel()) {
|
||||
nsCOMPtr<nsIChannel> docChannel = GetCurrentDocChannel();
|
||||
if (docChannel) {
|
||||
nsCOMPtr<nsILoadInfo> docLoadInfo = docChannel->LoadInfo();
|
||||
if (!docLoadInfo->GetLoadErrorPage() &&
|
||||
nsHTTPSOnlyUtils::IsEqualURIExceptSchemeAndRef(
|
||||
currentExposableURI, aLoadState->URI(), docLoadInfo)) {
|
||||
uint32_t status = docLoadInfo->GetHttpsOnlyStatus();
|
||||
if (status & (nsILoadInfo::HTTPS_ONLY_UPGRADED_LISTENER_REGISTERED |
|
||||
nsILoadInfo::HTTPS_ONLY_UPGRADED_HTTPS_FIRST)) {
|
||||
// At this point the requested URI is for sure a fragment
|
||||
// navigation via HTTP and HTTPS-Only mode or HTTPS-First is
|
||||
// enabled. Also it is not interfering the upgrade order of
|
||||
// https://searchfox.org/mozilla-central/source/netwerk/base/nsNetUtil.cpp#2948-2953.
|
||||
// Since we are on an HTTPS site the fragment
|
||||
// navigation should also be an HTTPS.
|
||||
// For that reason we upgrade the URI to HTTPS.
|
||||
nsCOMPtr<nsIURI> upgradedURI;
|
||||
NS_GetSecureUpgradedURI(aLoadState->URI(),
|
||||
getter_AddRefs(upgradedURI));
|
||||
aLoadState->SetURI(upgradedURI);
|
||||
|
||||
#ifdef DEBUG
|
||||
bool sameExceptHashes = false;
|
||||
currentExposableURI->EqualsExceptRef(aLoadState->URI(),
|
||||
&sameExceptHashes);
|
||||
MOZ_ASSERT(sameExceptHashes);
|
||||
#endif
|
||||
if (!docLoadInfo->GetLoadErrorPage()) {
|
||||
if (nsHTTPSOnlyUtils::IsEqualURIExceptSchemeAndRef(
|
||||
currentExposableURI, aLoadState->URI(), docLoadInfo)) {
|
||||
aState.mSameExceptHashes = true;
|
||||
}
|
||||
|
||||
aState.mSameExceptHashes = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1062,9 +1062,6 @@ class nsDocShell final : public nsDocLoader,
|
|||
|
||||
// Check to see if we're loading a prior history entry or doing a fragment
|
||||
// navigation in the same document.
|
||||
// NOTE: In case we are doing a fragment navigation, and HTTPS-Only/ -First
|
||||
// mode is enabled and upgraded the underlying document, we update the URI of
|
||||
// aLoadState from HTTP to HTTPS (if neccessary).
|
||||
bool IsSameDocumentNavigation(nsDocShellLoadState* aLoadState,
|
||||
SameDocumentNavigationState& aState);
|
||||
|
||||
|
|
|
@ -26,9 +26,8 @@ window.onload = function (){
|
|||
window.onscroll = function(){
|
||||
window.opener.postMessage({
|
||||
info: "scrolled-to-foo",
|
||||
result: window.location.href,
|
||||
result: window.location.hash,
|
||||
button: true,
|
||||
documentURI: document.documentURI,
|
||||
}, "*");
|
||||
}
|
||||
|
||||
|
|
|
@ -35,9 +35,8 @@ async function receiveMessage(event) {
|
|||
|
||||
// Once the button was clicked we know the tast has finished
|
||||
ok(data.button, "button is clicked");
|
||||
is(data.result, EXPECT_URL + "#foo", "location (hash) is correct");
|
||||
ok(data.result == "#foo", "location (hash) is correct");
|
||||
ok(data.info == "scrolled-to-foo","Scrolled successfully without reloading!");
|
||||
is(data.documentURI, EXPECT_URL + "#foo", "Document URI is correct");
|
||||
window.removeEventListener("message",receiveMessage);
|
||||
winTest.close();
|
||||
SimpleTest.finish();
|
||||
|
|
|
@ -31,9 +31,8 @@ window.onload = function (){
|
|||
window.onscroll = function(){
|
||||
window.opener.postMessage({
|
||||
info: "scrolled-to-foo",
|
||||
result: window.location.href,
|
||||
result: window.location.hash,
|
||||
button: true,
|
||||
documentURI: document.documentURI,
|
||||
}, "*");
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
const REQUEST_URL = "http://example.com/tests/dom/security/test/https-only/file_fragment.html";
|
||||
const EXPECT_URL = REQUEST_URL.replace("http://", "https://");
|
||||
let winTest = null;
|
||||
let checkButtonClicked = false;
|
||||
|
||||
|
@ -36,7 +35,7 @@ async function receiveMessage(event) {
|
|||
// checks if click was successful
|
||||
if (!checkButtonClicked){
|
||||
// expected window location ( expected URL)
|
||||
ok(data.result == EXPECT_URL, "location is correct");
|
||||
ok(data.result == "https://example.com/tests/dom/security/test/https-only/file_fragment.html", "location is correct");
|
||||
ok(data.button, "button is clicked");
|
||||
// checks if loading was successful
|
||||
ok(data.info == "onload", "Onloading worked");
|
||||
|
@ -47,10 +46,9 @@ async function receiveMessage(event) {
|
|||
// if Button was clicked once -> test finished
|
||||
// check if hash exist and if hash of location is correct
|
||||
ok(data.button, "button is clicked");
|
||||
ok(data.result == EXPECT_URL + "#foo", "location (hash) is correct");
|
||||
ok(data.result == "#foo", "location (hash) is correct");
|
||||
// check that page is scrolled not reloaded
|
||||
ok(data.info == "scrolled-to-foo","Scrolled successfully without reloading!");
|
||||
is(data.documentURI, EXPECT_URL + "#foo", "Document URI is correct");
|
||||
// complete test and close window
|
||||
window.removeEventListener("message",receiveMessage);
|
||||
winTest.close();
|
||||
|
|
|
@ -495,7 +495,8 @@ interface nsILoadInfo : nsISupports
|
|||
const unsigned long HTTPS_ONLY_DO_NOT_LOG_TO_CONSOLE = (1 << 6);
|
||||
|
||||
/**
|
||||
* This flag indicates that the request was upgraded by https-first mode.
|
||||
* This flag indicates that the request should not be logged to the
|
||||
* console.
|
||||
*/
|
||||
const unsigned long HTTPS_ONLY_UPGRADED_HTTPS_FIRST = (1 << 7);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче