Improve inPageCallback handling

This patch improves inPageCallback handling so that it doesn't
retain any variables.
This commit is contained in:
Andrey Lushnikov 2017-06-13 15:00:55 -07:00
parent 549535e674
commit 7136b3aaff

View File

@ -128,9 +128,11 @@ class Page extends EventEmitter {
function inPageCallback(callbackName) { function inPageCallback(callbackName) {
window[callbackName] = (...args) => { window[callbackName] = (...args) => {
window[callbackName].__args = args; window[callbackName].__args = args;
window[callbackName].__result = undefined;
debugger; debugger;
return window[callbackName].__result; var result = window[callbackName].__result;
delete window[callbackName].__result;
delete window[callbackName].__args;
return result;
}; };
} }
} }