forked from mirrors/gecko-dev
		
	 5cb239b14a
			
		
	
	
		5cb239b14a
		
	
	
	
	
		
			
			We have to run the navigator checks in sub-iframes as we need to set preferences which affect navigator's API which may or may not be already initialised with the current settings. The sub-iframes will have a navigator object set up with the expected preferences for the test. The iframes all call into the parent to publish the test results, this is because the SimpleTest infrastructure doesn't cope with results being published from sub-iframes. MozReview-Commit-ID: GFVQHMVkbMP --HG-- rename : dom/power/test/test_bug957899.html => dom/power/test/test_bug957899_iframe.html rename : dom/presentation/tests/mochitest/test_presentation_availability.html => dom/presentation/tests/mochitest/test_presentation_availability_iframe.html rename : dom/tests/mochitest/gamepad/test_check_timestamp.html => dom/tests/mochitest/gamepad/test_check_timestamp_iframe.html rename : dom/tests/mochitest/gamepad/test_gamepad_connect_events.html => dom/tests/mochitest/gamepad/test_gamepad_connect_events_iframe.html rename : dom/tests/mochitest/gamepad/test_gamepad_extensions.html => dom/tests/mochitest/gamepad/test_gamepad_extensions_iframe.html rename : dom/tests/mochitest/gamepad/test_gamepad_frame_state_sync.html => dom/tests/mochitest/gamepad/test_gamepad_frame_state_sync_iframe.html rename : dom/tests/mochitest/gamepad/test_gamepad_hidden_frame.html => dom/tests/mochitest/gamepad/test_gamepad_hidden_frame_iframe.html rename : dom/tests/mochitest/gamepad/test_gamepad.html => dom/tests/mochitest/gamepad/test_gamepad_iframe.html rename : dom/tests/mochitest/gamepad/test_navigator_gamepads.html => dom/tests/mochitest/gamepad/test_navigator_gamepads_iframe.html rename : dom/tests/mochitest/geolocation/test_geolocation_is_undefined_when_pref_is_off.html => dom/tests/mochitest/geolocation/test_geolocation_is_undefined_when_pref_is_off_iframe.html rename : dom/workers/test/test_navigator.html => dom/workers/test/test_navigator_iframe.html rename : dom/workers/test/test_navigator.js => dom/workers/test/test_navigator_iframe.js extra : rebase_source : fe0f3e342cb55b5e9da7038acb59b5e2a5c8767e
		
			
				
	
	
		
			48 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| var worker = new Worker("navigator_worker.js");
 | |
| 
 | |
| var is = window.parent.is;
 | |
| var ok = window.parent.ok;
 | |
| var SimpleTest = window.parent.SimpleTest;
 | |
| 
 | |
| worker.onmessage = function(event) {
 | |
|   var args = JSON.parse(event.data);
 | |
| 
 | |
|   if (args.name == "testFinished") {
 | |
|     SimpleTest.finish();
 | |
|     return;
 | |
|   }
 | |
| 
 | |
|   if (typeof navigator[args.name] == "undefined") {
 | |
|     ok(false, "Navigator has no '" + args.name + "' property!");
 | |
|     return;
 | |
|   }
 | |
| 
 | |
|   if (args.name === "languages") {
 | |
|     is(navigator.languages.toString(), args.value.toString(), "languages matches");
 | |
|     return;
 | |
|   }
 | |
| 
 | |
|   if (args.name === "storage") {
 | |
|     is(typeof navigator.storage, typeof args.value, "storage type matches");
 | |
|     return;
 | |
|   }
 | |
| 
 | |
|   if (args.name === "connection") {
 | |
|     is(typeof navigator.connection, typeof args.value, "connection type matches");
 | |
|     return;
 | |
|   }
 | |
| 
 | |
|   is(navigator[args.name], args.value,
 | |
|      "Mismatched navigator string for " + args.name + "!");
 | |
| };
 | |
| 
 | |
| worker.onerror = function(event) {
 | |
|   ok(false, "Worker had an error: " + event.message);
 | |
|   SimpleTest.finish();
 | |
| }
 | |
| 
 | |
| var version = SpecialPowers.Cc["@mozilla.org/xre/app-info;1"].getService(SpecialPowers.Ci.nsIXULAppInfo).version;
 | |
| var isNightly = version.endsWith("a1");
 | |
| var isRelease = !version.includes("a");
 | |
| 
 | |
| worker.postMessage({ isNightly, isRelease });
 |