[Streams API] Shield streams against user replacing the Promise constructor
[WebKit-https.git] / Source / WebCore / Modules / streams / ReadableStream.js
index a36a68be281c1bf735dbab71742f711619662b25..785a55d1edc7f9271ebc5357b884d17c354b17a4 100644 (file)
@@ -56,7 +56,7 @@ function initializeReadableStream(underlyingSource, strategy)
 
     var result = @invokeOrNoop(underlyingSource, "start", [this.@controller]);
     var _this = this;
-    Promise.resolve(result).then(function() {
+    @Promise.resolve(result).then(function() {
         _this.@started = true;
         @requestReadableStreamPull(_this);
     }, function(error) {
@@ -72,10 +72,10 @@ function cancel(reason)
     "use strict";
 
     if (!@isReadableStream(this))
-        return Promise.reject(new @TypeError("Function should be called on a ReadableStream"));
+        return @Promise.reject(new @TypeError("Function should be called on a ReadableStream"));
 
     if (@isReadableStreamLocked(this))
-        return Promise.reject(new @TypeError("ReadableStream is locked"));
+        return @Promise.reject(new @TypeError("ReadableStream is locked"));
 
     return @cancelReadableStream(this, reason);
 }