summaryrefslogtreecommitdiffstats
path: root/dom/base
diff options
context:
space:
mode:
authorathenian200 <athenian200@outlook.com>2020-08-11 05:27:40 -0500
committerathenian200 <athenian200@outlook.com>2020-08-13 01:09:58 -0500
commit68623263573f5a087ad878f1609de272cc617399 (patch)
treee736e47a0d896d784749c2d940d838579dad623e /dom/base
parenta9f337ea7ca1e8743c3f38645c525751a479a561 (diff)
downloadUXP-68623263573f5a087ad878f1609de272cc617399.tar
UXP-68623263573f5a087ad878f1609de272cc617399.tar.gz
UXP-68623263573f5a087ad878f1609de272cc617399.tar.lz
UXP-68623263573f5a087ad878f1609de272cc617399.tar.xz
UXP-68623263573f5a087ad878f1609de272cc617399.zip
Issue #1629 - Part 2: Implement the Explicitly Enabled flag.
This part of the bug was significantly complicated by the following major refactors: https://bugzilla.mozilla.org/show_bug.cgi?id=1456435 https://bugzilla.mozilla.org/show_bug.cgi?id=1459498 As best as I can tell, we just need to implement the explicitly enabled flag on every instance of GetStyleSheetInfo, make sure aIsExplicitlyEnabled is false in every situation except the one where the disabled content attribute is removed from a link element, and enable alternate stylesheets if this flag is set on them. So we take the explicitly enabled flag as an input to PrepareSheet, and also add it to LoadStyleLink and LoadInlineStyle. I also decided not to defer loading of alternate stylesheets that have been explicitly enabled.
Diffstat (limited to 'dom/base')
-rw-r--r--dom/base/nsContentSink.cpp5
-rw-r--r--dom/base/nsStyleLinkElement.cpp8
-rw-r--r--dom/base/nsStyleLinkElement.h3
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
{