Closed Bug 616742 Opened 14 years ago Closed 13 years ago

Implement console.debug() (was: Navigation broken on Citytv website)

Categories

(DevTools :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(blocking2.0 -)

VERIFIED FIXED
Firefox 5
Tracking Status
blocking2.0 --- -

People

(Reporter: fehe, Assigned: rcampbell)

References

()

Details

(Keywords: dev-doc-complete, regression, Whiteboard: [console-3][has-review])

Attachments

(1 file)

On the citytv.com/vancouver website, there 6 rectangular blocks representing 6 different shows.  Normally, hovering them changes the banner to one corresponding to the block hovered (along with an arrow pointing to the banner).  The block should also be clickable.

Since the Nov 17 nightly, this no longer works.  The site works properly in both Google Chrome and IE 8.

With the Nov 17 nightly, the following also appears in Error Console:

Error: Permission denied to access property 'debug'
Source File: http://tv.citytv.com/scripts/com.rogers.TVSchedule.CityScheduleWidget.js
Line: 194

With recent nightlies, the Error Console message is instead:

Error: console.debug is undefined
Source File: http://tv.citytv.com/scripts/com.rogers.TVSchedule.CityScheduleWidget.js
Line: 194

Regression pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=a42e9b001bc8&tochange=ad227939db82

I therefore suspect this to be a fallout of bug 587734.
Blocks: 587734
blocking2.0: --- → ?
Keywords: regression
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
bug 614350 did not fix this.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
You're still getting the same error? I don't see how that could possibly be happening...
Yes.  Comment 0 still reproducible -- even with the Dec 11 nightly.
confirmed ([expletive deleted]!).

The line in question is doing an apply like so:

/**
 * Firebug based console logging
 */
com.rogers.TVSchedule.CityScheduleWidget.prototype.log = function()
{
	if (this.config.debug && window.console)
		console.debug.apply(console, arguments);
};

I can reproduce this in the JSTerm of our console by doing something like:

console.debug.apply(console, ["hi"])

and get

TypeError: console.debug is undefined

I wonder if this is a bug in __noSuchMethod__ ?
Depends on: 618702
console.debug isn't being called in that case, so not a bug in __noSuchMethod__. We can't really fix that kind of bustage without actually replicating firebug's console entirely, which I don't think we want to do. Tech Evangelism might be the best way forward here... hopefully this isn't reflective of a widespread pattern.
ah, ok. Read a little more about __noSuchMethod__ and that seems to be the case.

Looks like we're either back to implementing the known Console API methods individually (as stubs or fully) to make problems like this one go away.
Not going to hold the release on websites leaving debugging code laying around, blocking-.
blocking2.0: ? → -
I think that's fair.

I may have a solution with a Proxy-based catch-all, but need a bit more experimentation. Will post a patch when ready.
I'm not convinced this is a devtools bug.
Whiteboard: [console-3]
Keywords: regression
(In reply to comment #10)
> I'm not convinced this is a devtools bug.

Why not? If I make a local copy of the affected content and edit http://tv.citytv.com/scripts/com.rogers.TVSchedule.CityScheduleWidget.js, changing the following line:
    debug: true

to:
    debug: false

then everything works.

Every other major browser renders that page without issue.  Only Firefox 4 has problems.
Keywords: regression
(In reply to comment #11)
> (In reply to comment #10)
> > I'm not convinced this is a devtools bug.
> 
> Why not? If I make a local copy of the affected content and edit
> http://tv.citytv.com/scripts/com.rogers.TVSchedule.CityScheduleWidget.js,
> changing the following line:
>     debug: true
> 
> to:
>     debug: false
> 
> then everything works.
> 
> Every other major browser renders that page without issue.  Only Firefox 4 has
> problems.

And you think it's OK for CityTV to ship a production version of their website with debugging turned on?

If you click on "shows" the widget works fine there. Looks like they forgot to disable debugging on their main page. They're also not detecting that there's a console.debug object for them to apply with. In short, there's a lot broken on that webpage and they should fix it.

All that said, I'm going to convert this bug to Implement console.debug and that should make the bug go away when it lands.
Blocks: 644596
Summary: Navigation broken on Citytv website → Implement console.debug() (was: Navigation broken on Citytv website)
most basic debug support imaginable. The function itself is pretty weakly defined, basically behaves as log().

"console.debug(object[, object, ...])

Writes a message to the console, including a hyperlink to the line where it was called. "

from http://getfirebug.com/wiki/index.php/Console_API
Assignee: nobody → rcampbell
Status: REOPENED → ASSIGNED
Attachment #522467 - Flags: review?(ddahl)
(In reply to comment #13)

> Writes a message to the console, including a hyperlink to the line where it was
> called. "

Are you adding the hyperlink bit in a followup bug? Also , 2 more things that would make this awesome would be another color for debug messages and a filter menu button - all of which should maybe come in a fx 6  patch?
Comment on attachment 522467 [details] [diff] [review]
[checked-in] console.debug

If we are just mirroring log, this is fine. this should cut down the bug reports as I imagine debug() is the next heavily used api after what we have so far.
Attachment #522467 - Flags: review?(ddahl) → review+
(In reply to comment #14)
> (In reply to comment #13)
> 
> > Writes a message to the console, including a hyperlink to the line where it was
> > called. "
> 
> Are you adding the hyperlink bit in a followup bug? Also , 2 more things that
> would make this awesome would be another color for debug messages and a filter
> menu button - all of which should maybe come in a fx 6  patch?

added bug 646025 to handle the file location.

Not sure we need another color to distinguish debug from log. They appear to be synonymous with each other. I will add a filter option bug as well.

Thanks for the review!
Comment on attachment 522467 [details] [diff] [review]
[checked-in] console.debug

review request for consoleAPI bits for sicking.
Attachment #522467 - Flags: review?(jonas)
Blocks: 646028
added bug 646028 to add the filter button.
Attachment #522467 - Flags: review?(gal)
Andreas, was just looking at bug 634156 and thought I'd try to sneak a quick review through before you made that change. We'd like to add "debug" to this list of functions.
Comment on attachment 522467 [details] [diff] [review]
[checked-in] console.debug

>diff --git a/dom/base/ConsoleAPI.js b/dom/base/ConsoleAPI.js
>+      debug: function CA_debug() {
>+        self.notifyObservers(id, "log", arguments);
>+      },

If you're passing "log" here...

>diff --git a/toolkit/components/console/hudservice/HUDService.jsm b/toolkit/components/console/hudservice/HUDService.jsm
>@@ -139,16 +139,17 @@ const SEVERITY_INFO = 2;
> const SEVERITY_LOG = 3;
> 
> // A mapping from the console API log event levels to the Web Console
> // severities.
> const LEVELS = {
>   error: SEVERITY_ERROR,
>   warn: SEVERITY_WARNING,
>   info: SEVERITY_INFO,
>+  debug: SEVERITY_LOG,
>   log: SEVERITY_LOG,
> };

...then you don't need to add "debug" here, right? So either use "debug" above, or don't add "debug" to LEVELS.

r=me with that fixed.
Attachment #522467 - Flags: review?(jonas) → review+
true enough. Thanks for the review!
Comment on attachment 522467 [details] [diff] [review]
[checked-in] console.debug

checked into devtools:
http://hg.mozilla.org/projects/devtools/rev/3bbc2fd96c48
Attachment #522467 - Attachment description: console.debug → [in-devtools] console.debug
Attachment #522467 - Flags: review?(gal)
Whiteboard: [console-3] → [console-3][has-review][in-devtools][merge-m-c]
checked in a followup fix for the dom level test.

http://hg.mozilla.org/projects/devtools/rev/bc1ba93ee006
Location of the call is easy to track down from Components.stack. See the code from bug 585956.
yep. Followup... bug 646025.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago13 years ago
Resolution: --- → FIXED
Whiteboard: [console-3][has-review][in-devtools][merge-m-c] → [console-3][has-review]
Comment on attachment 522467 [details] [diff] [review]
[checked-in] console.debug

http://hg.mozilla.org/mozilla-central/rev/3bbc2fd96c48
Attachment #522467 - Attachment description: [in-devtools] console.debug → [checked-in] console.debug
Thank you for providing a resolution for this.

Verified with http://hg.mozilla.org/mozilla-central/rev/a174b86200d6

Mozilla/5.0 (Windows NT 5.1; rv:2.2a1pre) Gecko/20110412 Firefox/4.2a1pre
Status: RESOLVED → VERIFIED
Target Milestone: --- → Firefox 5
(In reply to comment #28)
> Thank you for providing a resolution for this.
> 
> Verified with http://hg.mozilla.org/mozilla-central/rev/a174b86200d6
> 
> Mozilla/5.0 (Windows NT 5.1; rv:2.2a1pre) Gecko/20110412 Firefox/4.2a1pre

You're welcome! Thanks for sticking with it. :)
doc folks: this page should mention console.debug (which is a synonym for console.log):

https://developer.mozilla.org/en/Using_the_Web_Console#The_console_object

and it may make sense to mention the addition here as well:

https://developer.mozilla.org/en/Firefox_5_for_developers#DOM
Keywords: dev-doc-needed
The documentation referenced in comment #30 has been updated.
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: