forked from mirrors/gecko-dev
		
	 94e3b0bd8d
			
		
	
	
		94e3b0bd8d
		
	
	
	
	
		
			
			This is generally pretty straightforward, and rewrites nearly all calls. It skips the ones that it can detect using frame script globals like `sendAsyncMessage`, though. Differential Revision: https://phabricator.services.mozilla.com/D53740 --HG-- extra : moz-landing-system : lando
		
			
				
	
	
		
			62 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /* Any copyright is dedicated to the Public Domain.
 | |
|    http://creativecommons.org/publicdomain/zero/1.0/ */
 | |
| 
 | |
| // Test for bug 673467.  In a new tab, load a page which inserts a new iframe
 | |
| // before the load and then sets its location during the load.  This should
 | |
| // create just one SHEntry.
 | |
| 
 | |
| var doc =
 | |
|   "data:text/html,<html><body onload='load()'>" +
 | |
|   "<script>" +
 | |
|   "  var iframe = document.createElement('iframe');" +
 | |
|   "  iframe.id = 'iframe';" +
 | |
|   "  document.documentElement.appendChild(iframe);" +
 | |
|   "  function load() {" +
 | |
|   "    iframe.src = 'data:text/html,Hello!';" +
 | |
|   "  }" +
 | |
|   "</script>" +
 | |
|   "</body></html>";
 | |
| 
 | |
| function test() {
 | |
|   waitForExplicitFinish();
 | |
| 
 | |
|   let taskFinished;
 | |
| 
 | |
|   let tab = BrowserTestUtils.addTab(gBrowser, doc, {}, tab => {
 | |
|     taskFinished = SpecialPowers.spawn(tab.linkedBrowser, [], () => {
 | |
|       return new Promise(resolve => {
 | |
|         docShell.chromeEventHandler.addEventListener(
 | |
|           "load",
 | |
|           function() {
 | |
|             // The main page has loaded.  Now wait for the iframe to load.
 | |
|             let iframe = content.document.getElementById("iframe");
 | |
|             iframe.addEventListener(
 | |
|               "load",
 | |
|               function listener(aEvent) {
 | |
|                 // Wait for the iframe to load the new document, not about:blank.
 | |
|                 if (!iframe.src) {
 | |
|                   return;
 | |
|                 }
 | |
| 
 | |
|                 iframe.removeEventListener("load", listener, true);
 | |
|                 let shistory = content.docShell.QueryInterface(
 | |
|                   Ci.nsIWebNavigation
 | |
|                 ).sessionHistory;
 | |
| 
 | |
|                 Assert.equal(shistory.count, 1, "shistory count should be 1.");
 | |
|                 resolve();
 | |
|               },
 | |
|               true
 | |
|             );
 | |
|           },
 | |
|           true
 | |
|         );
 | |
|       });
 | |
|     });
 | |
|   });
 | |
| 
 | |
|   taskFinished.then(() => {
 | |
|     gBrowser.removeTab(tab);
 | |
|     finish();
 | |
|   });
 | |
| }
 |