зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1368992 - JS bytecode cache: Do not attempt to encode bytecode if the compilation failed. r=mrbkap
This commit is contained in:
Родитель
148f24bb56
Коммит
558a57a171
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Do not save bytecode on compilation errors</title>
|
||||
</head>
|
||||
<body>
|
||||
<script id="watchme" src="file_js_cache_syntax_error.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
var // SyntaxError: missing variable name.
|
|
@ -760,6 +760,8 @@ support-files =
|
|||
file_js_cache.js
|
||||
file_js_cache_save_after_load.html
|
||||
file_js_cache_save_after_load.js
|
||||
file_js_cache_syntax_error.html
|
||||
file_js_cache_syntax_error.js
|
||||
[test_setInterval_uncatchable_exception.html]
|
||||
skip-if = debug == false
|
||||
[test_settimeout_extra_arguments.html]
|
||||
|
|
|
@ -191,6 +191,23 @@
|
|||
|
||||
}, "Save bytecode after the initialization of the page");
|
||||
|
||||
promise_test(async function() {
|
||||
// (see above)
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
['dom.script_loader.bytecode_cache.enabled', true],
|
||||
['dom.expose_test_interfaces', true],
|
||||
['dom.script_loader.bytecode_cache.strategy', -1]
|
||||
]});
|
||||
|
||||
// The test page loads a script which contains a syntax error, we should
|
||||
// not attempt to encode any bytecode for it.
|
||||
var stateMachineResult =
|
||||
WaitForScriptTagEvent("file_js_cache_syntax_error.html");
|
||||
assert_equals(await stateMachineResult, "source_exec",
|
||||
"Check the lack of bytecode encoding");
|
||||
|
||||
}, "Do not save bytecode on compilation errors");
|
||||
|
||||
done();
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -2132,7 +2132,7 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
|
|||
}
|
||||
|
||||
// Queue the current script load request to later save the bytecode.
|
||||
if (NS_SUCCEEDED(rv) && encodeBytecode) {
|
||||
if (script && encodeBytecode) {
|
||||
aRequest->mScript = script;
|
||||
HoldJSObjects(aRequest);
|
||||
TRACE_FOR_TEST(aRequest->mElement, "scriptloader_encode");
|
||||
|
|
Загрузка…
Ссылка в новой задаче