diff options
author | frankiebee <frankie.diamond@gmail.com> | 2017-03-29 09:02:08 +0800 |
---|---|---|
committer | frankiebee <frankie.diamond@gmail.com> | 2017-03-29 09:02:08 +0800 |
commit | 79248ae5cd3fb1314c5a7ff71c05f9dbe7b3a4cd (patch) | |
tree | 5b08ce8a990ae2b33ff7d5a81b17fcfe0130a658 /library/lib | |
parent | 282775c52f558bbd90d4d0a1706a835dde6c3202 (diff) | |
download | tangerine-wallet-browser-79248ae5cd3fb1314c5a7ff71c05f9dbe7b3a4cd.tar tangerine-wallet-browser-79248ae5cd3fb1314c5a7ff71c05f9dbe7b3a4cd.tar.gz tangerine-wallet-browser-79248ae5cd3fb1314c5a7ff71c05f9dbe7b3a4cd.tar.bz2 tangerine-wallet-browser-79248ae5cd3fb1314c5a7ff71c05f9dbe7b3a4cd.tar.lz tangerine-wallet-browser-79248ae5cd3fb1314c5a7ff71c05f9dbe7b3a4cd.tar.xz tangerine-wallet-browser-79248ae5cd3fb1314c5a7ff71c05f9dbe7b3a4cd.tar.zst tangerine-wallet-browser-79248ae5cd3fb1314c5a7ff71c05f9dbe7b3a4cd.zip |
WIP: Untrusted external connections eg: dapps
Diffstat (limited to 'library/lib')
-rw-r--r-- | library/lib/setup-provider.js | 1 | ||||
-rw-r--r-- | library/lib/setup-untrusted-connection.js | 27 |
2 files changed, 27 insertions, 1 deletions
diff --git a/library/lib/setup-provider.js b/library/lib/setup-provider.js index 9efd209cb..68be99c9e 100644 --- a/library/lib/setup-provider.js +++ b/library/lib/setup-provider.js @@ -22,4 +22,3 @@ function getProvider(){ return inpageProvider } - diff --git a/library/lib/setup-untrusted-connection.js b/library/lib/setup-untrusted-connection.js new file mode 100644 index 000000000..b2aeb7905 --- /dev/null +++ b/library/lib/setup-untrusted-connection.js @@ -0,0 +1,27 @@ + +/* +IFRAME + var pageStream = new LocalMessageDuplexStream({ + name: 'contentscript', + target: 'inpage', + }) +SERVICEWORKER + pageStream.on('error', console.error) + var pluginPort = extension.runtime.connect({name: 'contentscript'}) + var pluginStream = new PortStream(pluginPort) + pluginStream.on('error', console.error) +IFRAME --> SW + // forward communication plugin->inpage + pageStream.pipe(pluginStream).pipe(pageStream) +*/ + +module.exports = SetupUntrustedComunicationWithSW + +function SetupUntrustedComunicationWithSW (connectionStream, readySwStream) { + pageStream.on('error', console.error) + var pluginPort = extension.runtime.connect({name: 'contentscript'}) + var pluginStream = new PortStream(pluginPort) + pluginStream.on('error', console.error) + // forward communication plugin->inpage + pageStream.pipe(pluginStream).pipe(pageStream) +} |