簡単なアドオンを作成するためにFireFoxBuilderを使い始めたところです。ウィンドウオブジェクトに直接アクセスできないことに気づきました。
私がやりたいのは、ウィンドウオブジェクトを取得し、それをいくつかのクラスと関数で汚染して、ページ自体からそれらを呼び出すことができるようにすることです。
以下は現在のコードです:
// This is an active module of the ritcoder Add-on
require("widget").Widget({
id: "widgetID1",
label: "My Mozilla Widget",
contentURL: "http://www.mozilla.org/favicon.ico",
onClick: function(evt){
var tabs = require("tabs");
var activeTab = tabs.activeTab;
var notifications = require("notifications");
notifications.notify({
title: "Jabberwocky",
text: "'Twas brillig, and the slithy toves",
data: "did gyre and gimble in the wabe",
onClick: function (data) {
console.log(data);
// console.log(this.data) would produce the same result.
}
});
activeTab.window.a=20; //this fails
context.alert('yesx');
}
});
どうすればよいですか?アクティブなページにコードを挿入して、呼び出すことができるようにします。
よろしく、