Merge pull request #6977 from MetaMask/develop

Master v7.0.1
feature/default_network_editable
Dan Finlay 5 years ago committed by GitHub
commit b3ad16306c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      CHANGELOG.md
  2. 2
      app/manifest.json
  3. 2
      app/scripts/controllers/onboarding.js
  4. 2
      app/scripts/lib/enums.js
  5. 11
      app/scripts/lib/util.js
  6. 6
      app/scripts/platforms/extension.js
  7. 3
      app/vendor/trezor/usb-permissions.js
  8. 15
      test/e2e/run-all.sh
  9. 44
      test/unit/app/util-test.js

@ -2,6 +2,9 @@
## Current Develop Branch
## 7.0.1 Thu Aug 08 2019
- [#6975](https://github.com/MetaMask/metamask-extension/pull/6975): Ensure seed phrase backup notification only shows up for new users
## 7.0.0 Fri Aug 02 2019
- [#6828](https://github.com/MetaMask/metamask-extension/pull/6828): Capitalized speed up label to match rest of UI
- [#6874](https://github.com/MetaMask/metamask-extension/pull/6928): Allows skipping of seed phrase challenge during onboarding, and completing it at a later time

@ -1,7 +1,7 @@
{
"name": "__MSG_appName__",
"short_name": "__MSG_appName__",
"version": "7.0.0",
"version": "7.0.1",
"manifest_version": 2,
"author": "https://metamask.io",
"description": "__MSG_appDescription__",

@ -23,7 +23,7 @@ class OnboardingController {
*/
constructor (opts = {}) {
const initState = extend({
seedPhraseBackedUp: null,
seedPhraseBackedUp: true,
}, opts.initState)
this.store = new ObservableStore(initState)
}

@ -1,6 +1,7 @@
const ENVIRONMENT_TYPE_POPUP = 'popup'
const ENVIRONMENT_TYPE_NOTIFICATION = 'notification'
const ENVIRONMENT_TYPE_FULLSCREEN = 'fullscreen'
const ENVIRONMENT_TYPE_BACKGROUND = 'background'
const PLATFORM_BRAVE = 'Brave'
const PLATFORM_CHROME = 'Chrome'
@ -12,6 +13,7 @@ module.exports = {
ENVIRONMENT_TYPE_POPUP,
ENVIRONMENT_TYPE_NOTIFICATION,
ENVIRONMENT_TYPE_FULLSCREEN,
ENVIRONMENT_TYPE_BACKGROUND,
PLATFORM_BRAVE,
PLATFORM_CHROME,
PLATFORM_EDGE,

@ -5,6 +5,7 @@ const {
ENVIRONMENT_TYPE_POPUP,
ENVIRONMENT_TYPE_NOTIFICATION,
ENVIRONMENT_TYPE_FULLSCREEN,
ENVIRONMENT_TYPE_BACKGROUND,
PLATFORM_FIREFOX,
PLATFORM_OPERA,
PLATFORM_CHROME,
@ -28,17 +29,21 @@ function getStack () {
* - 'popup' refers to the extension opened through the browser app icon (in top right corner in chrome and firefox)
* - 'responsive' refers to the main browser window
* - 'notification' refers to the popup that appears in its own window when taking action outside of metamask
* - 'background' refers to the background page
*
* @returns {string} A single word label that represents the type of window through which the app is being viewed
*
*/
const getEnvironmentType = (url = window.location.href) => {
if (url.match(/popup.html(?:#.*)*$/)) {
const parsedUrl = new URL(url)
if (parsedUrl.pathname === '/popup.html') {
return ENVIRONMENT_TYPE_POPUP
} else if (url.match(/home.html(?:\?.+)*$/) || url.match(/home.html(?:#.*)*$/)) {
} else if (parsedUrl.pathname === '/home.html') {
return ENVIRONMENT_TYPE_FULLSCREEN
} else {
} else if (parsedUrl.pathname === '/notification.html') {
return ENVIRONMENT_TYPE_NOTIFICATION
} else {
return ENVIRONMENT_TYPE_BACKGROUND
}
}

@ -1,6 +1,9 @@
const extension = require('extensionizer')
const {createExplorerLink: explorerLink} = require('etherscan-link')
const {getEnvironmentType} = require('../lib/util')
const {ENVIRONMENT_TYPE_BACKGROUND} = require('../lib/enums')
class ExtensionPlatform {
//
@ -35,6 +38,9 @@ class ExtensionPlatform {
extensionURL += `#${route}`
}
this.openWindow({ url: extensionURL })
if (getEnvironmentType() !== ENVIRONMENT_TYPE_BACKGROUND) {
window.close()
}
}
getPlatformInfo (cb) {

@ -25,6 +25,7 @@ const switchToPopupTab = (event) => {
return;
}
// TODO: remove this query, or add `tabs` permission. This does not work.
// triggered from 'beforeunload' event
// find tab by popup pattern and switch to it
chrome.tabs.query({
@ -47,4 +48,4 @@ window.addEventListener('message', event => {
}
});
window.addEventListener('beforeunload', switchToPopupTab);
window.addEventListener('beforeunload', switchToPopupTab);

@ -5,8 +5,13 @@ set -e
set -u
set -o pipefail
# Set the environment variable 'GANACHE_ARGS' to change any optional ganache flags
# By default, the flag `--quiet` is used. Setting 'GANACHE_ARGS' will override the default.
OPTIONAL_GANACHE_ARGS="${GANACHE_ARGS---quiet}"
BASE_GANACHE_ARGS="${OPTIONAL_GANACHE_ARGS} --blockTime 2"
export PATH="$PATH:./node_modules/.bin"
export GANACHE_ARGS='--blockTime 2 --quiet'
export GANACHE_ARGS="${BASE_GANACHE_ARGS}"
concurrently --kill-others \
--names 'ganache,dapp,e2e' \
@ -24,7 +29,7 @@ concurrently --kill-others \
'yarn dapp' \
'sleep 5 && mocha test/e2e/metamask-responsive-ui.spec'
export GANACHE_ARGS="$GANACHE_ARGS --deterministic --account=0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9,25000000000000000000"
export GANACHE_ARGS="${BASE_GANACHE_ARGS} --deterministic --account=0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9,25000000000000000000"
concurrently --kill-others \
--names 'ganache,e2e' \
--prefix '[{time}][{name}]' \
@ -32,7 +37,7 @@ concurrently --kill-others \
'yarn ganache:start' \
'sleep 5 && mocha test/e2e/from-import-ui.spec'
export GANACHE_ARGS="$GANACHE_ARGS --deterministic --account=0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9,25000000000000000000"
export GANACHE_ARGS="${BASE_GANACHE_ARGS} --deterministic --account=0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9,25000000000000000000"
concurrently --kill-others \
--names 'ganache,e2e' \
--prefix '[{time}][{name}]' \
@ -41,7 +46,7 @@ concurrently --kill-others \
'sleep 5 && mocha test/e2e/send-edit.spec'
export GANACHE_ARGS="$GANACHE_ARGS --deterministic --account=0x250F458997A364988956409A164BA4E16F0F99F916ACDD73ADCD3A1DE30CF8D1,0 --account=0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9,25000000000000000000"
export GANACHE_ARGS="${BASE_GANACHE_ARGS} --deterministic --account=0x250F458997A364988956409A164BA4E16F0F99F916ACDD73ADCD3A1DE30CF8D1,0 --account=0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9,25000000000000000000"
concurrently --kill-others \
--names 'ganache,sendwithprivatedapp,e2e' \
--prefix '[{time}][{name}]' \
@ -50,7 +55,7 @@ concurrently --kill-others \
'npm run sendwithprivatedapp' \
'sleep 5 && mocha test/e2e/incremental-security.spec'
export GANACHE_ARGS="$GANACHE_ARGS --deterministic --account=0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9,25000000000000000000"
export GANACHE_ARGS="${BASE_GANACHE_ARGS} --deterministic --account=0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9,25000000000000000000"
concurrently --kill-others \
--names 'ganache,dapp,e2e' \
--prefix '[{time}][{name}]' \

@ -1,6 +1,48 @@
const assert = require('assert')
const { sufficientBalance } = require('../../../app/scripts/lib/util')
const { getEnvironmentType, sufficientBalance } = require('../../../app/scripts/lib/util')
const {
ENVIRONMENT_TYPE_POPUP,
ENVIRONMENT_TYPE_NOTIFICATION,
ENVIRONMENT_TYPE_FULLSCREEN,
ENVIRONMENT_TYPE_BACKGROUND,
} = require('../../../app/scripts/lib/enums')
describe('getEnvironmentType', function () {
it('should return popup type', function () {
const environmentType = getEnvironmentType('http://extension-id/popup.html')
assert.equal(environmentType, ENVIRONMENT_TYPE_POPUP)
})
it('should return notification type', function () {
const environmentType = getEnvironmentType('http://extension-id/notification.html')
assert.equal(environmentType, ENVIRONMENT_TYPE_NOTIFICATION)
})
it('should return fullscreen type', function () {
const environmentType = getEnvironmentType('http://extension-id/home.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)
})
it('should return the correct type for a URL with a hash fragment', function () {
const environmentType = getEnvironmentType('http://extension-id/popup.html#hash')
assert.equal(environmentType, ENVIRONMENT_TYPE_POPUP)
})
it('should return the correct type for a URL with query parameters', function () {
const environmentType = getEnvironmentType('http://extension-id/popup.html?param=foo')
assert.equal(environmentType, ENVIRONMENT_TYPE_POPUP)
})
it('should return the correct type for a URL with query parameters and a hash fragment', function () {
const environmentType = getEnvironmentType('http://extension-id/popup.html?param=foo#hash')
assert.equal(environmentType, ENVIRONMENT_TYPE_POPUP)
})
})
describe('SufficientBalance', function () {
it('returns true if max tx cost is equal to balance.', function () {

Loading…
Cancel
Save