Index: components/webcrypto/webcrypto_impl.cc |
diff --git a/components/webcrypto/webcrypto_impl.cc b/components/webcrypto/webcrypto_impl.cc |
index 3ccfbc912d1570201b575c33aa6ef57d0b718582..8c20cd2e1313742a5b69476e3f87d4ee85c828ee 100644 |
--- a/components/webcrypto/webcrypto_impl.cc |
+++ b/components/webcrypto/webcrypto_impl.cc |
@@ -375,6 +375,8 @@ struct DeriveKeyState : public BaseState { |
// * The methods named Do*Reply() run on the target Blink thread |
void DoEncryptReply(scoped_ptr<EncryptState> state) { |
+ if (state->cancelled()) |
+ return; |
CompleteWithBufferOrError(state->status, state->buffer, &state->result); |
} |
@@ -390,6 +392,8 @@ void DoEncrypt(scoped_ptr<EncryptState> passed_state) { |
} |
void DoDecryptReply(scoped_ptr<DecryptState> state) { |
+ if (state->cancelled()) |
+ return; |
CompleteWithBufferOrError(state->status, state->buffer, &state->result); |
} |
@@ -405,6 +409,8 @@ void DoDecrypt(scoped_ptr<DecryptState> passed_state) { |
} |
void DoDigestReply(scoped_ptr<DigestState> state) { |
+ if (state->cancelled()) |
+ return; |
CompleteWithBufferOrError(state->status, state->buffer, &state->result); |
} |
@@ -419,6 +425,8 @@ void DoDigest(scoped_ptr<DigestState> passed_state) { |
} |
void DoGenerateKeyReply(scoped_ptr<GenerateKeyState> state) { |
+ if (state->cancelled()) |
+ return; |
if (state->status.IsError()) { |
CompleteWithError(state->status, &state->result); |
} else { |
@@ -438,6 +446,8 @@ void DoGenerateKey(scoped_ptr<GenerateKeyState> passed_state) { |
} |
void DoImportKeyReply(scoped_ptr<ImportKeyState> state) { |
+ if (state->cancelled()) |
+ return; |
CompleteWithKeyOrError(state->status, state->key, &state->result); |
} |
@@ -459,6 +469,8 @@ void DoImportKey(scoped_ptr<ImportKeyState> passed_state) { |
} |
void DoExportKeyReply(scoped_ptr<ExportKeyState> state) { |
+ if (state->cancelled()) |
+ return; |
if (state->format != blink::WebCryptoKeyFormatJwk) { |
CompleteWithBufferOrError(state->status, state->buffer, &state->result); |
return; |
@@ -484,6 +496,8 @@ void DoExportKey(scoped_ptr<ExportKeyState> passed_state) { |
} |
void DoSignReply(scoped_ptr<SignState> state) { |
+ if (state->cancelled()) |
+ return; |
CompleteWithBufferOrError(state->status, state->buffer, &state->result); |
} |
@@ -500,6 +514,8 @@ void DoSign(scoped_ptr<SignState> passed_state) { |
} |
void DoVerifyReply(scoped_ptr<VerifySignatureState> state) { |
+ if (state->cancelled()) |
+ return; |
if (state->status.IsError()) { |
CompleteWithError(state->status, &state->result); |
} else { |
@@ -520,6 +536,8 @@ void DoVerify(scoped_ptr<VerifySignatureState> passed_state) { |
} |
void DoWrapKeyReply(scoped_ptr<WrapKeyState> state) { |
+ if (state->cancelled()) |
+ return; |
CompleteWithBufferOrError(state->status, state->buffer, &state->result); |
} |
@@ -536,6 +554,8 @@ void DoWrapKey(scoped_ptr<WrapKeyState> passed_state) { |
} |
void DoUnwrapKeyReply(scoped_ptr<UnwrapKeyState> state) { |
+ if (state->cancelled()) |
+ return; |
CompleteWithKeyOrError(state->status, state->unwrapped_key, &state->result); |
} |
@@ -554,6 +574,8 @@ void DoUnwrapKey(scoped_ptr<UnwrapKeyState> passed_state) { |
} |
void DoDeriveBitsReply(scoped_ptr<DeriveBitsState> state) { |
+ if (state->cancelled()) |
+ return; |
CompleteWithBufferOrError(state->status, state->derived_bytes, |
&state->result); |
} |
@@ -570,6 +592,8 @@ void DoDeriveBits(scoped_ptr<DeriveBitsState> passed_state) { |
} |
void DoDeriveKeyReply(scoped_ptr<DeriveKeyState> state) { |
+ if (state->cancelled()) |
+ return; |
CompleteWithKeyOrError(state->status, state->derived_key, &state->result); |
} |