diff options
author | Moonchild <moonchild@palemoon.org> | 2020-08-18 12:17:17 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-18 12:17:17 +0000 |
commit | 7ca7fe802e62eb1e361f54b165a102b042e8c1f3 (patch) | |
tree | 074718a27d8e292409cc9f46199c78523e8809b2 /dom/base | |
parent | 56f8262c8e4e84e9d6b0d6da72ab39cd8e0b2751 (diff) | |
parent | 2372e190256bef645b5dddb6af9b0c1ee14cf846 (diff) | |
download | UXP-7ca7fe802e62eb1e361f54b165a102b042e8c1f3.tar UXP-7ca7fe802e62eb1e361f54b165a102b042e8c1f3.tar.gz UXP-7ca7fe802e62eb1e361f54b165a102b042e8c1f3.tar.lz UXP-7ca7fe802e62eb1e361f54b165a102b042e8c1f3.tar.xz UXP-7ca7fe802e62eb1e361f54b165a102b042e8c1f3.zip |
Merge pull request #1632 from athenian200/link_element_disabled
Respond to disabled attribute set on <link> elements from HTML
Diffstat (limited to 'dom/base')
-rw-r--r-- | dom/base/nsContentSink.cpp | 5 | ||||
-rw-r--r-- | dom/base/nsStyleLinkElement.cpp | 8 | ||||
-rw-r--r-- | dom/base/nsStyleLinkElement.h | 3 |
3 files changed, 10 insertions, 6 deletions
diff --git a/dom/base/nsContentSink.cpp b/dom/base/nsContentSink.cpp index 1e6465a1b..59f4a9f9a 100644 --- a/dom/base/nsContentSink.cpp +++ b/dom/base/nsContentSink.cpp @@ -789,13 +789,14 @@ nsContentSink::ProcessStyleLink(nsIContent* aElement, // If this is a fragment parser, we don't want to observe. // We don't support CORS for processing instructions bool isAlternate; + bool isExplicitlyEnabled; rv = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, aAlternate, CORS_NONE, mDocument->GetReferrerPolicy(), integrity, mRunsToCompletion ? nullptr : this, - &isAlternate); + &isAlternate, &isExplicitlyEnabled); NS_ENSURE_SUCCESS(rv, rv); - if (!isAlternate && !mRunsToCompletion) { + if ((!isAlternate || isExplicitlyEnabled) && !mRunsToCompletion) { ++mPendingSheetCount; mScriptLoader->AddParserBlockingScriptExecutionBlocker(); } diff --git a/dom/base/nsStyleLinkElement.cpp b/dom/base/nsStyleLinkElement.cpp index 8ab2dab0b..2e5cdac6f 100644 --- a/dom/base/nsStyleLinkElement.cpp +++ b/dom/base/nsStyleLinkElement.cpp @@ -393,8 +393,9 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument, nsAutoString title, type, media; bool isScoped; bool isAlternate; + bool isExplicitlyEnabled; - GetStyleSheetInfo(title, type, media, &isScoped, &isAlternate); + GetStyleSheetInfo(title, type, media, &isScoped, &isAlternate, &isExplicitlyEnabled); if (!type.LowerCaseEqualsLiteral("text/css")) { return NS_OK; @@ -425,7 +426,7 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument, // Parse the style sheet. rv = doc->CSSLoader()-> LoadInlineStyle(thisContent, text, mLineNumber, title, media, - scopeElement, aObserver, &doneLoading, &isAlternate); + scopeElement, aObserver, &doneLoading, &isAlternate, &isExplicitlyEnabled); } else { nsAutoString integrity; @@ -452,13 +453,14 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument, rv = doc->CSSLoader()-> LoadStyleLink(thisContent, clonedURI, title, media, isAlternate, GetCORSMode(), referrerPolicy, integrity, - aObserver, &isAlternate); + aObserver, &isAlternate, &isExplicitlyEnabled); if (NS_FAILED(rv)) { // Don't propagate LoadStyleLink() errors further than this, since some // consumers (e.g. nsXMLContentSink) will completely abort on innocuous // things like a stylesheet load being blocked by the security system. doneLoading = true; isAlternate = false; + isExplicitlyEnabled = false; rv = NS_OK; } } diff --git a/dom/base/nsStyleLinkElement.h b/dom/base/nsStyleLinkElement.h index a41ae5e1d..d9042c756 100644 --- a/dom/base/nsStyleLinkElement.h +++ b/dom/base/nsStyleLinkElement.h @@ -98,7 +98,8 @@ protected: nsAString& aType, nsAString& aMedia, bool* aIsScoped, - bool* aIsAlternate) = 0; + bool* aIsAlternate, + bool* aIsExplicitlyEnabled) = 0; virtual mozilla::CORSMode GetCORSMode() const { |