Last Comment Bug 616742 - Implement console.debug() (was: Navigation broken on Citytv website)
: Implement console.debug() (was: Navigation broken on Citytv website)
Status: VERIFIED FIXED
[console-3][has-review]
: dev-doc-complete, regression
Product: Firefox
Classification: Client Software
Component: Developer Tools (show other bugs)
: Trunk
: x86 Windows XP
: -- normal (vote)
: Firefox 5
Assigned To: Rob Campbell [:rc] (:robcee)
:
Mentors:
http://www.citytv.com/vancouver
Depends on: 618702
Blocks: 587734 644596 646028
  Show dependency treegraph
 
Reported: 2010-12-04 15:26 PST by IU
Modified: 2011-04-14 12:31 PDT (History)
7 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
-


Attachments
[checked-in] console.debug (3.11 KB, patch)
2011-03-28 13:59 PDT, Rob Campbell [:rc] (:robcee)
bugzilla: review+
jonas: review+
Details | Diff | Splinter Review

Description IU 2010-12-04 15:26:40 PST
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.
Comment 1 David Dahl :ddahl 2010-12-04 21:00:50 PST

*** This bug has been marked as a duplicate of bug 614350 ***
Comment 2 IU 2010-12-10 19:12:02 PST
bug 614350 did not fix this.
Comment 3 :Gavin Sharp [email: gavin@gavinsharp.com] 2010-12-11 03:36:56 PST
You're still getting the same error? I don't see how that could possibly be happening...
Comment 4 IU 2010-12-11 08:26:03 PST
Yes.  Comment 0 still reproducible -- even with the Dec 11 nightly.
Comment 5 Rob Campbell [:rc] (:robcee) 2010-12-12 09:13:44 PST
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__ ?
Comment 6 :Gavin Sharp [email: gavin@gavinsharp.com] 2010-12-12 09:34:14 PST
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.
Comment 7 Rob Campbell [:rc] (:robcee) 2010-12-12 11:39:40 PST
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.
Comment 8 Dietrich Ayala (:dietrich) 2010-12-13 19:32:55 PST
Not going to hold the release on websites leaving debugging code laying around, blocking-.
Comment 9 Rob Campbell [:rc] (:robcee) 2010-12-13 21:43:15 PST
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.
Comment 10 David Dahl :ddahl 2011-03-15 11:28:59 PDT
I'm not convinced this is a devtools bug.
Comment 11 IU 2011-03-27 08:14:02 PDT
(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.
Comment 12 Rob Campbell [:rc] (:robcee) 2011-03-28 13:01:42 PDT
(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.
Comment 13 Rob Campbell [:rc] (:robcee) 2011-03-28 13:59:56 PDT
Created attachment 522467 [details] [diff] [review]
[checked-in] console.debug

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
Comment 14 David Dahl :ddahl 2011-03-28 15:34:06 PDT
(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 15 David Dahl :ddahl 2011-03-28 15:35:33 PDT
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.
Comment 16 Rob Campbell [:rc] (:robcee) 2011-03-29 05:48:39 PDT
(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 17 Rob Campbell [:rc] (:robcee) 2011-03-29 05:49:41 PDT
Comment on attachment 522467 [details] [diff] [review]
[checked-in] console.debug

review request for consoleAPI bits for sicking.
Comment 18 Rob Campbell [:rc] (:robcee) 2011-03-29 05:51:51 PDT
added bug 646028 to add the filter button.
Comment 19 Rob Campbell [:rc] (:robcee) 2011-03-29 10:52:57 PDT
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 20 Jonas Sicking (:sicking) No longer reading bugmail consistently 2011-04-07 17:08:54 PDT
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.
Comment 21 Rob Campbell [:rc] (:robcee) 2011-04-08 13:36:15 PDT
true enough. Thanks for the review!
Comment 22 Rob Campbell [:rc] (:robcee) 2011-04-08 14:24:34 PDT
Comment on attachment 522467 [details] [diff] [review]
[checked-in] console.debug

checked into devtools:
http://hg.mozilla.org/projects/devtools/rev/3bbc2fd96c48
Comment 23 Rob Campbell [:rc] (:robcee) 2011-04-08 21:39:22 PDT
checked in a followup fix for the dom level test.

http://hg.mozilla.org/projects/devtools/rev/bc1ba93ee006
Comment 24 Mihai Sucan [:msucan] 2011-04-09 03:33:20 PDT
Location of the call is easy to track down from Components.stack. See the code from bug 585956.
Comment 25 Rob Campbell [:rc] (:robcee) 2011-04-10 07:59:49 PDT
yep. Followup... bug 646025.
Comment 26 Rob Campbell [:rc] (:robcee) 2011-04-11 06:28:20 PDT
Comment on attachment 522467 [details] [diff] [review]
[checked-in] console.debug

http://hg.mozilla.org/mozilla-central/rev/3bbc2fd96c48
Comment 27 Rob Campbell [:rc] (:robcee) 2011-04-11 06:28:59 PDT
also, http://hg.mozilla.org/mozilla-central/rev/bc1ba93ee006 for test fix
Comment 28 IU 2011-04-12 17:55:35 PDT
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
Comment 29 Rob Campbell [:rc] (:robcee) 2011-04-13 07:54:59 PDT
(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. :)
Comment 30 Kevin Dangoor 2011-04-14 11:44:08 PDT
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
Comment 31 Eric Shepherd [:sheppy] 2011-04-14 12:31:10 PDT
The documentation referenced in comment #30 has been updated.

Note You need to log in before you can comment on or make changes to this bug.