js-executor: ScriptMap optimize work

This commit is contained in:
Vladyslav_Prykhodko 2021-06-02 10:41:24 +03:00
parent 41391dbef8
commit ab5f1b5b63

View File

@ -196,8 +196,9 @@ JsInvokeMessageProcessor.prototype.sendResponse = function (requestId, responseT
JsInvokeMessageProcessor.prototype.getOrCompileScript = function (scriptId, scriptBody) { JsInvokeMessageProcessor.prototype.getOrCompileScript = function (scriptId, scriptBody) {
var self = this; var self = this;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
if (self.scriptMap.has(scriptId)) { const script = self.scriptMap.get(scriptId);
resolve(self.scriptMap.get(scriptId)); if (script !== undefined) {
resolve(script);
} else { } else {
self.executor.compileScript(scriptBody).then( self.executor.compileScript(scriptBody).then(
(script) => { (script) => {