[Streams API] Shield streams against user replacing the Promise constructor
authorcalvaris@igalia.com <calvaris@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Nov 2015 11:15:51 +0000 (11:15 +0000)
committercalvaris@igalia.com <calvaris@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Nov 2015 11:15:51 +0000 (11:15 +0000)
commit7a1f89e2c3a4368adfac060dbd4a6a1ab23e6f75
tree5456f16bc05c5979574632d6c23e7acc8893ce2f
parente4b671c2f4acca7c79b371c6f812a0527e28c8b7
[Streams API] Shield streams against user replacing the Promise constructor
https://bugs.webkit.org/show_bug.cgi?id=150887

Reviewed by Youenn Fablet.

Source/WebCore:

With this rework, we shield the Streams implementation against the user doing something like "Promise =
function() { /* do garbage */ };".

Test: streams/streams-promises.html.

* Modules/streams/ReadableStream.js:
(initializeReadableStream):
(cancel):
* Modules/streams/ReadableStreamInternals.js:
(privateInitializeReadableStreamReader):
(cancelReadableStream):
(readFromReadableStreamReader):
* Modules/streams/ReadableStreamReader.js:
(cancel):
(read):
(closed):
* Modules/streams/StreamInternals.js:
(promiseInvokeOrNoop):
(promiseInvokeOrFallbackOrNoop):
* Modules/streams/WritableStream.js:
(initializeWritableStream):
(abort):
(close):
(write):
(closed):
(ready):
* Modules/streams/WritableStreamInternals.js:
(syncWritableStreamStateWithQueue):

LayoutTests:

* streams/streams-promises-expected.txt: Added.
* streams/streams-promises.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192021 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/streams/streams-promises-expected.txt [new file with mode: 0644]
LayoutTests/streams/streams-promises.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/streams/ReadableStream.js
Source/WebCore/Modules/streams/ReadableStreamInternals.js
Source/WebCore/Modules/streams/ReadableStreamReader.js
Source/WebCore/Modules/streams/StreamInternals.js
Source/WebCore/Modules/streams/WritableStream.js
Source/WebCore/Modules/streams/WritableStreamInternals.js