搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

Open event is not triggered with popup window

more options

I am developing a Firefox add-on using Add-on SDK tool. I am doing something as soon as a tab is opened. I registered for all tab's event( open,ready,close).

   var tabs = require("sdk/tabs");
   tabs.on("open",openTab);
   tabs.on("ready",readyTab);
   tabs.on("close",closeTab);

And i have respective functions for each event Listener. Problem which i am facing is some of the webpages opened in a new window. For those web pages none of the event Listener is firing. Please help me out in this.

By debugging the following function at resource://gre/modules/commonjs/sdk/tabs/tabs-firefox.js

// Detect tabs in new windows windowObserver.on('open', domWindow => {

 if (!isBrowser(domWindow) || ignoreWindow(domWindow))
   return;
 let window = null;
 try {
   modelFor(domWindow);
 }
 catch (e) { }
 for (let tabElement of getTabs(domWindow)) {
   addWindowTab(window, tabElement);
 }

});


When I go to the page "http://www.yourhtmlsource.com/javascript/popupwindows.html", then go to the line "Try it here: » Pop it" and lick on "Pop it", a new popup window appeared, and I found that the function isBrowser(domWindow) always returns FALSE with the popup window.

Please help me the way to make addon SDK make isBrowser(domWindow) return TRUE.

I am developing a Firefox add-on using Add-on SDK tool. I am doing something as soon as a tab is opened. I registered for all tab's event( open,ready,close). var tabs = require("sdk/tabs"); tabs.on("open",openTab); tabs.on("ready",readyTab); tabs.on("close",closeTab); And i have respective functions for each event Listener. Problem which i am facing is some of the webpages opened in a new window. For those web pages none of the event Listener is firing. Please help me out in this. By debugging the following function at resource://gre/modules/commonjs/sdk/tabs/tabs-firefox.js // Detect tabs in new windows windowObserver.on('open', domWindow => { if (!isBrowser(domWindow) || ignoreWindow(domWindow)) return; let window = null; try { modelFor(domWindow); } catch (e) { } for (let tabElement of getTabs(domWindow)) { addWindowTab(window, tabElement); } }); When I go to the page "http://www.yourhtmlsource.com/javascript/popupwindows.html", then go to the line "Try it here: » Pop it" and lick on "Pop it", a new popup window appeared, and I found that the function isBrowser(domWindow) always returns FALSE with the popup window. Please help me the way to make addon SDK make isBrowser(domWindow) return TRUE.

所有回覆 (1)

more options

Add-on support is over here: https://discourse.mozilla-community.org/c/add-ons

Or you could search the Mozilla Developer Network form an answer. https://developer.mozilla.org/en-US/