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:
parent
a646bfb506
commit
06536b1d0f
@ -38,7 +38,7 @@ const getEnvironmentType = (url = window.location.href) => {
|
|||||||
const parsedUrl = new URL(url)
|
const parsedUrl = new URL(url)
|
||||||
if (parsedUrl.pathname === '/popup.html') {
|
if (parsedUrl.pathname === '/popup.html') {
|
||||||
return ENVIRONMENT_TYPE_POPUP
|
return ENVIRONMENT_TYPE_POPUP
|
||||||
} else if (parsedUrl.pathname === '/home.html') {
|
} else if (['/home.html', '/phishing.html'].includes(parsedUrl.pathname)) {
|
||||||
return ENVIRONMENT_TYPE_FULLSCREEN
|
return ENVIRONMENT_TYPE_FULLSCREEN
|
||||||
} else if (parsedUrl.pathname === '/notification.html') {
|
} else if (parsedUrl.pathname === '/notification.html') {
|
||||||
return ENVIRONMENT_TYPE_NOTIFICATION
|
return ENVIRONMENT_TYPE_NOTIFICATION
|
||||||
|
@ -18,11 +18,16 @@ describe('getEnvironmentType', function () {
|
|||||||
assert.equal(environmentType, ENVIRONMENT_TYPE_NOTIFICATION)
|
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')
|
const environmentType = getEnvironmentType('http://extension-id/home.html')
|
||||||
assert.equal(environmentType, ENVIRONMENT_TYPE_FULLSCREEN)
|
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 () {
|
it('should return background type', function () {
|
||||||
const environmentType = getEnvironmentType('http://extension-id/_generated_background_page.html')
|
const environmentType = getEnvironmentType('http://extension-id/_generated_background_page.html')
|
||||||
assert.equal(environmentType, ENVIRONMENT_TYPE_BACKGROUND)
|
assert.equal(environmentType, ENVIRONMENT_TYPE_BACKGROUND)
|
||||||
|
Loading…
Reference in New Issue
Block a user