[Streams API] Shield promises when prototype is replaced from a promise
authorcalvaris@igalia.com <calvaris@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Nov 2015 08:51:03 +0000 (08:51 +0000)
committercalvaris@igalia.com <calvaris@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Nov 2015 08:51:03 +0000 (08:51 +0000)
commit3091a87f078a48c733dec42d3866da522be11e24
treede54f47d4cc902305e60ecbde44b401e5ba78bcc
parent909d998f207e15ca6338a8d78def4de221b3d523
[Streams API] Shield promises when prototype is replaced from a promise
https://bugs.webkit.org/show_bug.cgi?id=151033

Reviewed by Darin Adler.

Source/WebCore:

Instead of calling @then or @catch, that could have disappeared if the user successfully replaces a promise
constructor, we call the methods stored at @Promise.prototype, which are safe as @Promise.prototype.@then.@call
and @Promise.prototype.@catch.@call.

Test: streams/streams-promises.html, expectations updated.

* Modules/streams/ReadableStream.js:
(initializeReadableStream):
* Modules/streams/ReadableStreamInternals.js:
(teeReadableStream):
(teeReadableStreamPullFunction):
(teeReadableStreamBranch2CancelFunction):
(cancelReadableStream):
* Modules/streams/WritableStream.js:
(initializeWritableStream):
(abort):
* Modules/streams/WritableStreamInternals.js:
(callOrScheduleWritableStreamAdvanceQueue):

LayoutTests:

* streams/streams-promises-expected.txt: Updated expectations.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192207 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/streams/streams-promises-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/streams/ReadableStream.js
Source/WebCore/Modules/streams/ReadableStreamInternals.js
Source/WebCore/Modules/streams/WritableStream.js
Source/WebCore/Modules/streams/WritableStreamInternals.js