I am trying to force XULRunner to ignore X-Frame-Options and bypass the security warning preventing the page from loading inside an iframe.
This is what I have come up with but it doesn't work.
function myObserverXFrame()
{
this.register();
}
myObserverXFrame.prototype =
{
observe: function(aSubject, aTopic, aData)
{
var channel = aSubject.QueryInterface(Components.interfaces.nsIHttpChannel);
//console.log("observing");
try
{ // getResponseHeader will throw if the header isn't set
hasXFO = channel.getResponseHeader('X-Frame-Options');
if (hasXFO)
{
// Header found, disable it
channel.setResponseHeader('X-Frame-Options', '', false);
}
}
catch (e) {}
}
},
register: function()
{
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
observerService.addObserver(this, "http-on-examine-response", false);
observerService.addObserver(this, "http-on-examine-cached-response", false);
},
unregister: function()
{
}
}
var observer = new CommandLineObserver();
//addEventListener("unload", observer.unregister, false);
Thanks.