diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-05-31 09:45:25 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-05-31 09:45:25 +0200 |
commit | 2d4ff8df91414b42974c72b2870f5c6e9ad397a8 (patch) | |
tree | 15b23dc6494a147e723cfdb3765be1568cf6c113 /docshell | |
parent | f4b8be889cb7ee31a62af5660f36aaa192599009 (diff) | |
parent | 14eb8dc7bee8670e39d1199591d335579601f2ad (diff) | |
download | UXP-2d4ff8df91414b42974c72b2870f5c6e9ad397a8.tar UXP-2d4ff8df91414b42974c72b2870f5c6e9ad397a8.tar.gz UXP-2d4ff8df91414b42974c72b2870f5c6e9ad397a8.tar.lz UXP-2d4ff8df91414b42974c72b2870f5c6e9ad397a8.tar.xz UXP-2d4ff8df91414b42974c72b2870f5c6e9ad397a8.zip |
Merge branch 'master' into Basilisk-release
Diffstat (limited to 'docshell')
-rw-r--r-- | docshell/base/nsDocShell.cpp | 21 | ||||
-rw-r--r-- | docshell/test/navigation/file_bug1379762-1.html | 32 | ||||
-rw-r--r-- | docshell/test/navigation/file_bug1379762-2.html | 43 | ||||
-rw-r--r-- | docshell/test/navigation/mochitest.ini | 1 | ||||
-rw-r--r-- | docshell/test/navigation/test_sessionhistory.html | 4 |
5 files changed, 79 insertions, 22 deletions
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index b3e26da33..8eca47495 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -9961,27 +9961,6 @@ nsDocShell::InternalLoad(nsIURI* aURI, return NS_ERROR_CONTENT_BLOCKED; } - - // If HSTS priming was set by nsMixedContentBlocker::ShouldLoad, and we - // would block due to mixed content, go ahead and block here. If we try to - // proceed with priming, we will error out later on. - nsCOMPtr<nsIDocShell> docShell = NS_CP_GetDocShellFromContext(requestingContext); - // When loading toplevel windows, requestingContext can be null. We don't - // really care about HSTS in that situation, though; loads in toplevel - // windows should all be browser UI. - if (docShell) { - nsIDocument* document = docShell->GetDocument(); - NS_ENSURE_TRUE(document, NS_OK); - - HSTSPrimingState state = document->GetHSTSPrimingStateForLocation(aURI); - if (state == HSTSPrimingState::eHSTS_PRIMING_BLOCK) { - // HSTS Priming currently disabled for InternalLoad, so we need to clear - // the location that was added by nsMixedContentBlocker::ShouldLoad - // Bug 1269815 will address images loaded via InternalLoad - document->ClearHSTSPrimingLocation(aURI); - return NS_ERROR_CONTENT_BLOCKED; - } - } } nsCOMPtr<nsIPrincipal> principalToInherit = aPrincipalToInherit; diff --git a/docshell/test/navigation/file_bug1379762-1.html b/docshell/test/navigation/file_bug1379762-1.html new file mode 100644 index 000000000..e8cd8b30b --- /dev/null +++ b/docshell/test/navigation/file_bug1379762-1.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Bug 1379762</title> + </head> + <img srcset> <!-- This tries to add load blockers during bfcache restoration --> + <script> + onunload = null; // enable bfcache + opener.is(opener.testCount, 0, + "We should only run once; otherwise the loadCount variable makes no sense"); + var loadCount = 0; + onpageshow = function() { + ++opener.testCount; + if (opener.testCount == 1) { + // Navigate forward and then back. + setTimeout(function() { location = "goback.html"; }, 0); + } else if (opener.testCount == 2) { + // Do this async so our load event gets a chance to fire if it plans to + // do it. + setTimeout(function() { + opener.nextTest(); + window.close(); + }); + } + }; + onload = function() { + ++loadCount; + opener.is(loadCount, 1, "Should only get one onload"); + } + </script> +</html> diff --git a/docshell/test/navigation/file_bug1379762-2.html b/docshell/test/navigation/file_bug1379762-2.html new file mode 100644 index 000000000..86033cb2e --- /dev/null +++ b/docshell/test/navigation/file_bug1379762-2.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Bug 1379762</title> + </head> + <script type="text/just-data"> + onunload = null; // enable bfcache + ++opener.testCount; + onpageshow = function(e) { + opener.ok(!e.persisted, "Pageshow should not be coming from bfcache " + opener.testCount); + } + if (opener.testCount == 1) { + onload = function () { + setTimeout(function() { + document.write(testScript); + }, 0); + } + } else if (opener.testCount == 2) { + // Do this async, just in case. + setTimeout(function() { + history.back(); + }, 0); + } else if (opener.testCount == 3) { + // Do this async, just in case. + setTimeout(function() { + history.forward(); + }, 0); + } else if (opener.testCount == 4) { + onload = function() { + opener.nextTest(); + window.close(); + } + } + </script> + <script> + 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 + // get at it later. + var testScript = "<script>" + data + "</" + "script>"; + document.write(testScript); + </script> +</html> diff --git a/docshell/test/navigation/mochitest.ini b/docshell/test/navigation/mochitest.ini index 1b5f33c7f..8cff81ad1 100644 --- a/docshell/test/navigation/mochitest.ini +++ b/docshell/test/navigation/mochitest.ini @@ -59,6 +59,7 @@ skip-if = (toolkit == 'android') || (!debug && (os == 'mac' || os == 'win')) # B skip-if = (toolkit == 'android') || (debug && e10s) #too slow on Android 4.3 aws only; bug 1030403; bug 1263213 for debug e10s [test_sessionhistory.html] skip-if = toolkit == 'android' #RANDOM +support-files = file_bug1379762-1.html file_bug1379762-2.html [test_sibling-matching-parent.html] [test_sibling-off-domain.html] [test_triggeringprincipal_frame_nav.html] diff --git a/docshell/test/navigation/test_sessionhistory.html b/docshell/test/navigation/test_sessionhistory.html index 452271a41..10b0cbcaf 100644 --- a/docshell/test/navigation/test_sessionhistory.html +++ b/docshell/test/navigation/test_sessionhistory.html @@ -31,7 +31,9 @@ var testFiles = "file_nested_frames.html", "file_shiftReload_and_pushState.html", "file_scrollRestoration.html", - "file_bug1300461.html" + "file_bug1300461.html", + "file_bug1379762-1.html", + "file_bug1379762-2.html", ]; var testCount = 0; // Used by the test files. |