aboutsummaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-03-30 06:19:46 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-03-30 06:19:46 +0800
commit4cf3beda25e7883aac37ee188d3bb102dea4afa3 (patch)
tree837961d02cc359e446342094bf8841b615029cc3 /library
parent2b1a9c5ae880afe1a5bf2d11eefbbdf26dc6e27c (diff)
downloadtangerine-wallet-browser-4cf3beda25e7883aac37ee188d3bb102dea4afa3.tar.gz
tangerine-wallet-browser-4cf3beda25e7883aac37ee188d3bb102dea4afa3.tar.zst
tangerine-wallet-browser-4cf3beda25e7883aac37ee188d3bb102dea4afa3.zip
Bump sw-stream and setup "untrusted and trusted comunication"
Diffstat (limited to 'library')
-rw-r--r--library/controller.js5
-rw-r--r--library/popup.js5
-rw-r--r--library/sw-core.js6
3 files changed, 11 insertions, 5 deletions
diff --git a/library/controller.js b/library/controller.js
index 126e972c8..d4a76d316 100644
--- a/library/controller.js
+++ b/library/controller.js
@@ -9,7 +9,10 @@ const background = new SWcontroller({
const pageStream = new ParentStream()
background.on('ready', (_) => {
// var inpageProvider = new MetamaskInpageProvider(SwStream(background.controller))
- let swStream = SwStream(background.controller)
+ let swStream = SwStream({
+ serviceWorker: background.controller,
+ context: 'dapp',
+ })
pageStream.pipe(swStream).pipe(pageStream)
console.log('********************WOOP*********************')
})
diff --git a/library/popup.js b/library/popup.js
index bb7051055..a9d934c43 100644
--- a/library/popup.js
+++ b/library/popup.js
@@ -21,7 +21,10 @@ const background = new SWcontroller({
background.on('ready', (readSw) => {
// var inpageProvider = new MetamaskInpageProvider(SwStream(background.controller))
// startPopup(inpageProvider)
- startPopup(SwStream(background.controller))
+ swStream = SwStream({
+ serviceWorker: background.controller,
+ })
+ startPopup()
})
background.on('message', (messageEvent) => {debugger})
background.startWorker()
diff --git a/library/sw-core.js b/library/sw-core.js
index 4d95898d9..9f399cccf 100644
--- a/library/sw-core.js
+++ b/library/sw-core.js
@@ -117,11 +117,11 @@ function setupController (initState, client) {
*/
connectionListener.on('remote', (portStream, messageEvent) => {
console.log('REMOTE CONECTION FOUND***********')
- connectRemote(portStream, messageEvent.origin)
+ connectRemote(portStream, messageEvent.data.context)
})
- function connectRemote (connectionStream, originDomain) {
- var isMetaMaskInternalProcess = (originDomain === 'http://localhost:9001')
+ function connectRemote (connectionStream, context) {
+ var isMetaMaskInternalProcess = (context !== 'dapp')
if (isMetaMaskInternalProcess) {
// communication with popup
controller.setupTrustedCommunication(connectionStream, 'MetaMask')