browser_354894.js File Reference

Go to the source code of this file.

Functions

function test ()
 

Function Documentation

function test ( )

Checks that restoring the last browser window in session is actually working: 1.1) Open a new browser window 1.2) Add some tabs 1.3) Close that window 1.4) Opening another window –> State is restored

2.1) Open a new browser window 2.2) Add some tabs 2.3) Enter private browsing mode 2.4) Close the window while still in private browsing mode 2.5) Opening a new window –> State is not restored, because private browsing mode is still active 2.6) Leaving private browsing mode 2.7) Open another window –> State (that was before entering PBM) is restored

3.1) Open a new browser window 3.2) Add some tabs 3.4) Open some popups 3.5) Add another tab to one popup (so that it gets stored) and close it again 3.5) Close the browser window 3.6) Open another browser window –> State of the closed browser window, but not of the popup, is restored

4.1) Open a popup 4.2) Add another tab to the popup (so that it gets stored) and close it again 4.3) Open a window –> Nothing at all should be restored

5.1) Open two browser windows and close them again 5.2) undoCloseWindow() one 5.3) Open another browser window –> Nothing at all should be restored

Checks the new notifications are correctly posted and processed, that is for each successful -requested a -granted is received, but omitted if -requested was cnceled Said notifications are:

  • browser-lastwindow-close-requested
  • browser-lastwindow-close-granted Tests are: 6) Cancel closing when first observe a -requested –> Window is kept open 7) Count the number of notifications –> count(-requested) == count(-granted) + 1 –> (The first -requested was canceled, so off-by-one) 8) (Mac only) Mac version of Test 5 additionally preparing Test 6
See Also
https://bugzilla.mozilla.org/show_bug.cgi?id=354894
Note
It is implicitly tested that restoring the last window works when non-browser windows are around. The "Run Tests" window as well as the main browser window (wherein the test code gets executed) won't be considered browser windows. To achiveve this said main browser window has it's windowtype attribute modified so that it's not considered a browser window any longer. This is crucial, because otherwise there would be two browser windows around, said main test window and the one opened by the tests, and hence the new logic wouldn't be executed at all.
Mac only tests the new notifications, as restoring the last window is not enabled on that platform (platform shim; the application is kept running although there are no windows left)
There is a difference when closing a browser window with BrowserTryToCloseWindow() as opposed to close(). The former will make nsSessionStore restore a window next time it gets a chance and will post notifications. The latter won't.

Helper: Will observe and handle the notifications for us

Helper: Sets prefs as the testsuite requires

Note
Will be reset in cleanTestSuite just before finishing the tests

Helper: Sets up this testsuite

Helper: Cleans up behind the testsuite

Helper: sets the prefs and a new window with our test tabs

Test 1: Normal in-session restore

Note
: Non-Mac only

Test 2: PrivateBrowsing in-session restore

Note
: Non-Mac only

Test 3: Open some popup windows to check those aren't restored, but the browser window is

Note
: Non-Mac only

Test 4: Open some popup window to check it isn't restored. Instead nothing at all should be restored

Note
: Non-Mac only

Test 5: Open some windows and do undoCloseWindow. This should prevent any restoring later in the test

Note
: Non-Mac only

Test 7: Check whether the right number of notifications was received during the tests

Test 8: Test if closing can be denied on Mac Futhermore prepares the testNotificationCount test (Test 6)

Note
: Mac only

Definition at line 107 of file browser_354894.js.

Here is the call graph for this function: