// If the page doesnt have privileges to create a system XHR,
// this flag will always be false no matter what is passed.
let expectedAnon = Boolean(value && value.mozAnon);
let expectedSystem = false;
if (havePrivileges) {
expectedSystem = Boolean(value && value.mozSystem);
}
is(xhr.mozAnon, expectedAnon, "testing mozAnon");
is(xhr.mozSystem, expectedSystem, "testing mozSystem");
}
function testInvalidParameter(value) {
let expectedError;
try {
new XMLHttpRequest(value);
ok(false, "invalid parameter did not cause exception: " +
JSON.stringify(value));
} catch (ex) {
expectedError = ex;
}
ok(expectedError, "invalid parameter raised exception as expected: " +
JSON.stringify(expectedError))
}
// Run the tests once without API privileges...
validParameters.forEach(testValidParameter);
invalidParameters.forEach(testInvalidParameter);
// ...and once with privileges.
havePrivileges = true;
SpecialPowers.pushPermissions([{'type': 'systemXHR', 'allow': true, 'context': document}], function() {
validParameters.forEach(testValidParameter);
invalidParameters.forEach(testInvalidParameter);
SimpleTest.finish();
});
}
</script>
</pre>
</body>
</html>
Messung V0.5
¤ Dauer der Verarbeitung: 0.21 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.