test_xhr_standalone.js (614B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ 3 */ 4 5 // Test setting .responseType and .withCredentials is allowed 6 // in non-window non-Worker context 7 8 function run_test() { 9 Services.prefs.setBoolPref( 10 "network.fetch.systemDefaultsToOmittingCredentials", 11 false 12 ); 13 var xhr = new XMLHttpRequest(); 14 xhr.open("GET", "data:,", false); 15 var exceptionThrown = false; 16 try { 17 xhr.responseType = ""; 18 xhr.withCredentials = false; 19 } catch (e) { 20 console.error(e); 21 exceptionThrown = true; 22 } 23 Assert.equal(false, exceptionThrown); 24 }