From 33b465f93cdf1cb6db4fd4919d21173c1c3e6a17 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Thu, 17 Oct 2019 18:27:32 -0230 Subject: [PATCH] Fix phishing detect script --- app/scripts/lib/util.js | 2 +- test/unit/app/util-test.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/scripts/lib/util.js b/app/scripts/lib/util.js index a8930a2f3796..114203d7f8c8 100644 --- a/app/scripts/lib/util.js +++ b/app/scripts/lib/util.js @@ -38,7 +38,7 @@ const getEnvironmentType = (url = window.location.href) => { const parsedUrl = new URL(url) if (parsedUrl.pathname === '/popup.html') { return ENVIRONMENT_TYPE_POPUP - } else if (parsedUrl.pathname === '/home.html') { + } else if (['/home.html', '/phishing.html'].includes(parsedUrl.pathname)) { return ENVIRONMENT_TYPE_FULLSCREEN } else if (parsedUrl.pathname === '/notification.html') { return ENVIRONMENT_TYPE_NOTIFICATION diff --git a/test/unit/app/util-test.js b/test/unit/app/util-test.js index 259bd708bde1..a6a4a458c98a 100644 --- a/test/unit/app/util-test.js +++ b/test/unit/app/util-test.js @@ -18,11 +18,16 @@ describe('getEnvironmentType', function () { assert.equal(environmentType, ENVIRONMENT_TYPE_NOTIFICATION) }) - it('should return fullscreen type', function () { + it('should return fullscreen type for home.html', function () { const environmentType = getEnvironmentType('http://extension-id/home.html') assert.equal(environmentType, ENVIRONMENT_TYPE_FULLSCREEN) }) + it('should return fullscreen type for phishing.html', function () { + const environmentType = getEnvironmentType('http://extension-id/phishing.html') + assert.equal(environmentType, ENVIRONMENT_TYPE_FULLSCREEN) + }) + it('should return background type', function () { const environmentType = getEnvironmentType('http://extension-id/_generated_background_page.html') assert.equal(environmentType, ENVIRONMENT_TYPE_BACKGROUND)