Last Comment Bug 563337 - "Error: preview is undefined" and "this.preview is undefined" when closing the last tab with browser.tabs.closeWindowWithLastTab = false
: "Error: preview is undefined" and "this.preview is undefined" when closing th...
Status: RESOLVED FIXED
:
Product: Firefox
Classification: Client Software
Component: Tabbed Browser (show other bugs)
: Trunk
: All Windows 7
: -- normal with 6 votes (vote)
: Firefox 6
Assigned To: Dão Gottwald [:dao]
:
: Dão Gottwald [:dao]
Mentors:
: 584296 659079 (view as bug list)
Depends on:
Blocks: 474056
  Show dependency treegraph
 
Reported: 2010-05-03 07:15 PDT by Alice0775 White
Modified: 2015-05-25 02:46 PDT (History)
21 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
open the new tab before dispatching TabClose (1.63 KB, patch)
2010-06-04 13:23 PDT, Dão Gottwald [:dao]
gavin.sharp: review+
Details | Diff | Splinter Review

Description Alice0775 White 2010-05-03 07:15:46 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; WOW64; en-US; rv:1.9.3a5pre) Gecko/20100503 Minefield/3.7a5pre ID:20100503040502
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; WOW64; en-US; rv:1.9.3a5pre) Gecko/20100503 Minefield/3.7a5pre ID:20100503040502

Error: preview is undefined  and Error: this.preview is undefined when last tab is closed under condition of browser.tabs.closeWindowWithLastTab is false

Error: this.preview is undefined
Source File: file:///D:/firefox-3.7a1pre.en-US.win32/modules/WindowsPreviewPerTab.jsm
Line: 269
Error: preview is undefined
Source File: file:///D:/firefox-3.7a1pre.en-US.win32/modules/WindowsPreviewPerTab.jsm
Line: 352

Reproducible: Always

Steps to Reproduce:
1. Start Minefield with "NEW profile".
2. Set browser.tabs.closeWindowWithLastTab to false
3. Close tabs

Actual Results:
 Error: preview is undefined  and Error: this.preview is undefined when last tab is closed

Expected Results:
 No error
Comment 1 Rob Arnold [:robarnold] 2010-05-26 19:09:51 PDT
From what I can tell, the source of the problem is in tabbrowser.xml's _endRemoveTab - it adds a new tab at index 1 and then later fudges it to index 0. Unfortunately the index is stored by the newTab handler in WindowsPreviewPerTab.jsm at the time of creation (it's used an an index) so things just fall apart.

