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

Merge branch 'develop' into testing

This commit is contained in:
tmashuang 2018-05-21 15:14:47 -07:00
commit 848f8f805b
9 changed files with 22 additions and 13446 deletions

View File

@ -51,7 +51,6 @@ workflows:
- all-tests-pass:
requires:
- test-lint
- test-deps
- test-unit
- test-e2e-chrome
- test-e2e-firefox
@ -368,4 +367,4 @@ jobs:
- run:
name: All Tests Passed
command: echo 'weew - everything passed!'

View File

@ -166,7 +166,7 @@ function documentElementCheck () {
/**
* Checks if the current domain is blacklisted
*
*
* @returns {boolean} {@code true} if the current domain is blacklisted
*/
function blacklistedDomainCheck () {
@ -175,6 +175,7 @@ function blacklistedDomainCheck () {
'dropbox.com',
'webbyawards.com',
'cdn.shopify.com/s/javascripts/tricorder/xtld-read-only-frame.html',
'adyen.com',
]
var currentUrl = window.location.href
var currentRegex

View File

@ -1,6 +1,16 @@
# Guide to Porting MetaMask to a New Environment
MetaMask has been under continuous development for nearly two years now, and weve gradually discovered some very useful abstractions, that have allowed us to grow more easily. A couple of those layers together allow MetaMask to be ported to new environments and contexts increasingly easily.
MetaMask has been under continuous development for nearly two years now, and weve gradually discovered some useful abstractions that have allowed us to grow more easily. A couple of those layers together allow MetaMask to be ported to new environments and contexts increasingly easily (although it still could be easier, and please let us know if you get stuck!)
Before we get started, it's worth becoming familiar with our basic architecture:
![metamask-architecture-diagram](./architecture.png)
The `metamask-background` describes the file at `app/scripts/background.js`, which is the web extension singleton. This context instantiates an instance of the `MetaMask Controller`, which represents the user's accounts, a connection to the blockchain, and the interaction with new Dapps.
When a new site is visited, the WebExtension creates a new `ContentScript` in that page's context, which can be seen at `app/scripts/contentscript.js`. This script represents a per-page setup process, which creates the per-page `web3` api, connects it to the background script via the Port API (wrapped in a [stream abstraction](https://github.com/substack/stream-handbook)), and injected into the DOM before anything loads.
The most confusing part about porting MetaMask to a new platform is the way we provide the Web3 API over a series of streams between contexts. Once you understand how we create the [InpageProvider](../app/scripts/lib/inpage-provider.js) in the [inpage.js script](../app/scripts/inpage.js), you will be able to understand how the [port-stream](../app/scripts/lib/port-stream.js) is just a thin wrapper around the [postMessage API](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage), and a similar stream API can be wrapped around any communication channel to communicate with the `MetaMaskController` via its `setupUntrustedCommunication(stream, domain)` method.
### The MetaMask Controller
@ -90,3 +100,4 @@ If streams seem new and confusing to you, that's ok, they can seem strange at fi
## Conclusion
I hope this has been helpful to you! If you have any other questionsm, or points you think need clarification in this guide, please [open an issue on our GitHub](https://github.com/MetaMask/metamask-plugin/issues/new)!

8
package-lock.json generated
View File

@ -9154,13 +9154,13 @@
"resolved": "https://registry.npmjs.org/extension-link-enabler/-/extension-link-enabler-1.0.0.tgz",
"integrity": "sha1-V7kZru7fOL6XJwuYmM7nimN+RvM=",
"requires": {
"extensionizer": "1.0.0"
"extensionizer": "1.0.1"
}
},
"extensionizer": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/extensionizer/-/extensionizer-1.0.0.tgz",
"integrity": "sha1-AcIJu+ptnArLp3Epw6pKmpj8NTg="
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/extensionizer/-/extensionizer-1.0.1.tgz",
"integrity": "sha512-UES5CSOYqshNsWFrpORcQR47+ph6UvQK25mguD44IyeMemt40CG+LTZrH1PgpGUHX3w7ACtNQnmM0J+qEe8G0Q=="
},
"external-editor": {
"version": "2.1.0",

View File

@ -111,7 +111,7 @@
"ethjs-query": "^0.3.4",
"express": "^4.15.5",
"extension-link-enabler": "^1.0.0",
"extensionizer": "^1.0.0",
"extensionizer": "^1.0.1",
"fast-json-patch": "^2.0.4",
"fast-levenshtein": "^2.0.6",
"file-loader": "^1.1.11",

View File

@ -566,7 +566,6 @@
padding: 30px;
font-size: 22px;
color: $nile-blue;
height: 79px;
}
&__message {
@ -832,7 +831,6 @@
padding: 30px;
font-size: 22px;
color: $nile-blue;
height: 79px;
}
.notification-modal-message {

View File

@ -43,8 +43,6 @@
}
&__header__text {
height: 29px;
width: 179px;
color: #5B5D67;
font-family: Roboto;
font-size: 22px;

View File

@ -1,3 +1,4 @@
const log = require('loglevel')
const util = require('./util')
function tokenInfoGetter () {
@ -29,7 +30,7 @@ async function getSymbolAndDecimals (tokenAddress, existingTokens = []) {
token.decimals(),
])
} catch (err) {
console.log(`symbol() and decimal() calls for token at address ${tokenAddress} resulted in error:`, err)
log.warn(`symbol() and decimal() calls for token at address ${tokenAddress} resulted in error:`, err)
}
const [ symbol = [], decimals = [] ] = result

13432
yarn.lock

File diff suppressed because it is too large Load Diff