зеркало из https://github.com/mozilla/gecko-dev.git
Bug 527347 - nsIScriptableUnicodeConverter::convertToByteArray aLen out param should be optional. r=smontagu
This commit is contained in:
Родитель
5ba3ec0217
Коммит
0d39e46fc6
|
@ -84,7 +84,7 @@ interface nsIScriptableUnicodeConverter : nsISupports
|
|||
* called.
|
||||
*/
|
||||
void convertToByteArray(in AString aString,
|
||||
out unsigned long aLen,
|
||||
[optional] out unsigned long aLen,
|
||||
[array, size_is(aLen),retval] out octet aData);
|
||||
|
||||
/**
|
||||
|
|
|
@ -194,7 +194,7 @@ nsScriptableUnicodeConverter::ConvertFromByteArray(const PRUint8* aData,
|
|||
}
|
||||
|
||||
/* void convertToByteArray(in AString aString,
|
||||
out unsigned long aLen,
|
||||
[optional] out unsigned long aLen,
|
||||
[array, size_is(aLen),retval] out octet aData);
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -452,8 +452,7 @@ function bytesFromString(str) {
|
|||
Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
.createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
|
||||
converter.charset = "UTF-8";
|
||||
var result = {};
|
||||
var data = converter.convertToByteArray(str, result);
|
||||
var data = converter.convertToByteArray(str);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ function doHash(algo, value, cmp) {
|
|||
var hash = new CryptoHash(algo);
|
||||
|
||||
converter.charset = 'utf8';
|
||||
value = converter.convertToByteArray(value, {});
|
||||
value = converter.convertToByteArray(value);
|
||||
hash.update(value, value.length);
|
||||
var hash1 = hexdigest(hash.finish(false));
|
||||
if (cmp != hash1) {
|
||||
|
|
|
@ -6,7 +6,7 @@ function getHMAC(data, key, alg)
|
|||
{
|
||||
var converter = new ScriptableUnicodeConverter();
|
||||
converter.charset = 'utf8';
|
||||
var dataarray = converter.convertToByteArray(data, {});
|
||||
var dataarray = converter.convertToByteArray(data);
|
||||
|
||||
var keyObject = Components.classes["@mozilla.org/security/keyobjectfactory;1"]
|
||||
.getService(Components.interfaces.nsIKeyObjectFactory)
|
||||
|
|
|
@ -49,8 +49,7 @@ getHash: function(fragment)
|
|||
var converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
|
||||
createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
converter.charset = "UTF-8";
|
||||
var result = {};
|
||||
var data = converter.convertToByteArray(fragment, result);
|
||||
var data = converter.convertToByteArray(fragment);
|
||||
var ch = Cc["@mozilla.org/security/hash;1"].createInstance(Ci.nsICryptoHash);
|
||||
ch.init(ch.SHA256);
|
||||
ch.update(data, data.length);
|
||||
|
|
|
@ -13,8 +13,7 @@ function MAC(content, clientKey)
|
|||
.getService(Ci.nsIKeyObjectFactory).keyFromString(Ci.nsIKeyObject.HMAC, clientKey);
|
||||
hmac.init(Ci.nsICryptoHMAC.SHA1, keyObject);
|
||||
|
||||
var result = {};
|
||||
var data = converter.convertToByteArray(content, result);
|
||||
var data = converter.convertToByteArray(content);
|
||||
hmac.update(data, data.length);
|
||||
return hmac.finish(true);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче