summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorathenian200 <athenian200@outlook.com>2020-09-06 13:51:08 -0500
committerathenian200 <athenian200@outlook.com>2020-09-06 13:51:08 -0500
commit6d1d20f4828b34a143ca0e53060d6bb5761585ce (patch)
treef2d2c4387b8548b6693340c66064d90dd2df23b7
parent3ece02b74cd1cb02da794b9f540097a12f222af5 (diff)
downloaduxp-6d1d20f4828b34a143ca0e53060d6bb5761585ce.tar.gz
Issue mcp-graveyard/UXP#1629 - Part 4: Ensure isExplicitlyEnabled is false upon sheet creation.
This clarifies the assumptions the code is making and the order in which the variables pass through the loading process. The new variable is set after the sheet is created and prepared, and is assumed to be false in the beginning.
-rw-r--r--layout/style/Loader.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp
index c211992381..5ca319b3f5 100644
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -2273,7 +2273,8 @@ Loader::LoadChildSheet(StyleSheet* aParentSheet,
state = eSheetComplete;
} else {
bool isAlternate;
- bool isExplicitlyEnabled;
+ // For now, child sheets are not explicitly enabled.
+ bool isExplicitlyEnabled = false;
const nsSubstring& empty = EmptyString();
// For now, use CORS_NONE for child sheets
rv = CreateSheet(aURL, nullptr, principal,
@@ -2397,7 +2398,9 @@ Loader::InternalLoadNonDocumentSheet(nsIURI* aURL,
StyleSheetState state;
bool isAlternate;
- bool isExplicitlyEnabled;
+ // Sheets can only be explicitly enabled after creation and preparation, so
+ // set isExplicitlyEnabled to false.
+ bool isExplicitlyEnabled = false;
RefPtr<StyleSheet> sheet;
bool syncLoad = (aObserver == nullptr);
const nsSubstring& empty = EmptyString();