Bug 151625 - [Streams API] Remove use of @catch for exposed promises
Summary: [Streams API] Remove use of @catch for exposed promises
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-26 06:23 PST by youenn fablet
Modified: 2015-12-01 00:16 PST (History)
8 users (show)

See Also:


Attachments
Patch (5.70 KB, patch)
2015-11-26 06:27 PST, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2015-11-26 06:23:04 PST
@catch is calling then which may be controlled by user scripts.
It is better to rewrite the code from @catch(...) to @then(undefined,...).
Comment 1 youenn fablet 2015-11-26 06:27:46 PST
Created attachment 266185 [details]
Patch
Comment 2 Xabier Rodríguez Calvar 2015-11-26 06:46:09 PST
(In reply to comment #0)
> @catch is calling then which may be controlled by user scripts.
> It is better to rewrite the code from @catch(...) to @then(undefined,...).

I like the patch, it solves the issue. There's an alternative though that might keep some readability in patches as you wouldn't need to so @then(undefined, ...) and would be using @then instead of then for the catch implementation. That might even make other code more robust.
Comment 3 Xabier Rodríguez Calvar 2015-11-26 06:47:15 PST
(In reply to comment #2)
> @then(undefined, ...) and would be using @then instead of then for the catch
> implementation. That might even make other code more robust.

If you decide to do this, do not forget to change the bug description.
Comment 4 youenn fablet 2015-11-26 06:55:49 PST
(In reply to comment #2)
> (In reply to comment #0)
> > @catch is calling then which may be controlled by user scripts.
> > It is better to rewrite the code from @catch(...) to @then(undefined,...).
> 
> I like the patch, it solves the issue. There's an alternative though that
> might keep some readability in patches as you wouldn't need to so
> @then(undefined, ...) and would be using @then instead of then for the catch
> implementation. That might even make other code more robust.

The catch method is defined in the spec so as to rely on the "then" property, which makes that approach impossible.

We could write @catch with a new JS code that would call @then, but I don't think the improved readability is sufficient to make that appealing.
Comment 5 Xabier Rodríguez Calvar 2015-11-26 08:42:21 PST
(In reply to comment #4)
> The catch method is defined in the spec so as to rely on the "then"
> property, which makes that approach impossible.

I suspected that, yes.

> We could write @catch with a new JS code that would call @then, but I don't
> think the improved readability is sufficient to make that appealing.

Agree.
Comment 6 WebKit Commit Bot 2015-12-01 00:15:59 PST
Comment on attachment 266185 [details]
Patch

Clearing flags on attachment: 266185

Committed r192865: <http://trac.webkit.org/changeset/192865>
Comment 7 WebKit Commit Bot 2015-12-01 00:16:02 PST
All reviewed patches have been landed.  Closing bug.