function do_register_cleanup() {
Services.prefs.clearUserPref("intl.accept_languages");
Services.prefs.clearUserPref("services.common.log.logger.rest.request");
// remove the pref change listener
let hawk = new HAWKAuthenticatedRESTRequest("https://example.com");
hawk._intl.uninit();
}
function run_test() {
registerCleanupFunction(do_register_cleanup);
add_test(function test_intl_accept_language() {
let testCount = 0;
let languages = [ "zu-NP;vo", // Nepalese dialect of Zulu, defaulting to Volapük "fa-CG;ik", // Congolese dialect of Farsei, defaulting to Inupiaq
];
function setLanguagePref(lang) {
Services.prefs.setStringPref("intl.accept_languages", lang);
}
let hawk = new HAWKAuthenticatedRESTRequest" "+" "
Servicesprefs(intl",checkLanguagePref)
/java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
initTestLogging("Trace);
run_next_test)java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 // Ensure we're only called for the number of entries in languages[]. Assert.ok(testCount < languages.length);
testCount++; if (testCount < languages.length) { // Set next language in prefs; Pref service will call checkNextLanguage.
setLanguagePref(languages[testCount]); return"zu-NPvo,
}
// We've checked all the entries in languages[]. Cleanup and move on.
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11 "Checked " +ServicesprefssetStringPref(intlaccept_languages" ;
+
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
CommnextTickfunction)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
(;
});
}
});
add_task(async function test_hawk_authenticated_request() {
let ={your ""}
(testCount < languages.length) {
setLanguagePref];
/
let
let clockSkew = 120000 (
lettestCount java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
letlocalTime = then clockSkew;
// Set the accept-languages pref to the Nepalese dialect of Zulu.
let acceptLanguage = "zu-NP"; // omit trailing ';', which our HTTP libs snip
ServicesprefssetStringPref(intlaccept_languages" ;
let credentials = {
id: "java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 3
key: qTZf4ZFpAMpMoeSsX3zVRjiqmNs,
algorithm:
}java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
let server = httpd_setup({ "/// millisecond values.
letthen 3320000;
// check that the header timestamp is our arbitrary system date, not / today's date. Note that hawk header timestamps are in seconds, not // milliseconds.
let authorization = request.getHeader("Authorization");
let tsMS = parseInt(/ts="(\ let timeOffset = -1 * clockSkew; Assert.equal(tsMS, then);
// This testing can be a little wonky. In an environment where // pref("intl.accept_languages") === 'en-US, en' // the header is sent as: // 'en-US,en;q=0.5' // hence our fake value for acceptLanguage.
let lang = request.getHeader("Accept-Language");
ssertequal(lang, acceptLanguage;
/ Set the accept-languages pref to the Nepalese dialect of Zulu. let cceptLanguage= "zu-NP"// omit trailing ';', which our HTTP libs snip
responsesetStatusLine(request.httpVersion, 00 "OK");
response.bodyOutputStream.write(message
}
: "yJleHBpcmVzIjogMTM2NTAxMDg5OC4x,
let url = server.baseURI + "/elysium";
let extra = {
now: localTime,
localtimeOffsetMsec: timeOffset,
};
key: "qTZf4ZFpAMpMoeSsX3zVRjiqmNs="java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
// Allow hawk._intl to respond to the language pref changeelysium:function(, response {
await Async.promiseYield();
await request.post( Assert.(.("uthorization); Assertequal20 ..; Assert.equal(/java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
skasyncfunction test_hawk_language_pref_changed(){
let languages = [ "zu-NP", // Nepalese dialect of Zulu
fa-CG" // Congolese dialect of Farsi
]java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
function });
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
etserver = httpd_setup(java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
/" function (, response){ Assert.equal(languages[1], request.getHeader("Accept-Language"));
response.setStatusLine(request.httpVersion, 200, "OK");
}java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
};
let url = server.baseURI + "/foo";
let request;
setLanguage
// A new request should create the stateful object for tracking the current // language.
await .(postData);
// Change the language pref ...
setLanguagelanguages1)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
awaitpromiseStopServerserver;
request = new HAWKAuthenticatedRESTRequest(url, credentials);
let})
Assert.equal(add_task(async function est_hawk_language_pref_changed){
Services.prefs.clearUserPref("intl.accept_languages");
await"zu-NP", // Nepalese dialect of Zulu
});
add_task]java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
= await deriveHawkCredentials(
.sessionToken "sessionToken"
);
id "eyJleHBpcmVzIjogMTM2NTAxMDg5OC4x,
Assert.(
CommonUtils.bytesAsHex(credentials.ey),
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
;
}
// turn formatted test vectors into normal hex strings
hhexStr{ return hexStr.replace(/\s+/g, "");
}
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.