Closed Bug 595889 Opened 14 years ago Closed 14 years ago

Web Console does not report exceptions if multiple windows are opened

Categories

(DevTools :: General, defect)

defect
Not set
normal

Tracking

(blocking2.0 betaN+)

RESOLVED WORKSFORME
Tracking Status
blocking2.0 --- betaN+

People

(Reporter: Gavin, Assigned: msucan)

References

Details

Attachments

(1 file)

STR:
1) Load http://gavinsharp.com/tmp/test.html in a new profile (notice it fails to alert "2", since an exception is thrown)
2) Open Web Console
3) Reload the page
4) Notice exception reported
5) Open a new browser window (Cmd+N)
6) Repeat 1-3 in that window - no exception reported
7) Open new tab in original window, repeat 1-3 - no exception reported
(Is there an existing bug on 3) being necessary to see exceptions? Looking for exceptions after-the-fact is somewhat useful for cases where it may not be practical to reload...)
blocking2.0: --- → betaN+
Attached file testcase
Blocks: 529086
(In reply to comment #0)
> STR:
> 6) Repeat 1-3 in that window - no exception reported
> 7) Open new tab in original window, repeat 1-3 - no exception reported

The exception should be reported in the first console that was opened for that url.

This should be "fixed" by bug 567165 - and by fixed, I mean the error will be reported to both consoles, as we cannot reliably know which page threw.

This may also be fixed (for real) by tweaking our onerror handler, as we have seen similar issues like this.
I should say I have prepared some test pages and a test that tests this exact behavior, except not with a new window, but with a new tab.
(In reply to comment #1)
> (Is there an existing bug on 3) being necessary to see exceptions? Looking for
> exceptions after-the-fact is somewhat useful for cases where it may not be
> practical to reload...)

There ought to be. When users report problems the first thing I get them to do is check the Fx 3.x error console to see what problems (mostly javascript) have happened since they started the browser, possibly a few hours ago. In many cases they don't know/have forgotten exactly what they did to produce the error but at least it is captured along with the URL. If the new web console only collects errors while it's open, that closes off that whole way of debugging which is a problem.
...and equally, the fact the whenever a tab is closed, the web console along with the errors it was reporting is also closed is a problem. Bring back the single error console that lets you see cumulative errors from all windoes and tabs at any time - that was a much better facility.
You should file that bug, rather than commenting here.
(In reply to comment #7)
> You should file that bug, rather than commenting here.

Bug 598012
(In reply to comment #6)
> ...and equally, the fact the whenever a tab is closed, the web console along
> with the errors it was reporting is also closed is a problem. Bring back the
> single error console that lets you see cumulative errors from all windoes and
> tabs at any time - that was a much better facility.

You can open the JS Error Console - you just need to turn a pref on. devtools.errorconsole.enabled = true
David, there's a debate on this as we speak in Bug 598012
Blocks: devtools4b8
Assignee: nobody → ddahl
Status: NEW → ASSIGNED
Mihai has been working on patches that properly associate many kinds of messages with the proper windows now, so this problem should clear up with those patches.
Assignee: ddahl → mihai.sucan
This should be fixed once bug 597136 lands.
Bug 597136 landed. Retest results:

1. made my own TC which throws, but does not use an alert(). It works fine. I can have multiple tabs and windows - exceptions are always reported in the correct Web Console.

2. with the TC provided in this bug: the exception is never reported. This happens because Services.wm.getMostRecentWindow(null) returns null when the alert() is shown. Which means, windowUtils cannot be used, and getHUDIdsForScriptError() fails to find the window ID. Interesting to note that the fallback doesn't help either. It should.

So, now this bug morphed from a problem with exceptions thrown by the same page in multiple windows/tabs, into a bug about ... using windowUtils when alert() or when other such modal dialogs are shown - when getMostRecentWindow() returns null.
I'm thinking we should test for the window type and use the windowEnumerator to get the 2nd most recent window if the type is "dialog".
This TC is really nice. Further investigation shows that the exception onload is now not thrown, and it is not caught by the Web Console, nor by the Error Console, nor by Firebug. This is why it doesn't show now.

Still, I wonder why before bug 597136 landed the error was caught and I was able to see activeWindow being null?
The fun with online TCs: the TC from the URL provided changed slightly - the code after the alert(1) was // commented out. This is why during tests exceptions did not show. Uh oh.

Copied the TC locally, to test the correct TC and it works.

This bug can be marked as RESOLVED - I believe WFM would be fine.
OK, fair enough... reso/wfm it is!
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: