1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fix phishing detect script (#7287)

This commit is contained in:
Whymarrh Whitby 2019-10-18 13:35:32 -02:30 committed by GitHub
parent a646bfb506
commit 06536b1d0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -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

View File

@ -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)