Browse Source

Firefox: implement vAPI.tabs.injectScript

pull/2/head
Deathamns 10 years ago
committed by gorhill
parent
commit
1ae15f1a61
  1. 15
      platform/firefox/vapi-client.js

15
platform/firefox/vapi-client.js

@ -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() {

Loading…
Cancel
Save