From ad1802188dfbd91c59f02e6441e4d9fc24d35f28 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Mon, 15 Jul 2019 17:54:42 -0700 Subject: [PATCH] fix(launcher): disable component extensions (#4704) Chrome has a set of component extensions - e.g. CryptoTokenExtension that helps with 2FA. These extensions are loaded regardless of the `--disable-extensions` flag we already pass. To disable these extensions, we need to pass additional `--disable-component-extensions-with-background-pages` flag. Fix #4300 --- lib/Launcher.js | 1 + test/assets/simple-extension/index.js | 3 ++- test/headful.spec.js | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Launcher.js b/lib/Launcher.js index 3e5f5031308..86e425bd532 100644 --- a/lib/Launcher.js +++ b/lib/Launcher.js @@ -42,6 +42,7 @@ const DEFAULT_ARGS = [ '--disable-backgrounding-occluded-windows', '--disable-breakpad', '--disable-client-side-phishing-detection', + '--disable-component-extensions-with-background-pages', '--disable-default-apps', '--disable-dev-shm-usage', '--disable-extensions', diff --git a/test/assets/simple-extension/index.js b/test/assets/simple-extension/index.js index a87bdeed16b..a0bb3f4eae7 100644 --- a/test/assets/simple-extension/index.js +++ b/test/assets/simple-extension/index.js @@ -1 +1,2 @@ -// Mock script for background extension \ No newline at end of file +// Mock script for background extension +window.MAGIC = 42; diff --git a/test/headful.spec.js b/test/headful.spec.js index 965fc2431f4..59bc00798c5 100644 --- a/test/headful.spec.js +++ b/test/headful.spec.js @@ -73,6 +73,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, defaultBrowse const backgroundPageTarget = await waitForBackgroundPageTarget(browserWithExtension); const page = await backgroundPageTarget.page(); expect(await page.evaluate(() => 2 * 3)).toBe(6); + expect(await page.evaluate(() => window.MAGIC)).toBe(42); await browserWithExtension.close(); }); it('should have default url when launching browser', async function() {