forked from mirrors/gecko-dev
		
	 6798f02654
			
		
	
	
		6798f02654
		
	
	
	
	
		
			
			MozReview-Commit-ID: 6EQfBM09xUE --HG-- rename : dom/contacts/tests/test_contacts_cache.xul => dom/contacts/tests/test_contacts_a_cache.xul rename : dom/contacts/tests/test_contacts_shutdown.xul => dom/contacts/tests/test_contacts_a_shutdown.xul rename : dom/contacts/tests/test_contacts_upgrade.xul => dom/contacts/tests/test_contacts_a_upgrade.xul rename : dom/mobilemessage/tests/mochitest/mochitest.ini => dom/mobilemessage/tests/mochitest/chrome.ini extra : rebase_source : 5f708f2a927fafff66626367ef07080785ba9f55
		
			
				
	
	
		
			52 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /* Any copyright is dedicated to the public domain.
 | |
|    http://creativecommons.org/publicdomain/zero/1.0/ */
 | |
| 
 | |
| // Bug 709759 - Test the stop ability of <iframe mozbrowser>.
 | |
| 
 | |
| // The img that is loaded will never be returned and will block
 | |
| // the page from loading, the timeout ensures that the page is
 | |
| // actually blocked from loading, once stop is called the
 | |
| // image load will be cancaelled and mozbrowserloadend should be called.
 | |
| 
 | |
| "use strict";
 | |
| SimpleTest.waitForExplicitFinish();
 | |
| SimpleTest.requestFlakyTimeout("untriaged");
 | |
| browserElementTestHelpers.setEnabledPref(true);
 | |
| 
 | |
| var iframe;
 | |
| var stopped = false;
 | |
| var imgSrc = 'http://test/tests/dom/browser-element/mochitest/file_bug709759.sjs';
 | |
| 
 | |
| function runTest() {
 | |
|   iframe = document.createElement('iframe');
 | |
|   iframe.setAttribute('mozbrowser', 'true');
 | |
|   // FIXME: Bug 1270790
 | |
|   iframe.setAttribute('remote', 'true');
 | |
|   iframe.addEventListener('mozbrowserloadend', loadend);
 | |
|   iframe.src = 'data:text/html,<html>' +
 | |
|     '<body><img src="' + imgSrc + '" /></body></html>';
 | |
| 
 | |
|   document.body.appendChild(iframe);
 | |
| 
 | |
|   setTimeout(function() {
 | |
|     stopped = true;
 | |
|     iframe.stop();
 | |
|   }, 200);
 | |
| }
 | |
| 
 | |
| function loadend() {
 | |
|   ok(stopped, 'Iframes network connections were stopped');
 | |
| 
 | |
|   // Wait 1 second and make sure there isn't a mozbrowsererror after stop();
 | |
|   iframe.addEventListener('mozbrowsererror', handleError);
 | |
|   window.setTimeout(function() {
 | |
|     iframe.removeEventListener('mozbrowsererror', handleError);
 | |
|     SimpleTest.finish();
 | |
|   }, 1000);
 | |
| }
 | |
| 
 | |
| function handleError() {
 | |
|   ok(false, "mozbrowsererror should not be fired");
 | |
| }
 | |
| 
 | |
| addEventListener('testready', runTest);
 |