Bug 164758 - js-test-pre.js::shouldReject doesn't need _rejectCallback and _resolveCallback
Summary: js-test-pre.js::shouldReject doesn't need _rejectCallback and _resolveCallback
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jiewen Tan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-11-14 18:05 PST by Jiewen Tan
Modified: 2018-05-24 16:43 PDT (History)
6 users (show)

See Also:


Attachments
Patch (7.76 KB, patch)
2016-11-14 18:09 PST, Jiewen Tan
youennf: review+
Details | Formatted Diff | Diff
Patch for landing (7.73 KB, patch)
2016-11-15 11:32 PST, Jiewen Tan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jiewen Tan 2016-11-14 18:05:04 PST
js-test-pre.js::shouldReject doesn't need _rejectCallback and _resolveCallback.
Comment 1 Jiewen Tan 2016-11-14 18:09:43 PST
Created attachment 294789 [details]
Patch
Comment 2 youenn fablet 2016-11-15 11:15:48 PST
Comment on attachment 294789 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=294789&action=review

> LayoutTests/crypto/subtle/generate-key-malformed-parameters.html:62
> +shouldReject('crypto.subtle.generateKey({name: "RSAES-PKCS1-v1_5", modulusLength: 2048, publicExponent: new Uint8Array([0x01, 0x00, 0x01])}, extractable, [ ])').then(finishJSTest, finishJSTest);

then(finishJSTest) should be sufficient.

> LayoutTests/crypto/subtle/rsa-generate-key-malformed-parameters.html:53
> +shouldReject('crypto.subtle.generateKey({name: "RSASSA-PKCS1-v1_5", modulusLength: 0, publicExponent: publicExponent, hash: "sha-1"}, extractable, ["sign", "verify"])').then(finishJSTest, finishJSTest);

Ditto.

> LayoutTests/crypto/workers/subtle/resources/rsa-generate-key.js:14
> +}).then(function(result) {

Here shouldReject calls are chained.
In the other tests, they are not. Is this by design?

Not chaining make the shouldReject run in parallel.
This allows checking that rejection is done synchronous (although callback is called asynchronously).
Comment 3 Jiewen Tan 2016-11-15 11:28:03 PST
Comment on attachment 294789 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=294789&action=review

First of all, thanks Youenn for reviewing my patch.

>> LayoutTests/crypto/subtle/generate-key-malformed-parameters.html:62
>> +shouldReject('crypto.subtle.generateKey({name: "RSAES-PKCS1-v1_5", modulusLength: 2048, publicExponent: new Uint8Array([0x01, 0x00, 0x01])}, extractable, [ ])').then(finishJSTest, finishJSTest);
> 
> then(finishJSTest) should be sufficient.

Fixed.

>> LayoutTests/crypto/subtle/rsa-generate-key-malformed-parameters.html:53
>> +shouldReject('crypto.subtle.generateKey({name: "RSASSA-PKCS1-v1_5", modulusLength: 0, publicExponent: publicExponent, hash: "sha-1"}, extractable, ["sign", "verify"])').then(finishJSTest, finishJSTest);
> 
> Ditto.

Fixed.

>> LayoutTests/crypto/workers/subtle/resources/rsa-generate-key.js:14
>> +}).then(function(result) {
> 
> Here shouldReject calls are chained.
> In the other tests, they are not. Is this by design?
> 
> Not chaining make the shouldReject run in parallel.
> This allows checking that rejection is done synchronous (although callback is called asynchronously).

Yes, this is done by design. The first one is reject before the main thread hands over the key generation job to a secondary thread. Therefore, it should be reject synchronously. While the second one is reject after, and therefore it should be reject asynchronously.
Comment 4 Jiewen Tan 2016-11-15 11:32:53 PST
Created attachment 294858 [details]
Patch for landing
Comment 5 WebKit Commit Bot 2016-11-15 14:50:39 PST
Comment on attachment 294858 [details]
Patch for landing

Clearing flags on attachment: 294858

Committed r208759: <http://trac.webkit.org/changeset/208759>
Comment 6 Radar WebKit Bug Importer 2018-05-24 16:43:17 PDT
<rdar://problem/40539450>