Open Bug 1260287 Opened 8 years ago Updated 2 years ago

Display a warning message when console.log (&info, error, etc) are overridden

Categories

(DevTools :: Console, enhancement, P3)

enhancement

Tracking

(firefox48 affected)

Tracking Status
firefox48 --- affected

People

(Reporter: jdescottes, Unassigned)

References

Details

> window.console = myCustomConsoleObject;

If a page overrides the console object, the devtools webconsole displays a warning message : "The Web Console logging API (console.log, console.info, console.warn, console.error) has been disabled by a script on this page".

> window.console.log = function() {};

If a page only overrides the log/info/warn/error methods, no message is displayed. A similar message should also be displayed in this case. (real life example of this: twitter.com disables logging by overriding each method of the Console object)

Sidenote: the message is a bit misleading. We don't actually check if the logging has been disabled, but only that it has been modified. Maybe we should log "The Web Console logging API (console.log, console.info, console.warn, console.error) has been modified by a script on this page. It might be disabled or behave unexpectedly."
Has Regression Range: --- → irrelevant
Has STR: --- → irrelevant
Relevant code for the console object overriding detection (hasNativeConsoleAPI): https://dxr.mozilla.org/mozilla-central/source/devtools/server/actors/webconsole.js#321
Priority: -- → P3
See Also: → 1280317
Product: Firefox → DevTools
Type: defect → enhancement
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.