Jump to page content

Bug of the moment 2007-08-04

This entry goes back to May; I wasn’t going to post it until I checked back and found just how weird it really was. So here goes.

Firefox’s source viewer is something of a mixed bag. Firefox is one of those irritating browsers that shows you the source of the present content of a URL instead of the physical page that you are looking at. It has a curious feature called “View Selection Source” that turns out to be more useful for forcing it to show you – after a Select All – the entire source of the page open in the browser right now. Comes in rather handy.

It can also be useful for (surprisingly) viewing the source code of part of a page. The simplest way to do this would be to have it run View Source (a rapid operation) and then highlight the relevant code. Instead, View Selection Source creates a special pseudo-document containing simply the source code for the selection. Or, since that often turns out to be impossible due to the HTML structure (usually a selection that involves deeply nested tables), the source code going from the start of the selection to the end of the selection, with in-between and surrounding code not related to the selection. Or, half the page, for good measure.

The View Selection Source mechanism is not just conceptually flawed, but it can be painfully slow, too. If Firefox locks up solid, just wait a few minutes for it to figure out what set of HTML tags it needs to show you. (I swear it would be faster for it to View Source and point you at the first applicable line.)

You know you really need to worry when this appears:

Warning: Unresponsive script

I am not honestly sure why I keep seeing these “Unresponsive script” error messages originating from built-in features as I thought, perhaps mistakenly, that Firefox was in fact written in C, not JavaScript, but the browser may well all be written in JavaScript after all.

I took a peek at the stack to see what it was doing and, well, the stack had rather grown. Before long, it had come to this:

Firefox’s stack trace goes up to stack frame 666

Stack frame 666! Memory usage was steadily climbing, having swallowed up over 20 MB to try to show me some source code. The program seemed to be going nowhere fast:

The stack trace contained 1132 frames

It’s been a while now, and my memory is really hazy on this, but apparently I next tried killing two MSCVRT.DLL!endthreadex threads, and finally every other thread in the program. Oddly it did reset the stack trace of the Evil thread but it soon went back up to insane levels of nested function calls:

The stack trace now contained 1519 frames

But this is where it got weird. It had kept popping up “Warning: Unresponsive script” dialog boxes, but it turns out that none of them were going away – drag one and you get a Russian doll–like effect:

View full-size screenshot

It seems that I managed to whittle the collection of error dialogs down to about three, but it still kept opening new ones. I discovered something really odd, however. If you placed another window over the top of them, and then closed it, the dialog boxes would fail to draw in. Now, this is perfectly normal on lesser window managers, but, there is a twist: the title bars did not draw back in either:

Windows always draws back a window’s title bar regardless of whether the application is able to draw its client area in. Normal Firefox windows behave this way, so I would assume that the title bars are real and not more Mozilla simulacra. But what is up with the dialog boxes? You can get some crazy effects with this situation:

Another new one on me.

Posted 4th August 2007 – Comments and questions?