RESOLVED FIXED 151625
[Streams API] Remove use of @catch for exposed promises
https://bugs.webkit.org/show_bug.cgi?id=151625
Summary [Streams API] Remove use of @catch for exposed promises
youenn fablet
Reported 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,...).
Attachments
Patch (5.70 KB, patch)
2015-11-26 06:27 PST, youenn fablet
no flags
youenn fablet
Comment 1 2015-11-26 06:27:46 PST
Xabier Rodríguez Calvar
Comment 2 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.
Xabier Rodríguez Calvar
Comment 3 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.
youenn fablet
Comment 4 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.
Xabier Rodríguez Calvar
Comment 5 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.
WebKit Commit Bot
Comment 6 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>
WebKit Commit Bot
Comment 7 2015-12-01 00:16:02 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.