Dao, would it be possible to create the new tab at index 0 (it's final resting place)? I think this would fix the problem as the TabClose event for aTab has already been dispatched by this point.
Comment 2 Dão Gottwald [:dao] 2010-06-03 07:12:11 PDT
Investigating. Creating the tab with _tPos=0 would be possible, but it might confuse other users of that property, as there would be two tabs with that value.
Comment 3 Dão Gottwald [:dao] 2010-06-04 13:23:35 PDT
Created attachment 449330 [details] [diff] [review]
open the new tab before dispatching TabClose

the good news is that this doesn't regress bug 486280
Comment 4 Andreas Eibach 2010-07-21 03:44:03 PDT
This should maybe be tackled a bit soon-ish.

Current 4.0b2pre Minefield builds have the Error Console all cluttered up with those "preview is undefined" messages - still.
Comment 5 dfoulkes 2010-08-08 10:32:30 PDT
I'm not sure if this is the exact same bug but I didn't see this bug-report here until a couple of days ago... I created this one about a week ago.  If It's the same one then somebody may want to clean up my mistake :) and combine them??

https://bugzilla.mozilla.org/show_bug.cgi?id=584296

Note the link to the image of my Error Console.
Comment 6 War59312 2010-08-12 23:01:41 PDT
Another easy way to replicate is to install this add-on:

http://speeddial.uworks.net/

Running Firefox 3.6.8 on Win7 x64.
Comment 7 klonos 2010-11-21 06:11:24 PST
This still happens in Win7 in latest 4.0b8pre nightlies. x64 too, so changing platform to 'All'
Comment 8 klonos 2010-11-21 06:14:50 PST
*** Bug 584296 has been marked as a duplicate of this bug. ***
Comment 9 Alex 2010-12-04 06:34:22 PST
Confirm, this is very annoying
Error: preview is undefined
Source: resource://gre/modules/WindowsPreviewPerTab.jsm
Line: 380
some times impossible to check error's
Comment 10 Jay Rossiter 2010-12-22 04:12:47 PST
This error ends up being reported thousands of times per minute, and appears to be causing 10-15% CPU usage all by itself.

This really needs fixing.
Comment 11 Alex 2011-03-05 06:04:39 PST
in Firefox rc1-candidates buld1 bug still exist.
Comment 12 Andreas Eibach 2011-03-10 15:06:16 PST
ad comment #11
Confirmed.
Comment 13 Richard Deeming 2011-03-23 12:35:51 PDT
This bug *still* exists in the final release of 4.0:

Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0 ID:20110318052756
Comment 14 Alex 2011-04-17 22:15:35 PDT
More of that, bug still exist if firefox 5 and firefox 6
Comment 15 sansan_qq 2011-05-06 07:24:03 PDT
the same, bug still exist in firefox 4.0.1
Comment 16 Alex 2011-05-11 07:54:51 PDT
I would like to this fixed a bug as soon as possible, I'm tired of manually modify the same file with each update :)
Comment 17 :Gavin Sharp [email: gavin@gavinsharp.com] 2011-05-17 17:18:14 PDT
Comment on attachment 449330 [details] [diff] [review]
open the new tab before dispatching TabClose

We should probably add some tests that cover the ordering of TabSelect/TabOpen/TabClose events and the rest of the tabbrowser state when they're fired.

(this needs to be unbitrotten for tab opening animations, but that's trivial)
Comment 18 Dão Gottwald [:dao] 2011-05-18 23:29:29 PDT
http://hg.mozilla.org/mozilla-central/rev/fde29e9e42ac
Comment 19 Jay Rossiter 2011-05-18 23:32:40 PDT
Really?  This is SUCH a painfully large change (moving two lines and adding an else) that it has to skip a major release?  5.0 is barely alpha right now.
Comment 20 Ian Moody [:Kwan] 2011-05-19 03:43:03 PDT
Jay, Mozilla like to land changes to central first, in order to test them and make sure they don't cause any regressions or other bustages. 
Also your comment is rather rude, a better way to ask would have been 
"Hey, is this likely to get fixed for fx5 once it's been tested on trunk?  It's quite a small change and is a big improvement for users of the error console"
Comment 21 mcwerewolf 2011-05-19 07:14:25 PDT
Hey, is this likely to get fixed for Firefox 4.x or 5 once it's been tested on trunk?  It's quite a small change and is a big improvement for users of the error console. ;-)
Comment 22 Dão Gottwald [:dao] 2011-05-23 12:21:38 PDT
*** Bug 659079 has been marked as a duplicate of this bug. ***
Comment 23 Andreas Eibach 2011-05-23 15:30:57 PDT
(In reply to comment #20)
> Also your comment is rather rude, a better way to ask would have been 
> "Hey, is this likely to get fixed for fx5 once it's been tested on trunk? 

Rude? It's the naked truth. I couldn't have worded it better.
Comment 24 Alison 2011-11-18 08:09:56 PST
Hi all -- I have Firefox 8 and my error console is still getting constantly filled with "Error: preview is undefined Source File: resource:///modules/WindowsPreviewPerTab.jsm Line: 380" -- I absolutely don't mind opening a new but report, but I wanted to check with y'all here first, so I don't open a new thing just to have it marked as a duplicate.  Apologies if this isn't the right way to go about it (just let me know what I should do instead, if that's the case).

So, I'm on Windows 7, Firefox 8, and my error console is filled with the error (details copied/pasted in this comment) -- and if I "clear" the error list, go back to any Firefox window (other than the Error Console), and then look at the error console again -- even without doing *anything* other than switching windows -- the error list is already full of the error message all over again.

Is anyone else still having this issue / did the problem go away for folks after Firefox 6?

Thanks in advance for any help you can offer, and again, just let me know if I should post this as a new thing.
Comment 25 dfoulkes 2011-11-19 06:45:37 PST
(In reply to Alison from comment #24)
> Hi all -- I have Firefox 8 and my error console is still getting constantly
> filled with "Error: preview is undefined Source File:
> resource:///modules/WindowsPreviewPerTab.jsm Line: 380" -- I absolutely
> don't mind opening a new but report, but I wanted to check with y'all here
> first, so I don't open a new thing just to have it marked as a duplicate. 
> Apologies if this isn't the right way to go about it (just let me know what
> I should do instead, if that's the case).
> 
> So, I'm on Windows 7, Firefox 8, and my error console is filled with the
> error (details copied/pasted in this comment) -- and if I "clear" the error
> list, go back to any Firefox window (other than the Error Console), and then
> look at the error console again -- even without doing *anything* other than
> switching windows -- the error list is already full of the error message all
> over again.
> 
> Is anyone else still having this issue / did the problem go away for folks
> after Firefox 6?
> 
> Thanks in advance for any help you can offer, and again, just let me know if
> I should post this as a new thing.


Alison

This bug has not been active for some time.... in my Firefox (now version 8)...

As a test, you might want to create a new profile and do some browsing with it... then check you error console.
http://kb.mozillazine.org/Creating_a_new_Firefox_profile_on_Windows

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