forked from mirrors/gecko-dev
		
	 a3004a21be
			
		
	
	
		a3004a21be
		
	
	
	
	
		
			
			- As closed tabs will change to mean closed tabs from all windows, rename these functions to make changes in later patches clearer when we mean closed tabs from this window specifically, or closed tabs for all private/non-private windows Differential Revision: https://phabricator.services.mozilla.com/D177849
		
			
				
	
	
		
			54 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| "use strict";
 | |
| 
 | |
| const URL = "data:text/html,<title>initial title</title>";
 | |
| 
 | |
| add_task(async function () {
 | |
|   // Create a new tab.
 | |
|   let tab = BrowserTestUtils.addTab(gBrowser, URL);
 | |
|   await promiseBrowserLoaded(tab.linkedBrowser);
 | |
| 
 | |
|   // Remove the tab.
 | |
|   await promiseRemoveTabAndSessionState(tab);
 | |
| 
 | |
|   // Check the title.
 | |
|   let [
 | |
|     {
 | |
|       state: { entries },
 | |
|     },
 | |
|   ] = ss.getClosedTabDataForWindow(window);
 | |
|   is(entries[0].title, "initial title", "correct title");
 | |
| });
 | |
| 
 | |
| add_task(async function () {
 | |
|   // Create a new tab.
 | |
|   let tab = BrowserTestUtils.addTab(gBrowser, URL);
 | |
|   let browser = tab.linkedBrowser;
 | |
|   await promiseBrowserLoaded(browser);
 | |
| 
 | |
|   // Flush to ensure we collected the initial title.
 | |
|   await TabStateFlusher.flush(browser);
 | |
| 
 | |
|   // Set a new title.
 | |
|   await SpecialPowers.spawn(browser, [], async function () {
 | |
|     return new Promise(resolve => {
 | |
|       docShell.chromeEventHandler.addEventListener(
 | |
|         "DOMTitleChanged",
 | |
|         () => resolve(),
 | |
|         { once: true }
 | |
|       );
 | |
| 
 | |
|       content.document.title = "new title";
 | |
|     });
 | |
|   });
 | |
| 
 | |
|   // Remove the tab.
 | |
|   await promiseRemoveTabAndSessionState(tab);
 | |
| 
 | |
|   // Check the title.
 | |
|   let [
 | |
|     {
 | |
|       state: { entries },
 | |
|     },
 | |
|   ] = ss.getClosedTabDataForWindow(window);
 | |
|   is(entries[0].title, "new title", "correct title");
 | |
| });
 |