summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dom/html/HTMLLinkElement.cpp25
-rw-r--r--modules/libpref/init/all.js8
2 files changed, 26 insertions, 7 deletions
diff --git a/dom/html/HTMLLinkElement.cpp b/dom/html/HTMLLinkElement.cpp
index 352cbc755..c2972784c 100644
--- a/dom/html/HTMLLinkElement.cpp
+++ b/dom/html/HTMLLinkElement.cpp
@@ -33,6 +33,8 @@
#define LINK_ELEMENT_FLAG_BIT(n_) \
NODE_FLAG_BIT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + (n_))
+#define LINK_DISABLED Preferences::GetBool("dom.link.disabled_attribute.enabled", true)
+
// Link element specific bits
enum {
// Indicates that a DNS Prefetch has been requested from this Link element.
@@ -92,10 +94,13 @@ NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement)
NS_IMPL_ELEMENT_CLONE(HTMLLinkElement)
+
bool
HTMLLinkElement::Disabled() const
{
- return GetBoolAttr(nsGkAtoms::disabled);
+ if (LINK_DISABLED) {
+ return GetBoolAttr(nsGkAtoms::disabled);
+ }
StyleSheet* ss = GetSheet();
return ss && ss->Disabled();
@@ -110,8 +115,10 @@ HTMLLinkElement::GetMozDisabled(bool* aDisabled)
void
HTMLLinkElement::SetDisabled(bool aDisabled, ErrorResult& aRv)
-{
+{
+ if (LINK_DISABLED) {
return SetHTMLBoolAttr(nsGkAtoms::disabled, aDisabled, aRv);
+ }
if (StyleSheet* ss = GetSheet()) {
ss->SetDisabled(aDisabled);
@@ -123,7 +130,7 @@ HTMLLinkElement::SetMozDisabled(bool aDisabled)
{
ErrorResult rv;
SetDisabled(aDisabled, rv);
- return rv.StealNSResult();
+ return rv.StealNSResult();
}
NS_IMPL_STRING_ATTR(HTMLLinkElement, Charset, charset)
@@ -375,7 +382,7 @@ HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
aName == nsGkAtoms::title ||
aName == nsGkAtoms::media ||
aName == nsGkAtoms::type ||
- aName == nsGkAtoms::disabled)) {
+ (LINK_DISABLED && aName == nsGkAtoms::disabled))) {
bool dropSheet = false;
if (aName == nsGkAtoms::rel) {
nsAutoString value;
@@ -403,12 +410,12 @@ HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
(aName == nsGkAtoms::title ||
aName == nsGkAtoms::media ||
aName == nsGkAtoms::type ||
- aName == nsGkAtoms::disabled));
+ (LINK_DISABLED && aName == nsGkAtoms::disabled)));
}
} else {
// If the disabled attribute is removed from a link element, the
// stylesheet may be explicitly enabled.
- if (aNameSpaceID == kNameSpaceID_None) {
+ if (aNameSpaceID == kNameSpaceID_None && LINK_DISABLED) {
if (aName == nsGkAtoms::disabled) {
mExplicitlyEnabled = true;
}
@@ -419,7 +426,7 @@ HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
aName == nsGkAtoms::title ||
aName == nsGkAtoms::media ||
aName == nsGkAtoms::type ||
- aName == nsGkAtoms::disabled) {
+ (LINK_DISABLED && aName == nsGkAtoms::disabled)) {
UpdateStyleSheetInternal(nullptr, nullptr, true);
}
if (aName == nsGkAtoms::href ||
@@ -530,6 +537,8 @@ HTMLLinkElement::GetStyleSheetInfo(nsAString& aTitle,
return;
}
+ if (LINK_DISABLED) {
+
// Is the link disabled?
if (Disabled()) {
return;
@@ -540,6 +549,8 @@ HTMLLinkElement::GetStyleSheetInfo(nsAString& aTitle,
*aIsExplicitlyEnabled = true;
}
+ }
+
nsAutoString title;
GetAttr(kNameSpaceID_None, nsGkAtoms::title, title);
title.CompressWhitespace();
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index 766c00d39..8cd934439 100644
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1185,6 +1185,14 @@ pref("dom.storage.default_quota", 5120);
pref("dom.send_after_paint_to_content", false);
+// Whether the disabled attribute in HTMLLinkElement disables the sheet loading
+// altogether, or forwards to the inner stylesheet method without attribute
+// reflection.
+//
+// Historical behavior is the second, the first is being discussed at:
+// https://github.com/whatwg/html/issues/3840
+pref("dom.link.disabled_attribute.enabled", true);
+
// Timeout clamp in ms for timeouts we clamp
pref("dom.min_timeout_value", 4);
// And for background windows