Opened 10 years ago
Closed 8 years ago
#12059 closed defect (wontfix)
firebug.js: replacements for console logging functions break if defined more than once
Reported by: | steve.pemberton | Owned by: | Mike Wilcox |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | Core | Version: | 1.4.3 |
Keywords: | Cc: | [email protected]… | |
Blocked By: | Blocking: |
Description
firebug.js contains its own versions of the various console logging functions (log, info, debug, warn and error) for use in Internet Explorer. These begin on line 76 in my copy of this file, with the statement:
var isNewIE = (/Trident/.test(window.navigator.userAgent));
If a page includes firebug.js more than once (that is, redefining the logging functions more than once, not using them more than once), they break, causing the Javascript stack to overflow when the page attempts to write something to the console.
For each function, firebug.js saves the original definition by renaming it to have an underscore in front, and then redefines the function to call the original, but with the arguments separated by spaces. According to the comments, this is because if you call console.log("A", "B", "C") in Internet Explorer, it prints "ABC", whereas we want "A B C".
If your page calls firebug.js more than once, it will overwrite its backup of the original functions, so that console._log is no longer the real function, but just points to the previous redefinition of console.log. This causes unlimited recursion, which the browser stops when it runs out of stack space.
A suitable fix would be to check whether the backup of the function already exists, and only assign it if it doesn't.
This could be considered to be operator error, because you shouldn't call code twice if it's only meant to be called once... but it shouldn't break so badly if you do call it twice.
As for why I don't just take out the second include of firebug.js... it happens inside a large framework that I have no control over, and the people who maintain the framework seem to think it's a Dojo bug.
I've recorded this bug as affecting 1.4.3, since that's what we're using, but I assume it affects 1.5 as well, since firebug.js is identical in the two versions.
I have attached a small file that should reproduce the problem.
Attachments (1)
Change History (4)
Changed 10 years ago by
Attachment: | index.html added |
---|
comment:1 Changed 10 years ago by
Owner: | anonymous deleted |
---|
comment:2 Changed 9 years ago by
Component: | General → Core |
---|---|
Owner: | set to Mike Wilcox |
Status: | new → assigned |
comment:3 Changed 8 years ago by
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
If anything, steps should be made to remove this module or make it opt-in only.
Test case to break console logging functions