Backed out changeset c2ed856658bb (bug 1753352) for causing wpt failures, a=backout

This commit is contained in:
Dianna Smith 2024-09-10 22:31:21 -04:00
parent d9d6114fcc
commit 430aacc3a9
14 changed files with 40 additions and 53 deletions

View file

@ -99,7 +99,7 @@ nsresult ContentPrincipal::GenerateOriginNoSuffixFromURI(
return NS_ERROR_FAILURE;
}
MOZ_ASSERT(!NS_IsAboutBlankAllowQueryAndFragment(origin),
MOZ_ASSERT(!NS_IsAboutBlank(origin),
"The inner URI for about:blank must be moz-safe-about:blank");
// Handle non-strict file:// uris.

View file

@ -2959,7 +2959,7 @@ bool CanonicalBrowsingContext::AllowedInBFCache(
nsCOMPtr<nsIURI> currentURI = wgp->GetDocumentURI();
// Exempt about:* pages from bfcache, with the exception of about:blank
if (currentURI->SchemeIs("about") &&
!NS_IsAboutBlankAllowQueryAndFragment(currentURI)) {
!currentURI->GetSpecOrDefault().EqualsLiteral("about:blank")) {
bfcacheCombo |= BFCacheStatus::ABOUT_PAGE;
MOZ_LOG(gSHIPBFCacheLog, LogLevel::Debug, (" * about:* page"));
}

View file

@ -10053,7 +10053,7 @@ nsIPrincipal* nsDocShell::GetInheritedPrincipal(
bool nsDocShell::IsAboutBlankLoadOntoInitialAboutBlank(
nsIURI* aURI, bool aInheritPrincipal, nsIPrincipal* aPrincipalToInherit) {
return NS_IsAboutBlankAllowQueryAndFragment(aURI) && aInheritPrincipal &&
return NS_IsAboutBlank(aURI) && aInheritPrincipal &&
(aPrincipalToInherit == GetInheritedPrincipal(false)) &&
(!mDocumentViewer || !mDocumentViewer->GetDocument() ||
mDocumentViewer->GetDocument()->IsInitialDocument());

View file

@ -7412,8 +7412,7 @@ bool nsContentUtils::ChannelShouldInheritPrincipal(
// we're checking for things that will use the owner.
inherit =
(NS_SUCCEEDED(URIInheritsSecurityContext(aURI, &uriInherits)) &&
(uriInherits || (aInheritForAboutBlank &&
NS_IsAboutBlankAllowQueryAndFragment(aURI)))) ||
(uriInherits || (aInheritForAboutBlank && NS_IsAboutBlank(aURI)))) ||
//
// file: uri special-casing
//

View file

@ -1861,9 +1861,12 @@ nsresult nsGlobalWindowInner::EnsureClientSource() {
bool ignoreLoadInfo = false;
// Note, this is mostly copied from NS_IsAboutBlank(). Its duplicated
// here so we can efficiently check about:srcdoc as well.
if (uri->SchemeIs("about")) {
ignoreLoadInfo =
NS_IsAboutBlankAllowQueryAndFragment(uri) || NS_IsAboutSrcdoc(uri);
nsCString spec = uri->GetSpecOrDefault();
ignoreLoadInfo = spec.EqualsLiteral("about:blank") ||
spec.EqualsLiteral("about:srcdoc");
} else {
// Its not an about: URL, so now check for our other URL types.
ignoreLoadInfo = uri->SchemeIs("data") || uri->SchemeIs("blob");

View file

@ -21,7 +21,6 @@
#include "mozilla/StorageAccess.h"
#include "nsIGlobalObject.h"
#include "nsString.h"
#include "nsReadableUtils.h"
namespace mozilla::dom {
@ -213,9 +212,7 @@ already_AddRefed<Promise> Clients::OpenWindow(const nsAString& aURL,
return outerPromise.forget();
}
if (aURL.EqualsLiteral(u"about:blank") ||
StringBeginsWith(aURL, u"about:blank?"_ns) ||
StringBeginsWith(aURL, u"about:blank#"_ns)) {
if (aURL.EqualsLiteral("about:blank")) {
CopyableErrorResult rv;
rv.ThrowTypeError(
"Passing \"about:blank\" to Clients.openWindow is not allowed");

View file

@ -224,7 +224,7 @@ RefPtr<ClientOpPromise> ClientNavigateOpChild::DoNavigate(
return ClientOpPromise::CreateAndReject(result, __func__);
}
if (NS_IsAboutBlankAllowQueryAndFragment(url)) {
if (url->GetSpecOrDefault().EqualsLiteral("about:blank")) {
CopyableErrorResult result;
result.ThrowTypeError("Navigation to \"about:blank\" is not allowed");
return ClientOpPromise::CreateAndReject(result, __func__);

View file

@ -339,8 +339,12 @@ nsresult nsHTMLDocument::StartDocumentLoad(
// mDocumentURI hasn't been set, yet, so get the URI from the channel
nsCOMPtr<nsIURI> uri;
aChannel->GetOriginalURI(getter_AddRefs(uri));
if (NS_IsAboutBlankAllowQueryAndFragment(uri)) {
loadAsHtml5 = false;
// Adapted from nsDocShell:
// GetSpec can be expensive for some URIs, so check the scheme first.
if (uri && uri->SchemeIs("about")) {
if (uri->GetSpecOrDefault().EqualsLiteral("about:blank")) {
loadAsHtml5 = false;
}
}
}

View file

@ -23,7 +23,6 @@
#include "mozilla/StoragePrincipalHelper.h"
#include "mozilla/TaskQueue.h"
#include "mozilla/Telemetry.h"
#include "nsAboutProtocolUtils.h"
#include "nsBufferedStreams.h"
#include "nsCategoryCache.h"
#include "nsComponentManagerUtils.h"
@ -2804,20 +2803,6 @@ bool NS_IsAboutBlank(nsIURI* uri) {
return spec.EqualsLiteral("about:blank");
}
bool NS_IsAboutBlankAllowQueryAndFragment(nsIURI* uri) {
// GetSpec can be expensive for some URIs, so check the scheme first.
if (!uri->SchemeIs("about")) {
return false;
}
nsAutoCString name;
if (NS_FAILED(NS_GetAboutModuleName(uri, name))) {
return false;
}
return name.EqualsLiteral("blank");
}
bool NS_IsAboutSrcdoc(nsIURI* uri) {
// GetSpec can be expensive for some URIs, so check the scheme first.
if (!uri->SchemeIs("about")) {

View file

@ -875,12 +875,6 @@ void net_EnsurePSMInit();
*/
bool NS_IsAboutBlank(nsIURI* uri);
/**
* Test whether a URI is "about:blank", possibly with fragment or query. |uri|
* must not be null
*/
bool NS_IsAboutBlankAllowQueryAndFragment(nsIURI* uri);
/**
* Test whether a URI is "about:srcdoc". |uri| must not be null
*/

View file

@ -239,8 +239,6 @@ class nsParser final : public nsIParser,
void HandleParserContinueEvent(class nsParserContinueEvent*);
void Reset() {
MOZ_ASSERT(!mIsAboutBlank,
"Only the XML fragment parsing case is supposed to call this.");
Cleanup();
mUnusedInput.Truncate();
Initialize();

View file

@ -2,19 +2,19 @@
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[load & pageshow event do not fire on contentWindow of <iframe> element created with no src]
expected: [FAIL, PASS]
expected:
if (os == "win") and swgl: [FAIL, PASS]
if os == "linux": [FAIL, PASS]
FAIL
[load & pageshow events do not fire on contentWindow of <iframe> element created with src='']
expected: [FAIL, PASS]
expected:
if os == "linux": [FAIL, PASS]
FAIL
[load & pageshow events do not fire on contentWindow of <iframe> element created with src='about:blank']
expected: [FAIL, PASS]
[load & pageshow events do not fire on contentWindow of <iframe> element created with src='about:blank#foo']
expected: [FAIL, PASS]
[load & pageshow events do not fire on contentWindow of <iframe> element created with src='about:blank?foo']
expected: [FAIL, PASS]
[load event does not fire on window.open('about:blank?foo')]
expected: [FAIL, PASS]
expected:
if (os == "linux") and debug and not fission and swgl: [FAIL, PASS]
if (os == "linux") and debug and fission: [FAIL, PASS]
if (os == "linux") and not debug: [FAIL, PASS]
FAIL

View file

@ -1,6 +1,10 @@
[load-pageshow-events-window-open.html]
[load event does not fire on window.open('about:blank')]
expected: [FAIL, PASS]
[load event does not fire on window.open('about:blank?foo')]
expected: [FAIL, PASS]
expected:
if (os == "linux") and not swgl and fission and not debug and (processor == "x86"): [FAIL, PASS]
if (os == "linux") and not swgl and fission and not debug and (processor == "x86_64"): [FAIL, PASS]
if (os == "linux") and not swgl and fission and debug: [FAIL, PASS]
if (os == "linux") and swgl and not fission: [FAIL, PASS]
if os == "win": FAIL
if os == "mac": FAIL
[PASS, FAIL]

View file

@ -0,0 +1,3 @@
[matches-about-blank-base-url.window.html]
[about:blank and about:blank?foo#bar both 'match about:blank']
expected: FAIL