Steps to reproduce: - View Selection Source (in the context menu when something isselected in the page). - Press F3. Notice that some text disappeared. You can also use Ctrl F and find some text. Press F3 many time. Each time "Reached end of page, continued from top" is displayed, some text will disappear. There are errors in the console. For example: Error: [Exception... "Index or size is negative or greater than the allowed amount" code: "1" nsresult: "0x80530001 (NS_ERROR_DOM_INDEX_SIZE_ERR)" location: "chrome://global/content/viewPartialSource.js Line: 259"] Source File: chrome://global/content/viewPartialSource.js Line: 259 Each time the problem appends, the function drawSelection is called. It should only be called once when the window is opened, after the content has loaded. Removing the eventlistener the first time drawSelection is called, or setting it directly on the browser tag can fix the visible problem, but that doesn't look like a good fix.
The regression range for this bug is 2006-03-07:04 - 2006-03-07:13. Checkins: http://bonsai.mozilla.org/cvsquery.cgi?module=PhoenixTinderbox&date=explicit&mindate=2006-03-07+03%3A00&maxdate=2006-03-07+14%3A00
It looks like this is a regression from bug 234455. It seems like the event listener added at http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/toolkit/components/viewsource/content/viewPartialSource.js&rev=1.13#199 (added to the vbox at http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/toolkit/components/viewsource/content/viewPartialSource.xul&rev=1.26#184 ) now fires multiple times when the findbar is opened (unhidden) for some reason. Is the expectation that it should fire only once wrong?
Why does http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/toolkit/components/viewsource/content/viewPartialSource.js&rev=1.13#199 add the listener to 'appcontent', not to 'content'. I guess the load event may occur now many times because the load event of image elements propagates from <findbar> somehow. (The event listener is added to listen 'capture' phase.) What is the target of the load events? document or image element? Or something else?
And btw, it is the right thing to do to propagate the load event.
Ah, OK, so that listener should just be fixed (I have no idea why it's on appcontent rather than content, it seems to have been added in bug 122524).
Created attachment 252264 [details] [diff] [review] move the listener from appcontent to content
Comment on attachment 252264 [details] [diff] [review] move the listener from appcontent to content r=me, thanks for the patch. The SeaMonkey folks might want this too, though they're not currently affected because they have no findbar widget here.
Landed on trunk: toolkit/components/viewsource/content/viewPartialSource.js 1.1