I m using the Firefox Addon SDK, 建造一些能够监测和显示吉普里特人贩运情况的项目。 类似HTTPFox或Live HT Headers。 我有兴趣确定哪一个表格(如果有的话)产生了请求。
http://addons.mozilla.org/en-US/developers/docs/sdk/1.2/ Packages/api-utils/docs/observer-service.html 我正在监测“http-on-reponse”事件。 我有以下文字,以确认提出这项请求的孤儿院:
const observer = require("observer-service"),
{Ci} = require("chrome");
function getTabFromChannel(channel) {
try {
var noteCB= channel.notificationCallbacks ? channel.notificationCallbacks : channel.loadGroup.notificationCallbacks;
if (!noteCB) { return null; }
var domWin = noteCB.getInterface(Ci.nsIDOMWindow);
return domWin.top;
} catch (e) {
dump(e + "
");
return null;
}
}
function logHTTPTraffic(sub, data) {
sub.QueryInterface(Ci.nsIHttpChannel);
var ab = getTabFromChannel(sub);
console.log(tab);
}
observer.add("http-on-examine-response", logHTTPTraffic);
大部分来自。 还有一些摘自
Is there a recommended or preferred way to go from the nsIDOMWindow object I ve considered something hacky like scanning the tabs list for one with a URL that matches the URL for domWin, but then I have to worry about multiple tabs having the same URL.domWin
to a tab element in the SDK tabs module?