Backed out 11 changesets (bug 1688879) for causing build bustages. CLOSED TREE
Backed out changeset 350ddd17c7f5 (bug 1688879) Backed out changeset 27984b95ed20 (bug 1688879) Backed out changeset 6a5bb063965f (bug 1688879) Backed out changeset d8edcfdb504b (bug 1688879) Backed out changeset 77ab231310ec (bug 1688879) Backed out changeset c2bce95a1aca (bug 1688879) Backed out changeset f5862572ced8 (bug 1688879) Backed out changeset 05e0a1bf32fc (bug 1688879) Backed out changeset adeab05b7419 (bug 1688879) Backed out changeset 0e60834e17e5 (bug 1688879) Backed out changeset 877bb4c2ce66 (bug 1688879)
This commit is contained in:
@@ -822,7 +822,7 @@ already_AddRefed<ScriptLoadRequest> ScriptLoader::CreateLoadRequest(
|
||||
aCORSMode, aReferrerPolicy, aTriggeringPrincipal, domElement);
|
||||
RefPtr<ScriptLoadContext> context = new ScriptLoadContext();
|
||||
|
||||
if (aKind == ScriptKind::eClassic || aKind == ScriptKind::eImportMap) {
|
||||
if (aKind == ScriptKind::eClassic) {
|
||||
RefPtr<ScriptLoadRequest> aRequest = new ScriptLoadRequest(
|
||||
aKind, aURI, fetchOptions, aIntegrity, referrer, context);
|
||||
|
||||
@@ -851,14 +851,8 @@ bool ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement) {
|
||||
nsAutoString type;
|
||||
bool hasType = aElement->GetScriptType(type);
|
||||
|
||||
ScriptKind scriptKind;
|
||||
if (aElement->GetScriptIsModule()) {
|
||||
scriptKind = ScriptKind::eModule;
|
||||
} else if (aElement->GetScriptIsImportMap()) {
|
||||
scriptKind = ScriptKind::eImportMap;
|
||||
} else {
|
||||
scriptKind = ScriptKind::eClassic;
|
||||
}
|
||||
ScriptKind scriptKind = aElement->GetScriptIsModule() ? ScriptKind::eModule
|
||||
: ScriptKind::eClassic;
|
||||
|
||||
// Step 13. Check that the script is not an eventhandler
|
||||
if (IsScriptEventHandler(scriptKind, scriptContent)) {
|
||||
@@ -913,14 +907,6 @@ bool ScriptLoader::ProcessExternalScript(nsIScriptElement* aElement,
|
||||
LOG(("ScriptLoader (%p): Process external script for element %p", this,
|
||||
aElement));
|
||||
|
||||
// Bug 1765745: Support external import maps.
|
||||
if (aScriptKind == ScriptKind::eImportMap) {
|
||||
NS_DispatchToCurrentThread(
|
||||
NewRunnableMethod("nsIScriptElement::FireErrorEvent", aElement,
|
||||
&nsIScriptElement::FireErrorEvent));
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> scriptURI = aElement->GetScriptURI();
|
||||
if (!scriptURI) {
|
||||
// Asynchronously report the failure to create a URI object
|
||||
@@ -957,15 +943,6 @@ bool ScriptLoader::ProcessExternalScript(nsIScriptElement* aElement,
|
||||
|
||||
LOG(("ScriptLoadRequest (%p): Using preload request", request.get()));
|
||||
|
||||
// https://wicg.github.io/import-maps/#document-acquiring-import-maps
|
||||
// If this preload request is for a module load, set acquiring import maps
|
||||
// to false.
|
||||
if (request->IsModuleRequest()) {
|
||||
LOG(("ScriptLoadRequest (%p): Set acquiring import maps to false",
|
||||
request.get()));
|
||||
mModuleLoader->SetAcquiringImportMaps(false);
|
||||
}
|
||||
|
||||
// It's possible these attributes changed since we started the preload so
|
||||
// update them here.
|
||||
request->GetScriptLoadContext()->SetScriptMode(
|
||||
@@ -1183,46 +1160,6 @@ bool ScriptLoader::ProcessInlineScript(nsIScriptElement* aElement,
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request->IsImportMapRequest()) {
|
||||
// https://wicg.github.io/import-maps/#integration-prepare-a-script
|
||||
// If the script's type is "importmap":
|
||||
//
|
||||
// Step 1: If the element's node document's acquiring import maps is false,
|
||||
// then queue a task to fire an event named error at the element, and
|
||||
// return.
|
||||
if (!mModuleLoader->GetAcquiringImportMaps()) {
|
||||
NS_WARNING("ScriptLoader: acquiring import maps is false.");
|
||||
NS_DispatchToCurrentThread(
|
||||
NewRunnableMethod("nsIScriptElement::FireErrorEvent", aElement,
|
||||
&nsIScriptElement::FireErrorEvent));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Step 2: Set the element's node document's acquiring import maps to false.
|
||||
mModuleLoader->SetAcquiringImportMaps(false);
|
||||
|
||||
UniquePtr<ImportMap> importMap = mModuleLoader->ParseImportMap(request);
|
||||
|
||||
// https://wicg.github.io/import-maps/#register-an-import-map
|
||||
//
|
||||
// Step 1. If element’s the script’s result is null, then fire an event
|
||||
// named error at element, and return.
|
||||
if (!importMap) {
|
||||
NS_DispatchToCurrentThread(
|
||||
NewRunnableMethod("nsIScriptElement::FireErrorEvent", aElement,
|
||||
&nsIScriptElement::FireErrorEvent));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Step 3. Assert: element’s the script’s type is "importmap".
|
||||
MOZ_ASSERT(aElement->GetScriptIsImportMap());
|
||||
|
||||
// Step 4 to step 9 is done in RegisterImportMap.
|
||||
mModuleLoader->RegisterImportMap(std::move(importMap));
|
||||
return false;
|
||||
}
|
||||
|
||||
request->mState = ScriptLoadRequest::State::Ready;
|
||||
if (aElement->GetParserCreated() == FROM_PARSER_XSLT &&
|
||||
(!ReadyToExecuteParserBlockingScripts() || !mXSLTRequests.isEmpty())) {
|
||||
@@ -2181,12 +2118,6 @@ nsresult ScriptLoader::EvaluateScriptElement(ScriptLoadRequest* aRequest) {
|
||||
setProcessingScriptTag.emplace(context);
|
||||
}
|
||||
|
||||
// https://wicg.github.io/import-maps/#integration-script-type
|
||||
// Switch on the script's type for scriptElement:
|
||||
// "importmap"
|
||||
// Assert: Never reached.
|
||||
MOZ_ASSERT(!aRequest->IsImportMapRequest());
|
||||
|
||||
if (aRequest->IsModuleRequest()) {
|
||||
return aRequest->AsModuleRequest()->EvaluateModule();
|
||||
}
|
||||
@@ -3057,19 +2988,6 @@ void ScriptLoader::ReportErrorToConsole(ScriptLoadRequest* aRequest,
|
||||
params, nullptr, u""_ns, lineNo, columnNo);
|
||||
}
|
||||
|
||||
void ScriptLoader::ReportWarningToConsole(
|
||||
ScriptLoadRequest* aRequest, const char* aMessageName,
|
||||
const nsTArray<nsString>& aParams) const {
|
||||
nsIScriptElement* element =
|
||||
aRequest->GetScriptLoadContext()->GetScriptElement();
|
||||
uint32_t lineNo = element ? element->GetScriptLineNumber() : 0;
|
||||
uint32_t columnNo = element ? element->GetScriptColumnNumber() : 0;
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
"Script Loader"_ns, mDocument,
|
||||
nsContentUtils::eDOM_PROPERTIES, aMessageName,
|
||||
aParams, nullptr, u""_ns, lineNo, columnNo);
|
||||
}
|
||||
|
||||
void ScriptLoader::ReportPreloadErrorsToConsole(ScriptLoadRequest* aRequest) {
|
||||
if (NS_FAILED(aRequest->GetScriptLoadContext()->mUnreportedPreloadError)) {
|
||||
ReportErrorToConsole(
|
||||
|
||||
Reference in New Issue
Block a user