Skip to content

Instantly share code, notes, and snippets.

@Gozala
Last active July 29, 2019 07:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Gozala/7883551 to your computer and use it in GitHub Desktop.
Save Gozala/7883551 to your computer and use it in GitHub Desktop.
nesting frames
// Security Error: Content at about:srcdoc may not load or link to resource://jid1-pss5nuwzdn1n3a-at-jetpack/signals/data/index.html.
let XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let HTML_NS = "http://www.w3.org/1999/xhtml";
let toolbar = document.createElementNS(XUL_NS, "toolbar");
toolbar.setAttribute("collapsed", false);
toolbar.setAttribute("style", "height: 80px;");
let toolbox = document.getElementById("navigator-toolbox");
toolbox.appendChild(toolbar);
let iframe = document.createElementNS(HTML_NS, "iframe");
iframe.setAttribute("srcdoc", "<iframe src='resource:///chrome/browser/content/browser/aboutRobots.xhtml'/>");
// type isn't recognized by HTML iframes so we set a sandbox instead.
// iframe.setAttribute("type", "content");
iframe.setAttribute("sandbox", "allow-scripts");
iframe.setAttribute("mozbrowser", "");
// transparen isn't recognized by HTML iframes so we set seamless instead.
// iframe.setAttribute("transparent", true);
iframe.setAttribute("seamless", "");
toolbar.appendChild(iframe);
// Doesn't work:
// Security Error: Content at moz-nullprincipal:{9df928d4-a39a-9743-a48a-270066d14810}
// may not load or link to resource:///chrome/browser/content/browser/aboutRobots.xhtml.
let XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let HTML_NS = "http://www.w3.org/1999/xhtml";
let toolbar = document.createElementNS(XUL_NS, "toolbar");
toolbar.setAttribute("collapsed", false);
toolbar.setAttribute("style", "height: 80px;");
let toolbox = document.getElementById("navigator-toolbox");
toolbox.appendChild(toolbar);
let iframe = document.createElementNS(HTML_NS, "iframe");
iframe.setAttribute("srcdoc", "<iframe src='resource:///chrome/browser/content/browser/aboutRobots.xhtml'/>");
//iframe.setAttribute("src", "resource:///chrome/browser/content/browser/aboutRobots.xhtml")
// type isn't recognized by HTML iframes so we set a sandbox instead.
// iframe.setAttribute("type", "content");
//iframe.setAttribute("sandbox", "allow-scripts ");
iframe.setAttribute("mozbrowser", "");
//iframe.setAttribute("mozframetype", "content")
// transparen isn't recognized by HTML iframes so we set seamless instead.
// iframe.setAttribute("transparent", true);
iframe.setAttribute("seamless", "");
toolbar.appendChild(iframe);
iframe.contentWindow
let XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let HTML_NS = "http://www.w3.org/1999/xhtml";
let toolbar = document.createElementNS(XUL_NS, "toolbar");
toolbar.setAttribute("collapsed", false);
toolbar.setAttribute("style", "height: 80px;");
let toolbox = document.getElementById("navigator-toolbox");
toolbox.appendChild(toolbar);
let iframe = document.createElementNS(HTML_NS, "iframe");
// iframe.setAttribute("srcdoc", "<iframe src='resource:///chrome/browser/content/browser/aboutRobots.xhtml'/>");
iframe.setAttribute("src", "resource:///chrome/browser/content/browser/aboutRobots.xhtml")
// type isn't recognized by HTML iframes so we set a sandbox instead.
// iframe.setAttribute("type", "content");
iframe.setAttribute("sandbox", "allow-scripts");
iframe.setAttribute("mozbrowser", "");
// transparen isn't recognized by HTML iframes so we set seamless instead.
// iframe.setAttribute("transparent", true);
iframe.setAttribute("seamless", "");
toolbar.appendChild(iframe);
// Works but we no longer have intended nesting.
// Security Error: Content at about:srcdoc may not load or link to resource://jid1-pss5nuwzdn1n3a-at-jetpack/signals/data/index.html.
let XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let HTML_NS = "http://www.w3.org/1999/xhtml";
let toolbar = document.createElementNS(XUL_NS, "toolbar");
toolbar.setAttribute("collapsed", false);
toolbar.setAttribute("style", "height: 80px;");
let toolbox = document.getElementById("navigator-toolbox");
toolbox.appendChild(toolbar);
let iframe = document.createElementNS(XUL_NS, "iframe");
iframe.setAttribute("srcdoc", "<iframe src='resource:///chrome/browser/content/browser/aboutRobots.xhtml'/>");
iframe.setAttribute("type", "content");
iframe.setAttribute("transparent", true);
iframe.setAttribute("style", "border: 1px solid red");
toolbar.appendChild(iframe);
// Not going to work because xul iframe does not supports content type iframes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment