You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
859 B
27 lines
859 B
|
|
/*
|
|
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)
|
|
}
|
|
|