зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1517167 Part 1 - Set introduction information for dynamically generated <script> elements, r=jorendorff.
--HG-- extra : rebase_source : 6a2080d724ccac7ccc5f1c45191a1f46ceed6c56
This commit is contained in:
Родитель
83db861464
Коммит
655a9a04fe
|
@ -2301,8 +2301,9 @@ nsresult ScriptLoader::FillCompileOptionsForRequest(
|
|||
|
||||
bool isScriptElement =
|
||||
!aRequest->IsModuleRequest() || aRequest->AsModuleRequest()->IsTopLevel();
|
||||
aOptions->setIntroductionType(isScriptElement ? "scriptElement"
|
||||
: "importedModule");
|
||||
aOptions->setIntroductionInfoToCaller(jsapi.cx(),
|
||||
isScriptElement ? "scriptElement"
|
||||
: "importedModule");
|
||||
aOptions->setFileAndLine(aRequest->mURL.get(), aRequest->mLineNo);
|
||||
aOptions->setIsRunOnce(true);
|
||||
aOptions->setNoScriptRval(true);
|
||||
|
|
|
@ -508,6 +508,10 @@ class MOZ_STACK_CLASS JS_PUBLIC_API CompileOptions final
|
|||
return *this;
|
||||
}
|
||||
|
||||
// Set introduction information according to any currently executing script.
|
||||
CompileOptions& setIntroductionInfoToCaller(JSContext* cx,
|
||||
const char* introductionType);
|
||||
|
||||
CompileOptions& maybeMakeStrictMode(bool strict) {
|
||||
strictOption = strictOption || strict;
|
||||
return *this;
|
||||
|
|
|
@ -3547,6 +3547,23 @@ JS::CompileOptions::CompileOptions(JSContext* cx)
|
|||
cx->options().throwOnAsmJSValidationFailure();
|
||||
}
|
||||
|
||||
CompileOptions& CompileOptions::setIntroductionInfoToCaller(
|
||||
JSContext* cx, const char* introductionType) {
|
||||
RootedScript maybeScript(cx);
|
||||
const char* filename;
|
||||
unsigned lineno;
|
||||
uint32_t pcOffset;
|
||||
bool mutedErrors;
|
||||
DescribeScriptedCallerForCompilation(cx, &maybeScript, &filename, &lineno,
|
||||
&pcOffset, &mutedErrors);
|
||||
if (filename) {
|
||||
return setIntroductionInfo(filename, introductionType, lineno,
|
||||
maybeScript, pcOffset);
|
||||
} else {
|
||||
return setIntroductionType(introductionType);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(JS_BUILD_BINAST)
|
||||
|
||||
JSScript* JS::DecodeBinAST(JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
|
|
Загрузка…
Ссылка в новой задаче