From 1957f06c34fb3ecf022ca1edaa7445d4b8d692cd Mon Sep 17 00:00:00 2001 From: liudongqi Date: Wed, 4 Sep 2024 14:24:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/routes/index.js b/routes/index.js index 52f0491..fa1e645 100644 --- a/routes/index.js +++ b/routes/index.js @@ -90,6 +90,7 @@ async function handle(url, htmlStr, jsText, cookie, userAgent) { } // 加载dom let dom = await jsDom(htmlStr); + console.log('html 加载--->', dom.serialize()) window = dom.window // js执行成功后的瑞树会跳转页面 会触发onbeforeunload钩子 window.onbeforeunload = async (url) => { @@ -104,17 +105,16 @@ async function handle(url, htmlStr, jsText, cookie, userAgent) { let js = loadJs(window, jsText); // 执行 js let script = new Script(js); + console.log('js 加载--->', js) + let internalVMContext = dom.getInternalVMContext(); script.runInContext(internalVMContext); // 等待 onbeforeunload 钩子触发后的回掉 - let timeout; - let reTry; + let timeout = -1; + let reTry = -1; if (process.env.NODE_ENV === 'prod') { timeout = 100 reTry = 10 - } else { - timeout = 1000 - reTry = 10 } let val = await store.waitGetAndDelete(uuid, timeout, reTry)