blob: b2aeb79054c50465e7133085447a5f85f736c129 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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)
}
|