Skip to content

Instantly share code, notes, and snippets.

@paulrouget
Created January 21, 2013 11:46
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save paulrouget/4585528 to your computer and use it in GitHub Desktop.
bug 832920 reduced test case
let emptyXULWindowURL = 'data:text/xml;charset=utf-8,<?xml version="1.0"?><?xml-stylesheet href="chrome://global/skin/" type="text/css"?><window width="300" height="500" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">CONTENT</window>';
let innerSRC = '<style xmlns="http://www.w3.org/1999/xhtml">label {opacity: 0.2;transition:500ms}label:hover {opacity: 1;}</style><label>over me</label><button label="swap"/>';
let innerURL = encodeURI(emptyXULWindowURL.replace("CONTENT", innerSRC));
let host2SRC = '<label value="host2"/><iframe flex="1" src="about:blank"/>';
let host2URL = encodeURI(emptyXULWindowURL.replace("CONTENT", host2SRC));
let iframe1 = document.createElement("iframe");
iframe1.setAttribute("src", innerURL);
iframe1.setAttribute("flex", "1");
iframe1.addEventListener("load", function() {
let button = iframe1.contentDocument.querySelector("button");
button.onclick = function() {
let iframe2 = win2.document.querySelector("iframe");
iframe1.QueryInterface(Components.interfaces.nsIFrameLoaderOwner);
iframe1.swapFrameLoaders(iframe2);
}
}, true);
gBrowser.getNotificationBox().appendChild(iframe1);
let win2 = Services.ww.openWindow(null, host2URL, "_blank", "chrome,width=400,height=400", null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment