1
0
Fork 0
mirror of https://github.com/gorhill/uMatrix.git synced 2024-06-01 18:10:17 +12:00

Firefox: implement vAPI.tabs.injectScript

This commit is contained in:
Deathamns 2014-12-16 22:31:03 +01:00 committed by gorhill
parent 747f6f9955
commit 1ae15f1a61

View file

@ -44,7 +44,7 @@ var messagingConnector = function(response) {
var channels = vAPI.messaging.channels;
var channel, listener;
if ( response.broadcast === true ) {
if ( response.broadcast === true && !response.portName ) {
for ( channel in channels ) {
if ( channels.hasOwnProperty(channel) === false ) {
continue;
@ -92,6 +92,19 @@ vAPI.messaging = {
messagingConnector(JSON.parse(msg));
};
addMessageListener(this.connectorId, this.connector);
this.channels['vAPI'] = {};
this.channels['vAPI'].listener = function(msg) {
if (msg.cmd === 'injectScript') {
var details = msg.details;
if (!details.allFrames && window !== window.top) {
return;
}
self.injectScript(details.file || details.code, !details.file);
}
};
},
close: function() {