<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[192157] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/192157">192157</a></dd>
<dt>Author</dt> <dd>calvaris@igalia.com</dd>
<dt>Date</dt> <dd>2015-11-09 08:12:37 -0800 (Mon, 09 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Streams API] Shield implementation from mangling then and catch promise methods
https://bugs.webkit.org/show_bug.cgi?id=150934

Reviewed by Youenn Fablet.

Source/JavaScriptCore:

Since the prototype is not deletable and readonly we only have to care about ensuring that it has the right
@then and @catch internal methods.

* runtime/JSPromisePrototype.h:
* runtime/JSPromisePrototype.cpp:
(JSC::JSPromisePrototype::addOwnInternalSlots): Added to create the proper @then and @catch internal slots.
(JSC::JSPromisePrototype::create): Call addOwnInternalSlots.

Source/WebCore:

This is a first step to get streams code shielded from user replacing the then and catch methods in our
promises. We use newly introduced @then and @catch prototype internal slots and that should solve a lot of use
cases.

Test: streams/streams-promises.html.

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

LayoutTests:

* streams/streams-promises.html: Added tests from about replacing
the prototype, then and catch methods. Renamed all tests as well.
* streams/streams-promises-expected.txt: Added expectations.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsstreamsstreamspromisesexpectedtxt">trunk/LayoutTests/streams/streams-promises-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstreamsstreamspromiseshtml">trunk/LayoutTests/streams/streams-promises.html</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSPromisePrototypecpp">trunk/Source/JavaScriptCore/runtime/JSPromisePrototype.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSPromisePrototypeh">trunk/Source/JavaScriptCore/runtime/JSPromisePrototype.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesstreamsReadableStreamjs">trunk/Source/WebCore/Modules/streams/ReadableStream.js</a></li>
<li><a href="#trunkSourceWebCoreModulesstreamsReadableStreamInternalsjs">trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js</a></li>
<li><a href="#trunkSourceWebCoreModulesstreamsWritableStreamjs">trunk/Source/WebCore/Modules/streams/WritableStream.js</a></li>
<li><a href="#trunkSourceWebCoreModulesstreamsWritableStreamInternalsjs">trunk/Source/WebCore/Modules/streams/WritableStreamInternals.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (192156 => 192157)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-11-09 14:46:49 UTC (rev 192156)
+++ trunk/LayoutTests/ChangeLog        2015-11-09 16:12:37 UTC (rev 192157)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2015-11-09  Xabier Rodriguez Calvar  &lt;calvaris@igalia.com&gt;
+
+        [Streams API] Shield implementation from mangling then and catch promise methods
+        https://bugs.webkit.org/show_bug.cgi?id=150934
+
+        Reviewed by Youenn Fablet.
+
+        * streams/streams-promises.html: Added tests from about replacing
+        the prototype, then and catch methods. Renamed all tests as well.
+        * streams/streams-promises-expected.txt: Added expectations.
+
</ins><span class="cx"> 2015-11-02  Sergio Villar Senin  &lt;svillar@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [css-grid] Improve grid container sizing with size constraints and intrinsic sizes
</span></span></pre></div>
<a id="trunkLayoutTestsstreamsstreamspromisesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/streams/streams-promises-expected.txt (192156 => 192157)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/streams/streams-promises-expected.txt        2015-11-09 14:46:49 UTC (rev 192156)
+++ trunk/LayoutTests/streams/streams-promises-expected.txt        2015-11-09 16:12:37 UTC (rev 192157)
</span><span class="lines">@@ -1,5 +1,9 @@
</span><span class="cx"> 
</span><del>-PASS Streams implementation is not affected if Promise constructor is replaced 
-PASS Streams implementation is not affected if Promise.resolve is replaced 
-PASS Streams implementation is not affected if Promise.reject is replaced 
</del><ins>+PASS Streams and promises: replace Promise constructor 
+PASS Streams and promises: replace Promise.resolve 
+PASS Streams and promises: replace Promise.reject 
+FAIL Streams and promises: replace prototype of a promise object undefined is not a function
+PASS Streams and promises: replace then method in Promise prototype 
+PASS Streams and promises: replace catch method in Promise prototype 
+PASS Streams and promises: replace then method in promise object 
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsstreamsstreamspromiseshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/streams/streams-promises.html (192156 => 192157)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/streams/streams-promises.html        2015-11-09 14:46:49 UTC (rev 192156)
+++ trunk/LayoutTests/streams/streams-promises.html        2015-11-09 16:12:37 UTC (rev 192157)
</span><span class="lines">@@ -2,7 +2,6 @@
</span><span class="cx"> &lt;script src='../resources/testharness.js'&gt;&lt;/script&gt;
</span><span class="cx"> &lt;script src='../resources/testharnessreport.js'&gt;&lt;/script&gt;
</span><span class="cx"> &lt;script&gt;
</span><del>-
</del><span class="cx"> test(function() {
</span><span class="cx">     const PromiseBackup = Promise;
</span><span class="cx"> 
</span><span class="lines">@@ -14,7 +13,7 @@
</span><span class="cx">     } finally {
</span><span class="cx">         Promise = PromiseBackup;
</span><span class="cx">     }
</span><del>-}, 'Streams implementation is not affected if Promise constructor is replaced');
</del><ins>+}, 'Streams and promises: replace Promise constructor');
</ins><span class="cx"> 
</span><span class="cx"> test(function() {
</span><span class="cx">     const PromiseResolveBackup = Promise.resolve;
</span><span class="lines">@@ -27,7 +26,7 @@
</span><span class="cx">     } finally {
</span><span class="cx">         Promise.resolve = PromiseResolveBackup;
</span><span class="cx">     }
</span><del>-}, 'Streams implementation is not affected if Promise.resolve is replaced');
</del><ins>+}, 'Streams and promises: replace Promise.resolve');
</ins><span class="cx"> 
</span><span class="cx"> test(function() {
</span><span class="cx">     const PromiseRejectBackup = Promise.reject;
</span><span class="lines">@@ -40,5 +39,51 @@
</span><span class="cx">     } finally {
</span><span class="cx">         Promise.reject = PromiseRejectBackup;
</span><span class="cx">     }
</span><del>-}, 'Streams implementation is not affected if Promise.reject is replaced');
</del><ins>+}, 'Streams and promises: replace Promise.reject');
+
+test(function() {
+    function createMangledPromise() {
+        const promise = Promise.resolve();
+        Object.setPrototypeOf(promise, { constructor: Promise, then: function() { assert_unreached(&quot;streams should not use this promise then method&quot;); } });
+        return promise;
+    }
+    new ReadableStream({ start: function() { return createMangledPromise(); } })
+    new WritableStream({ start: function() { return createMangledPromise(); } })
+}, 'Streams and promises: replace prototype of a promise object');
+
+test(function() {
+    const PromiseThenBackup = Promise.prototype.then;
+
+    try {
+        Promise.prototype.then = function() { assert_unreached(&quot;streams should not use this Promise.prototype.then method&quot;); };
+
+        new ReadableStream();
+        new WritableStream();
+    } finally {
+        Promise.prototype.then = PromiseThenBackup;
+    }
+}, 'Streams and promises: replace then method in Promise prototype');
+
+test(function() {
+    const PromiseCatchBackup = Promise.prototype.catch;
+
+    try {
+        Promise.prototype.catch = function() { assert_unreached(&quot;streams should not use this Promise.prototype.catch method&quot;); };
+
+        const rs = new ReadableStream();
+        rs.tee();
+    } finally {
+        Promise.prototype.catch = PromiseCatchBackup;
+    }
+}, 'Streams and promises: replace catch method in Promise prototype');
+
+test(function() {
+    function createMangledPromise() {
+        const promise = Promise.resolve();
+        promise.then = function() { assert_unreached(&quot;streams should not use this promise then method&quot;); };
+        return promise;
+    }
+    new ReadableStream({ start: function() { return createMangledPromise(); } })
+    new WritableStream({ start: function() { return createMangledPromise(); } })
+}, 'Streams and promises: replace then method in promise object');
</ins><span class="cx"> &lt;/script&gt;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (192156 => 192157)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-11-09 14:46:49 UTC (rev 192156)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-11-09 16:12:37 UTC (rev 192157)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-11-09  Xabier Rodriguez Calvar  &lt;calvaris@igalia.com&gt;
+
+        [Streams API] Shield implementation from mangling then and catch promise methods
+        https://bugs.webkit.org/show_bug.cgi?id=150934
+
+        Reviewed by Youenn Fablet.
+
+        Since the prototype is not deletable and readonly we only have to care about ensuring that it has the right
+        @then and @catch internal methods.
+
+        * runtime/JSPromisePrototype.h:
+        * runtime/JSPromisePrototype.cpp:
+        (JSC::JSPromisePrototype::addOwnInternalSlots): Added to create the proper @then and @catch internal slots.
+        (JSC::JSPromisePrototype::create): Call addOwnInternalSlots.
+
</ins><span class="cx"> 2015-11-09  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
</span><span class="cx"> 
</span><span class="cx">         JS Built-ins functions should be able to assert
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSPromisePrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSPromisePrototype.cpp (192156 => 192157)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSPromisePrototype.cpp        2015-11-09 14:46:49 UTC (rev 192156)
+++ trunk/Source/JavaScriptCore/runtime/JSPromisePrototype.cpp        2015-11-09 16:12:37 UTC (rev 192157)
</span><span class="lines">@@ -26,10 +26,12 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;JSPromisePrototype.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;BuiltinNames.h&quot;
</ins><span class="cx"> #include &quot;Error.h&quot;
</span><span class="cx"> #include &quot;JSCBuiltins.h&quot;
</span><span class="cx"> #include &quot;JSCJSValueInlines.h&quot;
</span><span class="cx"> #include &quot;JSCellInlines.h&quot;
</span><ins>+#include &quot;JSFunction.h&quot;
</ins><span class="cx"> #include &quot;JSGlobalObject.h&quot;
</span><span class="cx"> #include &quot;JSPromise.h&quot;
</span><span class="cx"> #include &quot;Microtask.h&quot;
</span><span class="lines">@@ -58,6 +60,7 @@
</span><span class="cx"> {
</span><span class="cx">     JSPromisePrototype* object = new (NotNull, allocateCell&lt;JSPromisePrototype&gt;(vm.heap)) JSPromisePrototype(vm, structure);
</span><span class="cx">     object-&gt;finishCreation(vm, structure);
</span><ins>+    object-&gt;addOwnInternalSlots(vm, structure-&gt;globalObject());
</ins><span class="cx">     return object;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -77,6 +80,12 @@
</span><span class="cx">     putDirectWithoutTransition(vm, vm.propertyNames-&gt;toStringTagSymbol, jsString(&amp;vm, &quot;Promise&quot;), DontEnum | ReadOnly);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void JSPromisePrototype::addOwnInternalSlots(VM&amp; vm, JSGlobalObject* globalObject)
+{
+    JSC_BUILTIN_FUNCTION(vm.propertyNames-&gt;builtinNames().thenPrivateName(), promisePrototypeThenCodeGenerator, DontEnum | DontDelete | ReadOnly);
+    JSC_BUILTIN_FUNCTION(vm.propertyNames-&gt;builtinNames().catchPrivateName(), promisePrototypeCatchCodeGenerator, DontEnum | DontDelete | ReadOnly);
+}
+
</ins><span class="cx"> bool JSPromisePrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot&amp; slot)
</span><span class="cx"> {
</span><span class="cx">     return getStaticFunctionSlot&lt;Base&gt;(exec, promisePrototypeTable, jsCast&lt;JSPromisePrototype*&gt;(object), propertyName, slot);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSPromisePrototypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSPromisePrototype.h (192156 => 192157)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSPromisePrototype.h        2015-11-09 14:46:49 UTC (rev 192156)
+++ trunk/Source/JavaScriptCore/runtime/JSPromisePrototype.h        2015-11-09 16:12:37 UTC (rev 192157)
</span><span class="lines">@@ -45,6 +45,9 @@
</span><span class="cx"> protected:
</span><span class="cx">     void finishCreation(VM&amp;, Structure*);
</span><span class="cx">     JSPromisePrototype(VM&amp;, Structure*);
</span><ins>+
+private:
+    void addOwnInternalSlots(VM&amp;, JSGlobalObject*);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (192156 => 192157)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-09 14:46:49 UTC (rev 192156)
+++ trunk/Source/WebCore/ChangeLog        2015-11-09 16:12:37 UTC (rev 192157)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2015-11-09  Xabier Rodriguez Calvar  &lt;calvaris@igalia.com&gt;
+
+        [Streams API] Shield implementation from mangling then and catch promise methods
+        https://bugs.webkit.org/show_bug.cgi?id=150934
+
+        Reviewed by Youenn Fablet.
+
+        This is a first step to get streams code shielded from user replacing the then and catch methods in our
+        promises. We use newly introduced @then and @catch prototype internal slots and that should solve a lot of use
+        cases.
+
+        Test: streams/streams-promises.html.
+
+        * Modules/streams/ReadableStream.js:
+        (initializeReadableStream):
+        * Modules/streams/ReadableStreamInternals.js:
+        (teeReadableStream):
+        (teeReadableStreamPullFunction):
+        (cancelReadableStream):
+        * Modules/streams/WritableStream.js:
+        (initializeWritableStream):
+        (abort):
+        * Modules/streams/WritableStreamInternals.js:
+        (callOrScheduleWritableStreamAdvanceQueue):
+
</ins><span class="cx"> 2015-11-09  Manuel Rego Casasnovas  &lt;rego@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [css-grid] Refactor cachedGridCoordinate() to cachedGridSpan()
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesstreamsReadableStreamjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/streams/ReadableStream.js (192156 => 192157)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/streams/ReadableStream.js        2015-11-09 14:46:49 UTC (rev 192156)
+++ trunk/Source/WebCore/Modules/streams/ReadableStream.js        2015-11-09 16:12:37 UTC (rev 192157)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> 
</span><span class="cx">     var result = @invokeOrNoop(underlyingSource, &quot;start&quot;, [this.@controller]);
</span><span class="cx">     var _this = this;
</span><del>-    @Promise.@resolve(result).then(function() {
</del><ins>+    @Promise.@resolve(result).@then(function() {
</ins><span class="cx">         _this.@started = true;
</span><span class="cx">         @requestReadableStreamPull(_this);
</span><span class="cx">     }, function(error) {
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesstreamsReadableStreamInternalsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js (192156 => 192157)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js        2015-11-09 14:46:49 UTC (rev 192156)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js        2015-11-09 16:12:37 UTC (rev 192157)
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx">     let branch1 = new ReadableStream(underlyingSource1);
</span><span class="cx">     let branch2 = new ReadableStream(underlyingSource2);
</span><span class="cx"> 
</span><del>-    reader.closed.catch(function(e) {
</del><ins>+    reader.closed.@catch(function(e) {
</ins><span class="cx">         if (teeState.closedOrErrored)
</span><span class="cx">             return;
</span><span class="cx">         @errorReadableStream(branch1, e);
</span><span class="lines">@@ -124,7 +124,7 @@
</span><span class="cx"> function teeReadableStreamPullFunction(teeState, reader, shouldClone)
</span><span class="cx"> {
</span><span class="cx">     return function() {
</span><del>-        reader.read().then(function(result) {
</del><ins>+        reader.read().@then(function(result) {
</ins><span class="cx">             if (result.done &amp;&amp; !teeState.closedOrErrored) {
</span><span class="cx">                 @closeReadableStream(teeState.branch1);
</span><span class="cx">                 @closeReadableStream(teeState.branch2);
</span><span class="lines">@@ -237,7 +237,7 @@
</span><span class="cx">     stream.@pulling = true;
</span><span class="cx"> 
</span><span class="cx">     var promise = @promiseInvokeOrNoop(stream.@underlyingSource, &quot;pull&quot;, [stream.@controller]);
</span><del>-    promise.then(function() {
</del><ins>+    promise.@then(function() {
</ins><span class="cx">         stream.@pulling = false;
</span><span class="cx">         if (stream.@pullAgain) {
</span><span class="cx">             stream.@pullAgain = false;
</span><span class="lines">@@ -280,7 +280,7 @@
</span><span class="cx">         return @Promise.@reject(stream.@storedError);
</span><span class="cx">     stream.@queue = @newQueue();
</span><span class="cx">     @finishClosingReadableStream(stream);
</span><del>-    return @promiseInvokeOrNoop(stream.@underlyingSource, &quot;cancel&quot;, [reason]).then(function() { });
</del><ins>+    return @promiseInvokeOrNoop(stream.@underlyingSource, &quot;cancel&quot;, [reason]).@then(function() { });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function finishClosingReadableStream(stream)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesstreamsWritableStreamjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/streams/WritableStream.js (192156 => 192157)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/streams/WritableStream.js        2015-11-09 14:46:49 UTC (rev 192156)
+++ trunk/Source/WebCore/Modules/streams/WritableStream.js        2015-11-09 16:12:37 UTC (rev 192157)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx">     var startResult = @invokeOrNoop(underlyingSink, &quot;start&quot;, [error]);
</span><span class="cx">     this.@startedPromise = @Promise.@resolve(startResult);
</span><span class="cx">     var _this = this;
</span><del>-    this.@startedPromise.then(function() {
</del><ins>+    this.@startedPromise.@then(function() {
</ins><span class="cx">         _this.@started = true;
</span><span class="cx">         _this.@startedPromise = undefined;
</span><span class="cx">     }, error);
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx"> 
</span><span class="cx">     const sinkAbortPromise = @promiseInvokeOrFallbackOrNoop(this.@underlyingSink, &quot;abort&quot;, [reason], &quot;close&quot;, []);
</span><span class="cx"> 
</span><del>-    return sinkAbortPromise.then(function() { return undefined; });
</del><ins>+    return sinkAbortPromise.@then(function() { return undefined; });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function close()
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesstreamsWritableStreamInternalsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/streams/WritableStreamInternals.js (192156 => 192157)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/streams/WritableStreamInternals.js        2015-11-09 14:46:49 UTC (rev 192156)
+++ trunk/Source/WebCore/Modules/streams/WritableStreamInternals.js        2015-11-09 16:12:37 UTC (rev 192157)
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx"> function callOrScheduleWritableStreamAdvanceQueue(stream)
</span><span class="cx"> {
</span><span class="cx">     if (!stream.@started)
</span><del>-        stream.@startedPromise.then(function() { @writableStreamAdvanceQueue(stream); });
</del><ins>+        stream.@startedPromise.@then(function() { @writableStreamAdvanceQueue(stream); });
</ins><span class="cx">     else
</span><span class="cx">         @writableStreamAdvanceQueue(stream);
</span><span class="cx"> 
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     stream.@writing = true;
</span><del>-    @promiseInvokeOrNoop(stream.@underlyingSink, &quot;write&quot;, [writeRecord.chunk]).then(
</del><ins>+    @promiseInvokeOrNoop(stream.@underlyingSink, &quot;write&quot;, [writeRecord.chunk]).@then(
</ins><span class="cx">         function() {
</span><span class="cx">             if (stream.@state === @streamErrored)
</span><span class="cx">                 return;
</span><span class="lines">@@ -123,7 +123,7 @@
</span><span class="cx"> {
</span><span class="cx">     // FIXME
</span><span class="cx">     // assert(stream.@state === @streamClosing);
</span><del>-    @promiseInvokeOrNoop(stream.@underlyingSink, &quot;close&quot;).then(
</del><ins>+    @promiseInvokeOrNoop(stream.@underlyingSink, &quot;close&quot;).@then(
</ins><span class="cx">         function() {
</span><span class="cx">             if (stream.@state === @streamErrored)
</span><span class="cx">                 return;
</span></span></pre>
</div>
</div>

</body>
</html>