Skip to content

Commit 90a0ad3

Browse files
committed
fixup! src,lib: switch usages internal slot to a bitmask
1 parent 9c37d26 commit 90a0ad3

2 files changed

Lines changed: 5 additions & 17 deletions

File tree

src/crypto/crypto_keys.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,7 +1895,6 @@ void NativeCryptoKey::GetSlots(const FunctionCallbackInfo<Value>& args) {
18951895
THROW_ERR_INVALID_THIS(env, "Value of \"this\" must be of type CryptoKey");
18961896
return;
18971897
}
1898-
Isolate* isolate = env->isolate();
18991898
Local<Object> obj = args[0].As<Object>();
19001899
NativeCryptoKey* native = Unwrap<NativeCryptoKey>(obj);
19011900

@@ -1906,6 +1905,7 @@ void NativeCryptoKey::GetSlots(const FunctionCallbackInfo<Value>& args) {
19061905

19071906
Local<Value> algorithm = obj->GetInternalField(kAlgorithmField).As<Value>();
19081907
CHECK(algorithm->IsObject());
1908+
Isolate* isolate = env->isolate();
19091909
Local<Value> slots[] = {
19101910
Uint32::NewFromUnsigned(isolate, native->handle_data_.GetKeyType()),
19111911
v8::Boolean::New(isolate, native->extractable_),
@@ -2029,9 +2029,9 @@ BaseObjectPtr<BaseObject> NativeCryptoKey::CryptoKeyTransferData::Deserialize(
20292029
CHECK(!cryptokey_ctor.IsEmpty());
20302030
Local<Value> ctor_args[] = {
20312031
handle,
2032-
Undefined(env->isolate()),
2033-
Undefined(env->isolate()),
2034-
Undefined(env->isolate()),
2032+
Undefined(isolate),
2033+
Undefined(isolate),
2034+
Undefined(isolate),
20352035
};
20362036
Local<Value> cryptokey;
20372037
if (!cryptokey_ctor->NewInstance(context, 4, ctor_args).ToLocal(&cryptokey)) {

test/parallel/test-webcrypto-cryptokey-clone-transfer.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -225,19 +225,7 @@ async function checkRsaPssTransferToWorker({ publicKey, privateKey }) {
225225
const { parentPort } = require('node:worker_threads');
226226
const { subtle } = globalThis.crypto;
227227
228-
function describeKey(key) {
229-
const algorithm = { ...key.algorithm };
230-
if (algorithm.hash !== undefined)
231-
algorithm.hash = { ...algorithm.hash };
232-
if (algorithm.publicExponent !== undefined)
233-
algorithm.publicExponent = Array.from(algorithm.publicExponent);
234-
return {
235-
type: key.type,
236-
extractable: key.extractable,
237-
algorithm,
238-
usages: [...key.usages].sort(),
239-
};
240-
}
228+
${describeKey}
241229
242230
parentPort.once('message', async (message) => {
243231
try {

0 commit comments

Comments
 (0)