Hi Lithopsian,
Both javascript:poptastic(’/examples/poppedexample.html’); and javascript:populace(’…/examples/poppedexample2.html’) cannot work.
I have a debug and find out that there is a consistency with isBrowser(window) in _onTrack and _onUntrack functions of SDK add-on. With the same HTML popup window as the sample page, but the isBrowser(window) return false in the _onTrack function and it skips the rest functions, including open event trigger but when I close the popup window, _onUntrack function is called, and the isBrowser(window) return true.
Here are the code get from sdk addon:
/**
* Internal listener which is called whenever new window gets open.
* Creates wrapper and adds to this list.
* @param {nsIWindow} chromeWindow
*/
_onTrack: function _onTrack(chromeWindow) {
if (!isBrowser(chromeWindow)) return;
let window = BrowserWindow({ window: chromeWindow });
this._add(window);
this._emit(‘open’, window);
},
/**
* Internal listener which is called whenever window gets closed.
* Cleans up references and removes wrapper from this list.
* @param {nsIWindow} window
*/
_onUntrack: function _onUntrack(chromeWindow) {
if (!isBrowser(chromeWindow)) return;
let window = BrowserWindow({ window: chromeWindow });
this._remove(window);
this._emit('close', window);
// Bug 724404: do not leak this module and linked windows:
// We have to do it on untrack and not only when `_onUnload` is called
// when windows are closed, otherwise, we will leak on addon disabling.
window.destroy();
}
function isBrowser(window) {
try {
return window.document.documentElement.getAttribute("windowtype") === BROWSER; // BROWSER: "navigator:browser"
}
catch (e) {}
return false;
};
Following is the value of innerHTML and outerHTML in window.document.documentElement of _onTrack and _onUntrack respectively
_onTrack:
innerHTML:"
Popped Example | example
@import "/bubbleicious.css";
<style type="text/css">
<!--
body {margin: 3em; background-image: none; background-color: white; font-size: .8em; text-align: left; }
-->
</style>
Pop ya Collar
Hey great, it worked.
Now, window begone.
"
outerHTML:"
Popped Example | example
@import "/bubbleicious.css";
<style type="text/css">
<!--
body {margin: 3em; background-image: none; background-color: white; font-size: .8em; text-align: left; }
-->
</style>
Pop ya Collar
Hey great, it worked.
Now, window begone.
"
_onUntrack:
innerHTML:"<script xmlns=“http://www.mozilla.org/keyma”
outerHTML:"<script type=“application/javascript” src=“chro”