From c406bcf318f1f7fdffa24f8bccee36127c795ef2 Mon Sep 17 00:00:00 2001 From: Cosmin Sabou Date: Wed, 9 Aug 2023 20:16:06 +0300 Subject: [PATCH] Backed out 5 changesets (bug 1839316) for causing bustages on ScriptLoader.cpp. CLOSED TREE Backed out changeset 85f107e082ee (bug 1839316) Backed out changeset 8c1e22518c3a (bug 1839316) Backed out changeset a4c3dec0f34c (bug 1839316) Backed out changeset 313ff15742dd (bug 1839316) Backed out changeset fa200e26bbb1 (bug 1839316) --- dom/events/EventListenerManager.cpp | 4 +- dom/html/FetchPriority.cpp | 13 ----- dom/html/FetchPriority.h | 23 -------- dom/html/HTMLScriptElement.cpp | 56 ------------------- dom/html/HTMLScriptElement.h | 15 ----- dom/html/moz.build | 2 - dom/script/ModuleLoader.cpp | 5 +- dom/script/ScriptLoader.cpp | 51 ++++------------- dom/script/ScriptLoader.h | 16 ++---- dom/script/nsIScriptElement.h | 8 --- dom/svg/SVGScriptElement.cpp | 6 -- dom/svg/SVGScriptElement.h | 1 - dom/webidl/HTMLScriptElement.webidl | 2 - dom/webidl/Request.webidl | 2 - dom/workers/ScriptLoader.cpp | 3 +- dom/workers/loader/WorkerModuleLoader.cpp | 5 +- dom/worklet/WorkletFetchHandler.cpp | 3 +- js/loader/ScriptLoadRequest.cpp | 6 +- js/loader/ScriptLoadRequest.h | 11 ---- js/xpconnect/loader/mozJSModuleLoader.cpp | 9 +-- js/xpconnect/loader/mozJSModuleLoader.h | 2 +- modules/libpref/init/StaticPrefList.yaml | 7 --- parser/html/nsHtml5SpeculativeLoad.cpp | 24 ++++---- parser/html/nsHtml5SpeculativeLoad.h | 9 +-- parser/html/nsHtml5TreeBuilderCppSupplement.h | 46 ++------------- parser/html/nsHtml5TreeOpExecutor.cpp | 11 ++-- parser/html/nsHtml5TreeOpExecutor.h | 1 - .../attr-script-fetchpriority.html.ini | 6 +- uriloader/preload/PreloadService.cpp | 29 ++++------ uriloader/preload/PreloadService.h | 4 +- 30 files changed, 68 insertions(+), 312 deletions(-) delete mode 100644 dom/html/FetchPriority.cpp delete mode 100644 dom/html/FetchPriority.h diff --git a/dom/events/EventListenerManager.cpp b/dom/events/EventListenerManager.cpp index b48a41c441fd..491b7b8e7f93 100644 --- a/dom/events/EventListenerManager.cpp +++ b/dom/events/EventListenerManager.cpp @@ -27,7 +27,6 @@ #include "mozilla/dom/Event.h" #include "mozilla/dom/EventTargetBinding.h" #include "mozilla/dom/PopupBlocker.h" -#include "mozilla/dom/RequestBinding.h" #include "mozilla/dom/ScriptLoader.h" #include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/TouchEvent.h" @@ -1175,8 +1174,7 @@ nsresult EventListenerManager::CompileEventHandlerInternal( RefPtr fetchOptions = new JS::loader::ScriptFetchOptions( CORS_NONE, aElement->OwnerDoc()->GetReferrerPolicy(), - /* aNonce = */ u""_ns, RequestPriority::Auto, - JS::loader::ParserMetadata::NotParserInserted, + /* aNonce = */ u""_ns, JS::loader::ParserMetadata::NotParserInserted, aElement->OwnerDoc()->NodePrincipal()); RefPtr eventScript = diff --git a/dom/html/FetchPriority.cpp b/dom/html/FetchPriority.cpp deleted file mode 100644 index 77a48a2677ca..000000000000 --- a/dom/html/FetchPriority.cpp +++ /dev/null @@ -1,13 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/dom/FetchPriority.h" - -namespace mozilla::dom { -const char* kFetchPriorityAttributeValueHigh = "high"; -const char* kFetchPriorityAttributeValueLow = "low"; -const char* kFetchPriorityAttributeValueAuto = "auto"; -} // namespace mozilla::dom diff --git a/dom/html/FetchPriority.h b/dom/html/FetchPriority.h deleted file mode 100644 index 9c71c7997d07..000000000000 --- a/dom/html/FetchPriority.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef mozilla_dom_FetchPriority_h -#define mozilla_dom_FetchPriority_h - -#include - -namespace mozilla::dom { - -// . -enum class FetchPriority : uint8_t { High, Low, Auto }; - -extern const char* kFetchPriorityAttributeValueHigh; -extern const char* kFetchPriorityAttributeValueLow; -extern const char* kFetchPriorityAttributeValueAuto; - -} // namespace mozilla::dom - -#endif // mozilla_dom_FetchPriority_h diff --git a/dom/html/HTMLScriptElement.cpp b/dom/html/HTMLScriptElement.cpp index a1390c2f60f1..c5edba752a6e 100644 --- a/dom/html/HTMLScriptElement.cpp +++ b/dom/html/HTMLScriptElement.cpp @@ -4,9 +4,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "nsAttrValue.h" -#include "nsAttrValueOrString.h" -#include "nsGenericHTMLElement.h" #include "nsGkAtoms.h" #include "nsStyleConsts.h" #include "mozilla/dom/Document.h" @@ -21,10 +18,8 @@ #include "nsDOMJSUtils.h" #include "nsIScriptError.h" #include "nsISupportsImpl.h" -#include "mozilla/dom/FetchPriority.h" #include "mozilla/dom/HTMLScriptElement.h" #include "mozilla/dom/HTMLScriptElementBinding.h" -#include "mozilla/Assertions.h" #include "mozilla/StaticPrefs_dom.h" NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Script) @@ -63,19 +58,6 @@ nsresult HTMLScriptElement::BindToTree(BindContext& aContext, return NS_OK; } -namespace { -// . -static const nsAttrValue::EnumTable kFetchPriorityEnumTable[] = { - {kFetchPriorityAttributeValueHigh, FetchPriority::High}, - {kFetchPriorityAttributeValueLow, FetchPriority::Low}, - {kFetchPriorityAttributeValueAuto, FetchPriority::Auto}, - {nullptr, 0}}; - -// . -static const nsAttrValue::EnumTable* - kFetchPriorityEnumTableInvalidValueDefault = &kFetchPriorityEnumTable[2]; -} // namespace - bool HTMLScriptElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute, const nsAString& aValue, nsIPrincipal* aMaybeScriptedPrincipal, @@ -90,11 +72,6 @@ bool HTMLScriptElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute, aResult.ParseStringOrAtom(aValue); return true; } - - if (aAttribute == nsGkAtoms::fetchpriority) { - HTMLScriptElement::ParseFetchPriority(aValue, aResult); - return true; - } } return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue, @@ -225,17 +202,6 @@ CORSMode HTMLScriptElement::GetCORSMode() const { return AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin)); } -FetchPriority HTMLScriptElement::GetFetchPriority() const { - const nsAttrValue* fetchpriorityAttribute = - GetParsedAttr(nsGkAtoms::fetchpriority); - if (fetchpriorityAttribute) { - MOZ_ASSERT(fetchpriorityAttribute->Type() == nsAttrValue::eEnum); - return FetchPriority(fetchpriorityAttribute->GetEnumValue()); - } - - return FetchPriority::Auto; -} - mozilla::dom::ReferrerPolicy HTMLScriptElement::GetReferrerPolicy() { return GetReferrerPolicyAsEnum(); } @@ -245,20 +211,6 @@ bool HTMLScriptElement::HasScriptContent() { nsContentUtils::HasNonEmptyTextContent(this); } -void HTMLScriptElement::GetFetchPriority(nsAString& aFetchPriority) const { - // . - GetEnumAttr(nsGkAtoms::fetchpriority, kFetchPriorityAttributeValueAuto, - aFetchPriority); -} - -/* static */ -FetchPriority HTMLScriptElement::ToFetchPriority(const nsAString& aValue) { - nsAttrValue attrValue; - HTMLScriptElement::ParseFetchPriority(aValue, attrValue); - MOZ_ASSERT(attrValue.Type() == nsAttrValue::eEnum); - return FetchPriority(attrValue.GetEnumValue()); -} - // https://html.spec.whatwg.org/multipage/scripting.html#dom-script-supports /* static */ bool HTMLScriptElement::Supports(const GlobalObject& aGlobal, @@ -269,12 +221,4 @@ bool HTMLScriptElement::Supports(const GlobalObject& aGlobal, aType.EqualsLiteral("importmap")); } -/* static */ -void HTMLScriptElement::ParseFetchPriority(const nsAString& aValue, - nsAttrValue& aResult) { - aResult.ParseEnumValue(aValue, kFetchPriorityEnumTable, - false /* aCaseSensitive */, - kFetchPriorityEnumTableInvalidValueDefault); -} - } // namespace mozilla::dom diff --git a/dom/html/HTMLScriptElement.h b/dom/html/HTMLScriptElement.h index b2e462f40214..c4f2d0dfa64a 100644 --- a/dom/html/HTMLScriptElement.h +++ b/dom/html/HTMLScriptElement.h @@ -7,11 +7,9 @@ #ifndef mozilla_dom_HTMLScriptElement_h #define mozilla_dom_HTMLScriptElement_h -#include "mozilla/dom/FetchPriority.h" #include "nsGenericHTMLElement.h" #include "mozilla/Attributes.h" #include "mozilla/dom/ScriptElement.h" -#include "nsStringFwd.h" namespace mozilla::dom { @@ -36,7 +34,6 @@ class HTMLScriptElement final : public nsGenericHTMLElement, virtual void GetScriptCharset(nsAString& charset) override; virtual void FreezeExecutionAttrs(const Document* aOwnerDoc) override; virtual CORSMode GetCORSMode() const override; - virtual FetchPriority GetFetchPriority() const override; virtual mozilla::dom::ReferrerPolicy GetReferrerPolicy() override; // nsIContent @@ -131,15 +128,6 @@ class HTMLScriptElement final : public nsGenericHTMLElement, GetEnumAttr(nsGkAtoms::referrerpolicy, "", aReferrerPolicy); } - void GetFetchPriority(nsAString& aFetchPriority) const; - - void SetFetchPriority(const nsAString& aFetchPriority) { - SetHTMLAttr(nsGkAtoms::fetchpriority, aFetchPriority); - } - - // . - static FetchPriority ToFetchPriority(const nsAString& aValue); - [[nodiscard]] static bool Supports(const GlobalObject& aGlobal, const nsAString& aType); @@ -156,9 +144,6 @@ class HTMLScriptElement final : public nsGenericHTMLElement, // ScriptElement virtual bool HasScriptContent() override; - - private: - static void ParseFetchPriority(const nsAString& aValue, nsAttrValue& aResult); }; } // namespace mozilla::dom diff --git a/dom/html/moz.build b/dom/html/moz.build index bb87e0f068b2..1dc679dce381 100644 --- a/dom/html/moz.build +++ b/dom/html/moz.build @@ -43,7 +43,6 @@ EXPORTS.mozilla += [ EXPORTS.mozilla.dom += [ "ConstraintValidation.h", "ElementInternals.h", - "FetchPriority.h", "HTMLAllCollection.h", "HTMLAnchorElement.h", "HTMLAreaElement.h", @@ -128,7 +127,6 @@ EXPORTS.mozilla.dom += [ UNIFIED_SOURCES += [ "ConstraintValidation.cpp", "ElementInternals.cpp", - "FetchPriority.cpp", "HTMLAllCollection.cpp", "HTMLAnchorElement.cpp", "HTMLAreaElement.cpp", diff --git a/dom/script/ModuleLoader.cpp b/dom/script/ModuleLoader.cpp index b9f4543ff776..3e2e53e02470 100644 --- a/dom/script/ModuleLoader.cpp +++ b/dom/script/ModuleLoader.cpp @@ -21,7 +21,6 @@ #include "js/loader/ScriptLoadRequest.h" #include "js/loader/ModuleLoaderBase.h" #include "js/loader/ModuleLoadRequest.h" -#include "mozilla/dom/RequestBinding.h" #include "xpcpublic.h" #include "GeckoProfiler.h" #include "nsContentSecurityManager.h" @@ -299,8 +298,8 @@ already_AddRefed ModuleLoader::CreateDynamicImport( // "auto". options = new ScriptFetchOptions( mozilla::CORS_NONE, document->GetReferrerPolicy(), - /* aNonce = */ u""_ns, RequestPriority::Auto, - ParserMetadata::NotParserInserted, principal, nullptr); + /* aNonce = */ u""_ns, ParserMetadata::NotParserInserted, principal, + nullptr); baseURL = document->GetDocBaseURI(); } diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp index 292c3d9d8dcd..ebab1034e1f6 100644 --- a/dom/script/ScriptLoader.cpp +++ b/dom/script/ScriptLoader.cpp @@ -9,10 +9,6 @@ #include "ScriptTrace.h" #include "ModuleLoader.h" -#include "mozilla/Assertions.h" -#include "mozilla/dom/FetchPriority.h" -#include "mozilla/dom/HTMLScriptElement.h" -#include "mozilla/dom/RequestBinding.h" #include "nsIChildChannel.h" #include "zlib.h" @@ -839,31 +835,16 @@ static bool CSPAllowsInlineScript(nsIScriptElement* aElement, return NS_SUCCEEDED(rv) && allowInlineScript; } -namespace { -constexpr RequestPriority FetchPriorityToRequestPriority( - const FetchPriority aFetchPriority) { - switch (aFetchPriority) { - case FetchPriority::High: - return RequestPriority::High; - case FetchPriority::Low: - return RequestPriority::Low; - case FetchPriority::Auto: - return RequestPriority::Auto; - } -} -} // namespace - already_AddRefed ScriptLoader::CreateLoadRequest( ScriptKind aKind, nsIURI* aURI, nsIScriptElement* aElement, nsIPrincipal* aTriggeringPrincipal, CORSMode aCORSMode, - const nsAString& aNonce, RequestPriority aRequestPriority, - const SRIMetadata& aIntegrity, ReferrerPolicy aReferrerPolicy, - ParserMetadata aParserMetadata) { + const nsAString& aNonce, const SRIMetadata& aIntegrity, + ReferrerPolicy aReferrerPolicy, ParserMetadata aParserMetadata) { nsIURI* referrer = mDocument->GetDocumentURIAsReferrer(); nsCOMPtr domElement = do_QueryInterface(aElement); - RefPtr fetchOptions = new ScriptFetchOptions( - aCORSMode, aReferrerPolicy, aNonce, aRequestPriority, aParserMetadata, - aTriggeringPrincipal, domElement); + RefPtr fetchOptions = + new ScriptFetchOptions(aCORSMode, aReferrerPolicy, aNonce, + aParserMetadata, aTriggeringPrincipal, domElement); RefPtr context = new ScriptLoadContext(); if (aKind == ScriptKind::eClassic || aKind == ScriptKind::eImportMap) { @@ -1038,14 +1019,12 @@ bool ScriptLoader::ProcessExternalScript(nsIScriptElement* aElement, } CORSMode ourCORSMode = aElement->GetCORSMode(); - const FetchPriority fetchPriority = aElement->GetFetchPriority(); ReferrerPolicy referrerPolicy = GetReferrerPolicy(aElement); ParserMetadata parserMetadata = GetParserMetadata(aElement); request = CreateLoadRequest(aScriptKind, scriptURI, aElement, principal, - ourCORSMode, nonce, - FetchPriorityToRequestPriority(fetchPriority), - sriMetadata, referrerPolicy, parserMetadata); + ourCORSMode, nonce, sriMetadata, referrerPolicy, + parserMetadata); request->GetScriptLoadContext()->mIsInline = false; request->GetScriptLoadContext()->SetScriptMode( aElement->GetScriptDeferred(), aElement->GetScriptAsync(), false); @@ -1212,18 +1191,12 @@ bool ScriptLoader::ProcessInlineScript(nsIScriptElement* aElement, if (aScriptKind == ScriptKind::eModule) { corsMode = aElement->GetCORSMode(); } - // - // step 29 specifies to use the fetch priority. Presumably it has no effect - // for inline scripts. - const auto fetchPriority = aElement->GetFetchPriority(); - ReferrerPolicy referrerPolicy = GetReferrerPolicy(aElement); ParserMetadata parserMetadata = GetParserMetadata(aElement); RefPtr request = CreateLoadRequest(aScriptKind, mDocument->GetDocumentURI(), aElement, mDocument->NodePrincipal(), corsMode, nonce, - FetchPriorityToRequestPriority(fetchPriority), SRIMetadata(), // SRI doesn't apply referrerPolicy, parserMetadata); request->GetScriptLoadContext()->mIsInline = true; @@ -3571,9 +3544,8 @@ void ScriptLoader::ParsingComplete(bool aTerminated) { void ScriptLoader::PreloadURI( nsIURI* aURI, const nsAString& aCharset, const nsAString& aType, const nsAString& aCrossOrigin, const nsAString& aNonce, - const nsAString& aFetchPriority, const nsAString& aIntegrity, - bool aScriptFromHead, bool aAsync, bool aDefer, bool aNoModule, - bool aLinkPreload, const ReferrerPolicy aReferrerPolicy, + const nsAString& aIntegrity, bool aScriptFromHead, bool aAsync, bool aDefer, + bool aNoModule, bool aLinkPreload, const ReferrerPolicy aReferrerPolicy, uint64_t aEarlyHintPreloaderId) { NS_ENSURE_TRUE_VOID(mDocument); // Check to see if scripts has been turned off. @@ -3605,9 +3577,6 @@ void ScriptLoader::PreloadURI( SRIMetadata sriMetadata; GetSRIMetadata(aIntegrity, &sriMetadata); - const auto requestPriority = FetchPriorityToRequestPriority( - HTMLScriptElement::ToFetchPriority(aFetchPriority)); - // For link type "modulepreload": // https://html.spec.whatwg.org/multipage/links.html#link-type-modulepreload // Step 11. Let options be a script fetch options whose cryptographic nonce is @@ -3621,7 +3590,7 @@ void ScriptLoader::PreloadURI( RefPtr request = CreateLoadRequest(scriptKind, aURI, nullptr, mDocument->NodePrincipal(), Element::StringToCORSMode(aCrossOrigin), aNonce, - requestPriority, sriMetadata, aReferrerPolicy, + sriMetadata, aReferrerPolicy, aLinkPreload ? ParserMetadata::NotParserInserted : ParserMetadata::ParserInserted); request->GetScriptLoadContext()->mIsInline = false; diff --git a/dom/script/ScriptLoader.h b/dom/script/ScriptLoader.h index 2fadd7094a44..3618bcce4dd5 100644 --- a/dom/script/ScriptLoader.h +++ b/dom/script/ScriptLoader.h @@ -79,7 +79,6 @@ class ScriptLoader; class ScriptRequestProcessor; enum class ReferrerPolicy : uint8_t; -enum class RequestPriority : uint8_t; class AsyncCompileShutdownObserver final : public nsIObserver { ~AsyncCompileShutdownObserver() { Unregister(); } @@ -374,19 +373,14 @@ class ScriptLoader final : public JS::loader::ScriptLoaderInterface { * @param aType The type parameter for the script. * @param aCrossOrigin The crossorigin attribute for the script. * Void if not present. - * @param aFetchPriority - * . * @param aIntegrity The expect hash url, if avail, of the request - * @param aScriptFromHead Whether or not the script was a child of head */ virtual void PreloadURI(nsIURI* aURI, const nsAString& aCharset, const nsAString& aType, const nsAString& aCrossOrigin, - const nsAString& aNonce, - const nsAString& aFetchPriority, - const nsAString& aIntegrity, bool aScriptFromHead, - bool aAsync, bool aDefer, bool aNoModule, - bool aLinkPreload, + const nsAString& aNonce, const nsAString& aIntegrity, + bool aScriptFromHead, bool aAsync, bool aDefer, + bool aNoModule, bool aLinkPreload, const ReferrerPolicy aReferrerPolicy, uint64_t aEarlyHintPreloaderId); @@ -435,8 +429,8 @@ class ScriptLoader final : public JS::loader::ScriptLoaderInterface { already_AddRefed CreateLoadRequest( ScriptKind aKind, nsIURI* aURI, nsIScriptElement* aElement, nsIPrincipal* aTriggeringPrincipal, mozilla::CORSMode aCORSMode, - const nsAString& aNonce, RequestPriority aRequestPriority, - const SRIMetadata& aIntegrity, ReferrerPolicy aReferrerPolicy, + const nsAString& aNonce, const SRIMetadata& aIntegrity, + ReferrerPolicy aReferrerPolicy, JS::loader::ParserMetadata aParserMetadata); /** diff --git a/dom/script/nsIScriptElement.h b/dom/script/nsIScriptElement.h index 074f6ae6fd25..7035af9d4dac 100644 --- a/dom/script/nsIScriptElement.h +++ b/dom/script/nsIScriptElement.h @@ -29,7 +29,6 @@ class nsIURI; namespace mozilla::dom { class Document; -enum class FetchPriority : uint8_t; enum class ReferrerPolicy : uint8_t; } // namespace mozilla::dom @@ -237,13 +236,6 @@ class nsIScriptElement : public nsIScriptLoaderObserver { return mozilla::CORS_NONE; } - /** - * Get the fetch priority - * (https://html.spec.whatwg.org/multipage/scripting.html#attr-script-fetchpriority) - * of the script element. - */ - virtual mozilla::dom::FetchPriority GetFetchPriority() const = 0; - /** * Get referrer policy of the script element */ diff --git a/dom/svg/SVGScriptElement.cpp b/dom/svg/SVGScriptElement.cpp index 4fe7d234c61e..fa19460e01c9 100644 --- a/dom/svg/SVGScriptElement.cpp +++ b/dom/svg/SVGScriptElement.cpp @@ -6,7 +6,6 @@ #include "mozilla/dom/SVGScriptElement.h" -#include "mozilla/dom/FetchPriority.h" #include "nsGkAtoms.h" #include "nsNetUtil.h" #include "nsContentUtils.h" @@ -215,9 +214,4 @@ CORSMode SVGScriptElement::GetCORSMode() const { return AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin)); } -FetchPriority SVGScriptElement::GetFetchPriority() const { - // . - return FetchPriority::Auto; -} - } // namespace mozilla::dom diff --git a/dom/svg/SVGScriptElement.h b/dom/svg/SVGScriptElement.h index 5f318eb0a519..129a652427b8 100644 --- a/dom/svg/SVGScriptElement.h +++ b/dom/svg/SVGScriptElement.h @@ -43,7 +43,6 @@ class SVGScriptElement final : public SVGScriptElementBase, void GetScriptCharset(nsAString& charset) override; void FreezeExecutionAttrs(const Document* aOwnerDoc) override; CORSMode GetCORSMode() const override; - FetchPriority GetFetchPriority() const override; // ScriptElement bool HasScriptContent() override; diff --git a/dom/webidl/HTMLScriptElement.webidl b/dom/webidl/HTMLScriptElement.webidl index 94cb4096cd31..900a7b405127 100644 --- a/dom/webidl/HTMLScriptElement.webidl +++ b/dom/webidl/HTMLScriptElement.webidl @@ -30,8 +30,6 @@ interface HTMLScriptElement : HTMLElement { attribute DOMString referrerPolicy; [CEReactions, Throws] attribute DOMString text; - [Pref="network.fetchpriority.enabled", CEReactions] - attribute DOMString fetchPriority; static boolean supports(DOMString type); }; diff --git a/dom/webidl/Request.webidl b/dom/webidl/Request.webidl index 1aa6be963f4d..628144c1f862 100644 --- a/dom/webidl/Request.webidl +++ b/dom/webidl/Request.webidl @@ -46,7 +46,6 @@ interface Request { }; Request includes Body; -// . dictionary RequestInit { ByteString method; HeadersInit headers; @@ -79,4 +78,3 @@ enum RequestMode { "same-origin", "no-cors", "cors", "navigate" }; enum RequestCredentials { "omit", "same-origin", "include" }; enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" }; enum RequestRedirect { "follow", "error", "manual" }; -enum RequestPriority { "high" , "low" , "auto" }; diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp index b7abd0e741c7..d02f0171b8fd 100644 --- a/dom/workers/ScriptLoader.cpp +++ b/dom/workers/ScriptLoader.cpp @@ -9,7 +9,6 @@ #include #include -#include "mozilla/dom/RequestBinding.h" #include "nsIChannel.h" #include "nsIContentPolicy.h" #include "nsIContentSecurityPolicy.h" @@ -654,7 +653,7 @@ already_AddRefed WorkerScriptLoader::CreateScriptLoadRequest( // policy is the empty string, and fetch priority is "auto". RefPtr fetchOptions = new ScriptFetchOptions( CORSMode::CORS_NONE, referrerPolicy, /* aNonce = */ u""_ns, - RequestPriority::Auto, ParserMetadata::NotParserInserted, nullptr); + ParserMetadata::NotParserInserted, nullptr); RefPtr request = nullptr; // Bug 1817259 - For now the debugger scripts are always loaded a Classic. diff --git a/dom/workers/loader/WorkerModuleLoader.cpp b/dom/workers/loader/WorkerModuleLoader.cpp index 84cf9f9c07c1..79f252c7a063 100644 --- a/dom/workers/loader/WorkerModuleLoader.cpp +++ b/dom/workers/loader/WorkerModuleLoader.cpp @@ -6,7 +6,6 @@ #include "js/experimental/JSStencil.h" // JS::Stencil, JS::CompileModuleScriptToStencil, JS::InstantiateModuleStencil #include "js/loader/ModuleLoadRequest.h" -#include "mozilla/dom/RequestBinding.h" #include "mozilla/dom/WorkerLoadContext.h" #include "mozilla/dom/WorkerPrivate.h" #include "mozilla/dom/workerinternals/ScriptLoader.h" @@ -118,8 +117,8 @@ already_AddRefed WorkerModuleLoader::CreateDynamicImport( ReferrerPolicy referrerPolicy = workerPrivate->GetReferrerPolicy(); options = new ScriptFetchOptions( CORSMode::CORS_NONE, referrerPolicy, - /* aNonce = */ u""_ns, RequestPriority::Auto, - JS::loader::ParserMetadata::NotParserInserted, nullptr); + /* aNonce = */ u""_ns, JS::loader::ParserMetadata::NotParserInserted, + nullptr); baseURL = GetBaseURI(); } diff --git a/dom/worklet/WorkletFetchHandler.cpp b/dom/worklet/WorkletFetchHandler.cpp index 299f71f62cd4..620d5e85660c 100644 --- a/dom/worklet/WorkletFetchHandler.cpp +++ b/dom/worklet/WorkletFetchHandler.cpp @@ -9,7 +9,6 @@ #include "mozilla/dom/Document.h" #include "mozilla/dom/Fetch.h" #include "mozilla/dom/Request.h" -#include "mozilla/dom/RequestBinding.h" #include "mozilla/dom/Response.h" #include "mozilla/dom/RootedDictionary.h" #include "mozilla/dom/ScriptLoader.h" @@ -95,7 +94,7 @@ NS_IMETHODIMP StartModuleLoadRunnable::RunOnWorkletThread() { // policy is the empty string, and fetch priority is "auto". RefPtr fetchOptions = new ScriptFetchOptions( CORSMode::CORS_NONE, ReferrerPolicy::_empty, /* aNonce = */ u""_ns, - RequestPriority::Auto, ParserMetadata::NotParserInserted, + ParserMetadata::NotParserInserted, /*triggeringPrincipal*/ nullptr); WorkletModuleLoader* moduleLoader = diff --git a/js/loader/ScriptLoadRequest.cpp b/js/loader/ScriptLoadRequest.cpp index 0965d20d3298..f3bab584096b 100644 --- a/js/loader/ScriptLoadRequest.cpp +++ b/js/loader/ScriptLoadRequest.cpp @@ -37,13 +37,11 @@ NS_IMPL_CYCLE_COLLECTION(ScriptFetchOptions, mTriggeringPrincipal, mElement) ScriptFetchOptions::ScriptFetchOptions( mozilla::CORSMode aCORSMode, mozilla::dom::ReferrerPolicy aReferrerPolicy, - const nsAString& aNonce, mozilla::dom::RequestPriority aFetchPriority, - const ParserMetadata aParserMetadata, nsIPrincipal* aTriggeringPrincipal, - mozilla::dom::Element* aElement) + const nsAString& aNonce, const ParserMetadata aParserMetadata, + nsIPrincipal* aTriggeringPrincipal, mozilla::dom::Element* aElement) : mCORSMode(aCORSMode), mReferrerPolicy(aReferrerPolicy), mNonce(aNonce), - mFetchPriority(aFetchPriority), mParserMetadata(aParserMetadata), mTriggeringPrincipal(aTriggeringPrincipal), mElement(aElement) {} diff --git a/js/loader/ScriptLoadRequest.h b/js/loader/ScriptLoadRequest.h index 069ddb57fb9f..56a08ecce303 100644 --- a/js/loader/ScriptLoadRequest.h +++ b/js/loader/ScriptLoadRequest.h @@ -37,7 +37,6 @@ namespace mozilla::dom { class ScriptLoadContext; class WorkerLoadContext; class WorkletLoadContext; -enum class RequestPriority : uint8_t; } // namespace mozilla::dom @@ -89,7 +88,6 @@ class ScriptFetchOptions { ScriptFetchOptions(mozilla::CORSMode aCORSMode, enum mozilla::dom::ReferrerPolicy aReferrerPolicy, const nsAString& aNonce, - mozilla::dom::RequestPriority aFetchPriority, const ParserMetadata aParserMetadata, nsIPrincipal* aTriggeringPrincipal, mozilla::dom::Element* aElement = nullptr); @@ -113,11 +111,6 @@ class ScriptFetchOptions { */ const nsString mNonce; - /* - * . - */ - const mozilla::dom::RequestPriority mFetchPriority; - /* * The parser metadata used for the initial fetch and for fetching any * imported modules @@ -301,10 +294,6 @@ class ScriptLoadRequest : ScriptText().clearAndFree(); } - mozilla::dom::RequestPriority FetchPriority() const { - return mFetchOptions->mFetchPriority; - } - enum mozilla::dom::ReferrerPolicy ReferrerPolicy() const { return mFetchOptions->mReferrerPolicy; } diff --git a/js/xpconnect/loader/mozJSModuleLoader.cpp b/js/xpconnect/loader/mozJSModuleLoader.cpp index b20046accbed..7ef554940b98 100644 --- a/js/xpconnect/loader/mozJSModuleLoader.cpp +++ b/js/xpconnect/loader/mozJSModuleLoader.cpp @@ -4,7 +4,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "ScriptLoadRequest.h" #include "mozilla/Attributes.h" #include "mozilla/ArrayUtils.h" // mozilla::ArrayLength #include "mozilla/Utf8.h" // mozilla::Utf8Unit @@ -12,7 +11,6 @@ #include #include "mozilla/Logging.h" -#include "mozilla/dom/RequestBinding.h" #ifdef ANDROID # include #endif @@ -1806,10 +1804,9 @@ nsresult mozJSModuleLoader::ImportESModule( mModuleLoader->GetGlobalObject()->PrincipalOrNull(); MOZ_ASSERT(principal); - RefPtr options = - new ScriptFetchOptions(CORS_NONE, dom::ReferrerPolicy::No_referrer, - /* aNonce = */ u""_ns, dom::RequestPriority::Auto, - ParserMetadata::NotParserInserted, principal); + RefPtr options = new ScriptFetchOptions( + CORS_NONE, dom::ReferrerPolicy::No_referrer, + /* aNonce = */ u""_ns, ParserMetadata::NotParserInserted, principal); RefPtr context = new ComponentLoadContext(); context->mSkipCheck = aSkipCheck; diff --git a/js/xpconnect/loader/mozJSModuleLoader.h b/js/xpconnect/loader/mozJSModuleLoader.h index 445787736bea..e5a114a193d5 100644 --- a/js/xpconnect/loader/mozJSModuleLoader.h +++ b/js/xpconnect/loader/mozJSModuleLoader.h @@ -78,7 +78,7 @@ class mozJSModuleLoader final : public nsIMemoryReporter { JS::MutableHandleObject aModuleExports, bool aIgnoreExports = false); - // Synchronously load an ES6 module and all its dependencies. + // Load an ES6 module and all its dependencies. nsresult ImportESModule( JSContext* aCx, const nsACString& aResourceURI, JS::MutableHandleObject aModuleNamespace, diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 9204227ab22c..2a5df6aac8c6 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -11728,13 +11728,6 @@ value: false mirror: always -# Indicates whether the `fetchpriority` attribute for elements which support it -# (e.g. `