Firefox 插件 SDK - 将样式表附加到触发错误的选项卡
Firefox addon SDK - attaching a stylesheet to a tab triggering an error
我试图在选项卡加载时将内容脚本添加到选项卡,但我的代码出现错误
TypeError: window.QueryInterface is not a function'
当我 运行 attachTo 方法时。
var attachTo = require('sdk/content/mod').attachTo;
var style = require('sdk/stylesheet/style');
tabs.on('ready', function(tab) {
var worker = tab.attach({
contentScriptFile: ['./content.js']
});
var s = style.Style({
uri: './style.css'
});
attachTo(s, tabs.activeTab.window); <------------ causes the error
array.add(pageWorkers, worker);
mainListener(worker);
});
有什么想法吗?
我试图在选项卡加载时将内容脚本添加到选项卡,但我的代码出现错误
TypeError: window.QueryInterface is not a function'
当我 运行 attachTo 方法时。
var attachTo = require('sdk/content/mod').attachTo;
var style = require('sdk/stylesheet/style');
tabs.on('ready', function(tab) {
var worker = tab.attach({
contentScriptFile: ['./content.js']
});
var s = style.Style({
uri: './style.css'
});
attachTo(s, tabs.activeTab.window); <------------ causes the error
array.add(pageWorkers, worker);
mainListener(worker);
});
有什么想法吗?