From 01dde6e1f9095b157947982de22a4d693199b471 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 10 Sep 2018 12:17:03 +0800 Subject: [PATCH 1/2] Delete cookies before closing page --- src/main.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index 7426e63..5dc3a46 100644 --- a/src/main.js +++ b/src/main.js @@ -131,8 +131,14 @@ const fetchContent = async (pageURL) => { // Get page content let content = await pTimeout(page.content(), config.render.timeout * 1000, 'Render timed out'); - // Close page - page.close(); + // Delete cookies + page.cookies().then(cookies => { + const cookieNames = cookies.map(cookie => ({ name: cookie.name })); + return page.deleteCookie(...cookieNames).then(() => { + // Close page + page.close(); + }); + }); // Remove comments content = content.replace(//g, ''); From 0231ac9a54efc75b72139ca0a4906e95d2a1b6c8 Mon Sep 17 00:00:00 2001 From: Lester Chan Date: Mon, 10 Sep 2018 12:24:28 +0800 Subject: [PATCH 2/2] Fix arrow-parens --- src/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index 5dc3a46..e18a3b9 100644 --- a/src/main.js +++ b/src/main.js @@ -132,8 +132,8 @@ const fetchContent = async (pageURL) => { let content = await pTimeout(page.content(), config.render.timeout * 1000, 'Render timed out'); // Delete cookies - page.cookies().then(cookies => { - const cookieNames = cookies.map(cookie => ({ name: cookie.name })); + page.cookies().then((cookies) => { + const cookieNames = cookies.map((cookie) => ({ name: cookie.name })); return page.deleteCookie(...cookieNames).then(() => { // Close page page.close();