I just spoke with jst about trying to intercept an existing console object and preserve it if possible. If we create a setter and getter on the inner contentWindow called console, it will be triggered before (he thinks) our console is fully inited. Our init function should be able to check if there is console.log already in place. If so, we can return undefined from the init function and preserve the existing console. Before returning, we can then report an error to an already open WebConsole or open the WebConsole and report that there is a console api already in place.
Summary: WebConsole contentwindow setter and getter to allow interception of 3rd party consoles → WebConsole contentwindow setter and getter to allow preservation of 3rd party consoles
To differentiate between this and bug 583476, I'm setting the subject to note that this bug is about maintaining both our console object and a third party console object that gets defined so that logging could potentially go to both places. This would be nice to have but is not critical and is potentially fraught with peril.
Summary: WebConsole contentwindow setter and getter to allow preservation of 3rd party consoles → WebConsole contentwindow setter and getter to allow coexistence of console objects
seems like this should depend on the lazy-console.
Depends on: lazy-console
I have since talked to jst about this and this does depend on further polatform work that has not been initiated yet (pretty sure about that).
I *think* this can be done by defining and freezing the console (if "console" can't be used, perhaps an __underscore__ object name can? I believe underscores are reserved...) object so that it can be overwritten/changed. I'm still not 100% sure why the console object has to be exposed to content, why shouldn't it be privileged (like the error console and its associated methods)?
(In reply to comment #4) > I'm still not > 100% sure why the console object has to be exposed to content, why shouldn't it > be privileged (like the error console and its associated methods)? Are you talking about "privileged" as in chrome code? Content devs need to be able to call methods on this object from content JS.
The console object needs to be exposed to content because console.log and friends are becoming a de facto standard. Safari, Chrome, Firefox+Firebug and even, it seems, IE8+ have console.log and developers are started to expect it to be there.
Is this bug still relevant? I think this was filed before we put a solution in place to handle when Firebug's console was active.
This seems to be already fixed. Please reopen if I am mistaken. Thanks!
Status: NEW → RESOLVED
Closed: 8 years ago
Component: Developer Tools → Developer Tools: Console
QA Contact: developer.tools → developer.tools.console
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.