From a9f337ea7ca1e8743c3f38645c525751a479a561 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 21 Jul 2020 18:23:30 -0500 Subject: Issue #1629 - Part 1: Implement basic logic in HTMLLinkElement. So basically, I'm trying to adapt this to UXP: https://bugzilla.mozilla.org/show_bug.cgi?id=1281135 The earliest source of difficulty while adapting Bug 1281135 to our codebase was simply getting the new ErrorResult flag added to the SetDisabled function to play nice with the SetMozDisabled function. At this point, the implementation can actually have a stylesheet be disabled by default but there are supposedly issues with alternate stylesheets. At first I played around with the return type of SetMozDisabled to no avail, but I found another solution fairly quickly. https://bugzilla.mozilla.org/show_bug.cgi?id=846972 https://bugzilla.mozilla.org/show_bug.cgi?id=1157898 Essentially, the way around the problem of the number of return arguments not matching up is to declare a local variable within SetMozDisabled called ErrorResult rv, and using that to store the return value of the ErrorResult argument from SetDisabled. After that, because ErrorCode was removed, you would return rv.StealNSResult() in order to report success or failure to any consumer that calls on SetMozDisabled. --- dom/html/HTMLLinkElement.cpp | 26 +++++++++++++++++++------- dom/html/HTMLLinkElement.h | 4 ++-- dom/html/HTMLStyleElement.cpp | 2 +- dom/html/HTMLStyleElement.h | 2 +- dom/webidl/HTMLLinkElement.webidl | 2 +- 5 files changed, 24 insertions(+), 12 deletions(-) (limited to 'dom') diff --git a/dom/html/HTMLLinkElement.cpp b/dom/html/HTMLLinkElement.cpp index b05b92d7a..ed83836aa 100644 --- a/dom/html/HTMLLinkElement.cpp +++ b/dom/html/HTMLLinkElement.cpp @@ -93,8 +93,10 @@ NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement) NS_IMPL_ELEMENT_CLONE(HTMLLinkElement) bool -HTMLLinkElement::Disabled() +HTMLLinkElement::Disabled() const { + return GetBoolAttr(nsGkAtoms::disabled); + StyleSheet* ss = GetSheet(); return ss && ss->Disabled(); } @@ -107,8 +109,10 @@ HTMLLinkElement::GetMozDisabled(bool* aDisabled) } void -HTMLLinkElement::SetDisabled(bool aDisabled) +HTMLLinkElement::SetDisabled(bool aDisabled, ErrorResult& aRv) { + return SetHTMLBoolAttr(nsGkAtoms::disabled, aDisabled, aRv); + if (StyleSheet* ss = GetSheet()) { ss->SetDisabled(aDisabled); } @@ -117,8 +121,9 @@ HTMLLinkElement::SetDisabled(bool aDisabled) NS_IMETHODIMP HTMLLinkElement::SetMozDisabled(bool aDisabled) { - SetDisabled(aDisabled); - return NS_OK; + ErrorResult rv; + SetDisabled(aDisabled, rv); + return rv.StealNSResult(); } @@ -370,7 +375,8 @@ HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, aName == nsGkAtoms::rel || aName == nsGkAtoms::title || aName == nsGkAtoms::media || - aName == nsGkAtoms::type)) { + aName == nsGkAtoms::type || + aName == nsGkAtoms::disabled)) { bool dropSheet = false; if (aName == nsGkAtoms::rel) { nsAutoString value; @@ -397,7 +403,8 @@ HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, dropSheet || (aName == nsGkAtoms::title || aName == nsGkAtoms::media || - aName == nsGkAtoms::type)); + aName == nsGkAtoms::type || + aName == nsGkAtoms::disabled)); } } else { // Since removing href or rel makes us no longer link to a @@ -407,7 +414,8 @@ HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, aName == nsGkAtoms::rel || aName == nsGkAtoms::title || aName == nsGkAtoms::media || - aName == nsGkAtoms::type) { + aName == nsGkAtoms::type || + aName == nsGkAtoms::disabled) { UpdateStyleSheetInternal(nullptr, nullptr, true); } if (aName == nsGkAtoms::href || @@ -516,6 +524,10 @@ HTMLLinkElement::GetStyleSheetInfo(nsAString& aTitle, return; } + if (Disabled()) { + return; + } + nsAutoString title; GetAttr(kNameSpaceID_None, nsGkAtoms::title, title); title.CompressWhitespace(); diff --git a/dom/html/HTMLLinkElement.h b/dom/html/HTMLLinkElement.h index acac955cb..e024d42bb 100644 --- a/dom/html/HTMLLinkElement.h +++ b/dom/html/HTMLLinkElement.h @@ -86,8 +86,8 @@ public: virtual bool HasDeferredDNSPrefetchRequest() override; // WebIDL - bool Disabled(); - void SetDisabled(bool aDisabled); + bool Disabled() const; + void SetDisabled(bool aDisabled, ErrorResult& aRv); // XPCOM GetHref is fine. void SetHref(const nsAString& aHref, ErrorResult& aRv) { diff --git a/dom/html/HTMLStyleElement.cpp b/dom/html/HTMLStyleElement.cpp index 743f4addb..95cf025d1 100644 --- a/dom/html/HTMLStyleElement.cpp +++ b/dom/html/HTMLStyleElement.cpp @@ -66,7 +66,7 @@ HTMLStyleElement::GetMozDisabled(bool* aDisabled) } bool -HTMLStyleElement::Disabled() +HTMLStyleElement::Disabled() const { StyleSheet* ss = GetSheet(); return ss && ss->Disabled(); diff --git a/dom/html/HTMLStyleElement.h b/dom/html/HTMLStyleElement.h index bd69a6aa1..8b69c3f62 100644 --- a/dom/html/HTMLStyleElement.h +++ b/dom/html/HTMLStyleElement.h @@ -59,7 +59,7 @@ public: NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED - bool Disabled(); + bool Disabled() const; void SetDisabled(bool aDisabled); void SetMedia(const nsAString& aMedia, ErrorResult& aError) { diff --git a/dom/webidl/HTMLLinkElement.webidl b/dom/webidl/HTMLLinkElement.webidl index eb83deab1..4fa40d04d 100644 --- a/dom/webidl/HTMLLinkElement.webidl +++ b/dom/webidl/HTMLLinkElement.webidl @@ -14,7 +14,7 @@ // http://www.whatwg.org/specs/web-apps/current-work/#the-link-element [HTMLConstructor] interface HTMLLinkElement : HTMLElement { - [Pure] + [CEReactions, SetterThrows, Pure] attribute boolean disabled; [CEReactions, SetterThrows, Pure] attribute DOMString href; -- cgit v1.2.3 From 68623263573f5a087ad878f1609de272cc617399 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 11 Aug 2020 05:27:40 -0500 Subject: 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. --- dom/base/nsContentSink.cpp | 5 +++-- dom/base/nsStyleLinkElement.cpp | 8 +++++--- dom/base/nsStyleLinkElement.h | 3 ++- dom/html/HTMLLinkElement.cpp | 20 ++++++++++++++++---- dom/html/HTMLLinkElement.h | 12 ++++++++++-- dom/html/HTMLStyleElement.cpp | 4 +++- dom/html/HTMLStyleElement.h | 3 ++- dom/svg/SVGStyleElement.cpp | 4 +++- dom/svg/SVGStyleElement.h | 3 ++- dom/xml/XMLStylesheetProcessingInstruction.cpp | 4 +++- dom/xml/XMLStylesheetProcessingInstruction.h | 3 ++- 11 files changed, 51 insertions(+), 18 deletions(-) (limited to 'dom') 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 { diff --git a/dom/html/HTMLLinkElement.cpp b/dom/html/HTMLLinkElement.cpp index ed83836aa..352cbc755 100644 --- a/dom/html/HTMLLinkElement.cpp +++ b/dom/html/HTMLLinkElement.cpp @@ -126,7 +126,6 @@ HTMLLinkElement::SetMozDisabled(bool aDisabled) return rv.StealNSResult(); } - NS_IMPL_STRING_ATTR(HTMLLinkElement, Charset, charset) NS_IMPL_URI_ATTR(HTMLLinkElement, Href, href) NS_IMPL_STRING_ATTR(HTMLLinkElement, Hreflang, hreflang) @@ -407,9 +406,14 @@ HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, aName == nsGkAtoms::disabled)); } } else { - // Since removing href or rel makes us no longer link to a - // stylesheet, force updates for those too. + // If the disabled attribute is removed from a link element, the + // stylesheet may be explicitly enabled. if (aNameSpaceID == kNameSpaceID_None) { + if (aName == nsGkAtoms::disabled) { + mExplicitlyEnabled = true; + } + // Since removing href or rel makes us no longer link to a + // stylesheet, force updates for those too. if (aName == nsGkAtoms::href || aName == nsGkAtoms::rel || aName == nsGkAtoms::title || @@ -508,13 +512,15 @@ HTMLLinkElement::GetStyleSheetInfo(nsAString& aTitle, nsAString& aType, nsAString& aMedia, bool* aIsScoped, - bool* aIsAlternate) + bool* aIsAlternate, + bool* aIsExplicitlyEnabled) { aTitle.Truncate(); aType.Truncate(); aMedia.Truncate(); *aIsScoped = false; *aIsAlternate = false; + *aIsExplicitlyEnabled = false; nsAutoString rel; GetAttr(kNameSpaceID_None, nsGkAtoms::rel, rel); @@ -524,10 +530,16 @@ HTMLLinkElement::GetStyleSheetInfo(nsAString& aTitle, return; } + // Is the link disabled? if (Disabled()) { return; } + // Is it explicitly enabled? + if (mExplicitlyEnabled) { + *aIsExplicitlyEnabled = true; + } + nsAutoString title; GetAttr(kNameSpaceID_None, nsGkAtoms::title, title); title.CompressWhitespace(); diff --git a/dom/html/HTMLLinkElement.h b/dom/html/HTMLLinkElement.h index e024d42bb..190213028 100644 --- a/dom/html/HTMLLinkElement.h +++ b/dom/html/HTMLLinkElement.h @@ -181,10 +181,18 @@ protected: nsAString& aType, nsAString& aMedia, bool* aIsScoped, - bool* aIsAlternate) override; -protected: + bool* aIsAlternate, + bool* aIsExplicitlyEnabled) override; + RefPtr mRelList; + // The "explicitly enabled" flag. This flag is set whenever the 'disabled' + // attribute is explicitly unset, and makes alternate stylesheets not be + // disabled by default anymore. + // + // See https://github.com/whatwg/html/issues/3840#issuecomment-481034206. + bool mExplicitlyEnabled = false; + private: RefPtr mImportLoader; }; diff --git a/dom/html/HTMLStyleElement.cpp b/dom/html/HTMLStyleElement.cpp index 95cf025d1..c37e1a32d 100644 --- a/dom/html/HTMLStyleElement.cpp +++ b/dom/html/HTMLStyleElement.cpp @@ -223,12 +223,14 @@ HTMLStyleElement::GetStyleSheetInfo(nsAString& aTitle, nsAString& aType, nsAString& aMedia, bool* aIsScoped, - bool* aIsAlternate) + bool* aIsAlternate, + bool* aIsExplicitlyEnabled) { aTitle.Truncate(); aType.Truncate(); aMedia.Truncate(); *aIsAlternate = false; + *aIsExplicitlyEnabled = false; nsAutoString title; GetAttr(kNameSpaceID_None, nsGkAtoms::title, title); diff --git a/dom/html/HTMLStyleElement.h b/dom/html/HTMLStyleElement.h index 8b69c3f62..7d98a494a 100644 --- a/dom/html/HTMLStyleElement.h +++ b/dom/html/HTMLStyleElement.h @@ -88,7 +88,8 @@ protected: nsAString& aType, nsAString& aMedia, bool* aIsScoped, - bool* aIsAlternate) override; + bool* aIsAlternate, + bool* aIsExplicitlyEnabled) override; /** * Common method to call from the various mutation observer methods. * aContent is a content node that's either the one that changed or its diff --git a/dom/svg/SVGStyleElement.cpp b/dom/svg/SVGStyleElement.cpp index 22fb204df..7655c1198 100644 --- a/dom/svg/SVGStyleElement.cpp +++ b/dom/svg/SVGStyleElement.cpp @@ -271,9 +271,11 @@ SVGStyleElement::GetStyleSheetInfo(nsAString& aTitle, nsAString& aType, nsAString& aMedia, bool* aIsScoped, - bool* aIsAlternate) + bool* aIsAlternate, + bool* aIsExplicitlyEnabled) { *aIsAlternate = false; + *aIsExplicitlyEnabled = false; nsAutoString title; GetAttr(kNameSpaceID_None, nsGkAtoms::title, title); diff --git a/dom/svg/SVGStyleElement.h b/dom/svg/SVGStyleElement.h index 9b126e7e8..e637dfb18 100644 --- a/dom/svg/SVGStyleElement.h +++ b/dom/svg/SVGStyleElement.h @@ -95,7 +95,8 @@ protected: nsAString& aType, nsAString& aMedia, bool* aIsScoped, - bool* aIsAlternate) override; + bool* aIsAlternate, + bool* aIsExplicitlyEnabled) override; virtual CORSMode GetCORSMode() const override; /** diff --git a/dom/xml/XMLStylesheetProcessingInstruction.cpp b/dom/xml/XMLStylesheetProcessingInstruction.cpp index 3d94e179b..43e45131a 100644 --- a/dom/xml/XMLStylesheetProcessingInstruction.cpp +++ b/dom/xml/XMLStylesheetProcessingInstruction.cpp @@ -131,13 +131,15 @@ XMLStylesheetProcessingInstruction::GetStyleSheetInfo(nsAString& aTitle, nsAString& aType, nsAString& aMedia, bool* aIsScoped, - bool* aIsAlternate) + bool* aIsAlternate, + bool* aIsExplicitlyEnabled) { aTitle.Truncate(); aType.Truncate(); aMedia.Truncate(); *aIsScoped = false; *aIsAlternate = false; + *aIsExplicitlyEnabled = false; // xml-stylesheet PI is special only in prolog if (!nsContentUtils::InProlog(this)) { diff --git a/dom/xml/XMLStylesheetProcessingInstruction.h b/dom/xml/XMLStylesheetProcessingInstruction.h index 818b3392f..28061834a 100644 --- a/dom/xml/XMLStylesheetProcessingInstruction.h +++ b/dom/xml/XMLStylesheetProcessingInstruction.h @@ -82,7 +82,8 @@ protected: nsAString& aType, nsAString& aMedia, bool* aIsScoped, - bool* aIsAlternate) override; + bool* aIsAlternate, + bool* aIsExplicitlyEnabled) override; virtual nsGenericDOMDataNode* CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo, bool aCloneText) const override; }; -- cgit v1.2.3 From 931e8d29faf577e3cec64b896ee1a06cd93b27b9 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Fri, 14 Aug 2020 11:06:13 -0500 Subject: Issue #1629 - Part 3: Implement behind preference. This is not very "clean," and is mostly done in the same sloppy way as Emilio did it because that's basically the only way you can do it. Note well that this does NOT actually turn off everything I've done in a clean fashion like ifdefs would. For instance, the Explicitly Enabled flag is still present, but is now always false because the only condition that can set it true is behind the pref and therefore inert when this pref is off. Also, because the arguments of SetDisabled have changed, my modifications to SetMozDisabled must be present regardless of whether the pref is on or off. What I have done is turn off the actual reflection of the disabled attribute in Disabled and SetDisabled, as well as in AfterSetAttr. However, turning the pref off seems to restore more or less our old behavior, though there may be subtle differences unlike with an ifdef since this is, unfortunately, not an exact science and I can only turn off changes that happen within individual functions and not changes in how functions interact with each other. --- dom/html/HTMLLinkElement.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'dom') 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(); -- cgit v1.2.3 From 2372e190256bef645b5dddb6af9b0c1ee14cf846 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Fri, 14 Aug 2020 12:26:43 -0500 Subject: Fix nits --- dom/html/HTMLLinkElement.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'dom') diff --git a/dom/html/HTMLLinkElement.cpp b/dom/html/HTMLLinkElement.cpp index c2972784c..98f7e464f 100644 --- a/dom/html/HTMLLinkElement.cpp +++ b/dom/html/HTMLLinkElement.cpp @@ -130,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) @@ -415,8 +415,8 @@ HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, } else { // If the disabled attribute is removed from a link element, the // stylesheet may be explicitly enabled. - if (aNameSpaceID == kNameSpaceID_None && LINK_DISABLED) { - if (aName == nsGkAtoms::disabled) { + if (aNameSpaceID == kNameSpaceID_None) { + if (aName == nsGkAtoms::disabled && LINK_DISABLED) { mExplicitlyEnabled = true; } // Since removing href or rel makes us no longer link to a -- cgit v1.2.3