From 7136b3aaffedf1707adf38550c907daa7e7a2e23 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Tue, 13 Jun 2017 15:00:55 -0700 Subject: [PATCH] Improve inPageCallback handling This patch improves inPageCallback handling so that it doesn't retain any variables. --- lib/Page.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Page.js b/lib/Page.js index 2f8c9b3a8e4..d93030b8a60 100644 --- a/lib/Page.js +++ b/lib/Page.js @@ -128,9 +128,11 @@ class Page extends EventEmitter { function inPageCallback(callbackName) { window[callbackName] = (...args) => { window[callbackName].__args = args; - window[callbackName].__result = undefined; debugger; - return window[callbackName].__result; + var result = window[callbackName].__result; + delete window[callbackName].__result; + delete window[callbackName].__args; + return result; }; } }