这里是 Firefox 扩展开发的菜鸟。有没有办法从给定的 nsIDOMWindow 中找到 Tab 对象?
let wm = Cc['@mozilla.org/appshell/window-mediator;1'].getService(Ci.nsIWindowMediator);
var windowListener =
{
onOpenWindow: function(aWindow)
{
// Wait for the window to finish loading
let domWindow = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
domWindow.addEventListener("load", function()
{
domWindow.removeEventListener("load", arguments.callee, false);
if (domWindow.document.documentElement.getAttribute("windowtype") == "navigator:browser")
{
// how do I find tabs?
}
}, false);
},
}
wm.addListener(windowListener);
一直试图在 MDN 上找到文档但没有运气,mozilla #extdev 频道也没有给我任何回应:(