mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1250930 - Use correct global when creating a key in GenerateSymmetricKeyTask r=bz
This commit is contained in:
parent
6eec770808
commit
1551754c99
@ -121,7 +121,8 @@ SubtleCrypto::GenerateKey(JSContext* cx, const ObjectOrString& algorithm,
|
||||
bool extractable, const Sequence<nsString>& keyUsages,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
SUBTLECRYPTO_METHOD_BODY(GenerateKey, aRv, cx, algorithm, extractable, keyUsages)
|
||||
SUBTLECRYPTO_METHOD_BODY(GenerateKey, aRv, mParent, cx, algorithm,
|
||||
extractable, keyUsages)
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
|
@ -2188,18 +2188,12 @@ private:
|
||||
class GenerateSymmetricKeyTask : public WebCryptoTask
|
||||
{
|
||||
public:
|
||||
GenerateSymmetricKeyTask(JSContext* aCx,
|
||||
GenerateSymmetricKeyTask(nsIGlobalObject* aGlobal, JSContext* aCx,
|
||||
const ObjectOrString& aAlgorithm, bool aExtractable,
|
||||
const Sequence<nsString>& aKeyUsages)
|
||||
{
|
||||
nsIGlobalObject* global = xpc::NativeGlobal(JS::CurrentGlobalOrNull(aCx));
|
||||
if (!global) {
|
||||
mEarlyRv = NS_ERROR_DOM_UNKNOWN_ERR;
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an empty key and set easy attributes
|
||||
mKey = new CryptoKey(global);
|
||||
mKey = new CryptoKey(aGlobal);
|
||||
mKey->SetExtractable(aExtractable);
|
||||
mKey->SetType(CryptoKey::SECRET);
|
||||
|
||||
@ -3386,7 +3380,8 @@ WebCryptoTask::CreateExportKeyTask(const nsAString& aFormat,
|
||||
}
|
||||
|
||||
WebCryptoTask*
|
||||
WebCryptoTask::CreateGenerateKeyTask(JSContext* aCx,
|
||||
WebCryptoTask::CreateGenerateKeyTask(nsIGlobalObject* aGlobal,
|
||||
JSContext* aCx,
|
||||
const ObjectOrString& aAlgorithm,
|
||||
bool aExtractable,
|
||||
const Sequence<nsString>& aKeyUsages)
|
||||
@ -3412,7 +3407,8 @@ WebCryptoTask::CreateGenerateKeyTask(JSContext* aCx,
|
||||
algName.EqualsASCII(WEBCRYPTO_ALG_AES_GCM) ||
|
||||
algName.EqualsASCII(WEBCRYPTO_ALG_AES_KW) ||
|
||||
algName.EqualsASCII(WEBCRYPTO_ALG_HMAC)) {
|
||||
return new GenerateSymmetricKeyTask(aCx, aAlgorithm, aExtractable, aKeyUsages);
|
||||
return new GenerateSymmetricKeyTask(aGlobal, aCx, aAlgorithm, aExtractable,
|
||||
aKeyUsages);
|
||||
} else if (algName.EqualsASCII(WEBCRYPTO_ALG_RSASSA_PKCS1) ||
|
||||
algName.EqualsASCII(WEBCRYPTO_ALG_RSA_OAEP) ||
|
||||
algName.EqualsASCII(WEBCRYPTO_ALG_RSA_PSS) ||
|
||||
|
@ -131,7 +131,8 @@ public:
|
||||
const Sequence<nsString>& aKeyUsages);
|
||||
static WebCryptoTask* CreateExportKeyTask(const nsAString& aFormat,
|
||||
CryptoKey& aKey);
|
||||
static WebCryptoTask* CreateGenerateKeyTask(JSContext* aCx,
|
||||
static WebCryptoTask* CreateGenerateKeyTask(nsIGlobalObject* aGlobal,
|
||||
JSContext* aCx,
|
||||
const ObjectOrString& aAlgorithm,
|
||||
bool aExtractable,
|
||||
const Sequence<nsString>& aKeyUsages);
|
||||
|
Loading…
Reference in New Issue
Block a user