зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1330688 - Report a better error in the console when a module load fails r=baku r=flod
This commit is contained in:
Родитель
81cb582d32
Коммит
8a6245d972
|
@ -339,10 +339,13 @@ ScriptSourceEmpty=‘%S’ attribute of <script> element is empty.
|
|||
ScriptSourceInvalidUri=‘%S’ attribute of <script> element is not a valid URI: “%S”
|
||||
# LOCALIZATION NOTE: Do not translate "<script>".
|
||||
ScriptSourceLoadFailed=Loading failed for the <script> with source “%S”.
|
||||
ModuleSourceLoadFailed=Loading failed for the module with source “%S”.
|
||||
# LOCALIZATION NOTE: Do not translate "<script>".
|
||||
ScriptSourceMalformed=<script> source URI is malformed: “%S”.
|
||||
ModuleSourceMalformed=Module source URI is malformed: “%S”.
|
||||
# LOCALIZATION NOTE: Do not translate "<script>".
|
||||
ScriptSourceNotAllowed=<script> source URI is not allowed in this document: “%S”.
|
||||
ModuleSourceNotAllowed=Module source URI is not allowed in this document: “%S”.
|
||||
# LOCALIZATION NOTE: %1$S is the invalid property value and %2$S is the property name.
|
||||
InvalidKeyframePropertyValue=Keyframe property value “%1$S” is invalid according to the syntax for “%2$S”.
|
||||
# LOCALIZATION NOTE: Do not translate "ReadableStream".
|
||||
|
|
|
@ -1423,13 +1423,18 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
|
|||
|
||||
rv = StartLoad(request);
|
||||
if (NS_FAILED(rv)) {
|
||||
const char* message = "ScriptSourceLoadFailed";
|
||||
|
||||
const char* message;
|
||||
bool isScript = scriptKind == ScriptKind::Classic;
|
||||
if (rv == NS_ERROR_MALFORMED_URI) {
|
||||
message = "ScriptSourceMalformed";
|
||||
message =
|
||||
isScript ? "ScriptSourceMalformed" : "ModuleSourceMalformed";
|
||||
}
|
||||
else if (rv == NS_ERROR_DOM_BAD_URI) {
|
||||
message = "ScriptSourceNotAllowed";
|
||||
message =
|
||||
isScript ? "ScriptSourceNotAllowed" : "ModuleSourceNotAllowed";
|
||||
} else {
|
||||
message =
|
||||
isScript ? "ScriptSourceLoadFailed" : "ModuleSourceLoadFailed";
|
||||
}
|
||||
|
||||
NS_ConvertUTF8toUTF16 url(scriptURI->GetSpecOrDefault());
|
||||
|
@ -2843,11 +2848,16 @@ ScriptLoader::OnStreamComplete(nsIIncrementalStreamLoader* aLoader,
|
|||
AppendUTF8toUTF16(aRequest->mURI->GetSpecOrDefault(), url);
|
||||
}
|
||||
|
||||
const char* message = "ScriptSourceLoadFailed";
|
||||
if (aRequest->IsModuleRequest()) {
|
||||
message = "ModuleSourceLoadFailed";
|
||||
}
|
||||
|
||||
const char16_t* params[] = { url.get() };
|
||||
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
NS_LITERAL_CSTRING("Script Loader"), mDocument,
|
||||
nsContentUtils::eDOM_PROPERTIES, "ScriptSourceLoadFailed",
|
||||
nsContentUtils::eDOM_PROPERTIES, message,
|
||||
params, ArrayLength(params), nullptr,
|
||||
EmptyString(), lineNo);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче