The equivalent of a window in chrome overlay is the "content" but it is XPCNativeWrapper wrapped which hide all the javascript methods of an Object. We need to unwrap the content first before we can get a console. So to get the console instance, you need this:
DEBUG=false;
// Wrap firebug console.log
function log() {
if (!DEBUG) return;
var console = content.wrappedJSObject.console;
if (console.firebug) {
console.log.apply(console, arguments);
}
}
Safely_accessing_content_DOM_from_chrome
没有评论:
发表评论