Title: [202810] trunk
Revision
202810
Author
[email protected]
Date
2016-07-04 11:31:37 -0700 (Mon, 04 Jul 2016)

Log Message

Shield WebRTC JS built-ins from user scripts
https://bugs.webkit.org/show_bug.cgi?id=155964

Patch by Youenn Fablet <[email protected]> on 2016-07-04
Reviewed by Sam Weinig.

Source/WebCore:

Making use of Promise.prototype.@then instead of Promise.prototype.then.
Covered by updated tests.

* Modules/mediastream/RTCPeerConnection.js:
(createOffer):
(createAnswer):
(setLocalDescription):
(setRemoteDescription):
(addIceCandidate):
(getStats):
* Modules/mediastream/RTCPeerConnectionInternals.js:
(enqueueOperation):

LayoutTests:

* fast/mediastream/RTCPeerConnection-createOffer.html:
* fast/mediastream/RTCPeerConnection-stable.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (202809 => 202810)


--- trunk/LayoutTests/ChangeLog	2016-07-04 15:30:50 UTC (rev 202809)
+++ trunk/LayoutTests/ChangeLog	2016-07-04 18:31:37 UTC (rev 202810)
@@ -1,3 +1,13 @@
+2016-07-04  Youenn Fablet  <[email protected]>
+
+        Shield WebRTC JS built-ins from user scripts
+        https://bugs.webkit.org/show_bug.cgi?id=155964
+
+        Reviewed by Sam Weinig.
+
+        * fast/mediastream/RTCPeerConnection-createOffer.html:
+        * fast/mediastream/RTCPeerConnection-stable.html:
+
 2016-07-04  Yusuke Suzuki  <[email protected]>
 
         Unreviewed, skip misc-bugs-847389-jpeg2000.js in jsc stress tests

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer.html (202809 => 202810)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer.html	2016-07-04 15:30:50 UTC (rev 202809)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer.html	2016-07-04 18:31:37 UTC (rev 202810)
@@ -7,6 +7,13 @@
         <script>
             description("Tests RTCPeerConnection createOffer.");
 
+            // Let's ensure built-ins are shielded from user scripts
+            var thenPromise = Promise.prototype.then;
+            Promise.prototype.then = function() {
+                console.log("Promise.prototype.then is called internally");
+                return thenPromise.apply(this, arguments);
+            }
+
             var pc = null;
 
             function requestSucceeded3(sd)

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stable.html (202809 => 202810)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stable.html	2016-07-04 15:30:50 UTC (rev 202809)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stable.html	2016-07-04 18:31:37 UTC (rev 202810)
@@ -9,6 +9,13 @@
 
             var pc = null;
 
+            // Let's ensure built-ins are shielded from user scripts
+            var thenPromise = Promise.prototype.then;
+            Promise.prototype.then = function() {
+                console.log("Promise.prototype.then is called internally");
+                return thenPromise.apply(this, arguments);
+            }
+
             function requestSucceeded2()
             {
                 testPassed('setRemoteDescription succeeded.');

Modified: trunk/Source/WebCore/ChangeLog (202809 => 202810)


--- trunk/Source/WebCore/ChangeLog	2016-07-04 15:30:50 UTC (rev 202809)
+++ trunk/Source/WebCore/ChangeLog	2016-07-04 18:31:37 UTC (rev 202810)
@@ -1,3 +1,23 @@
+2016-07-04  Youenn Fablet  <[email protected]>
+
+        Shield WebRTC JS built-ins from user scripts
+        https://bugs.webkit.org/show_bug.cgi?id=155964
+
+        Reviewed by Sam Weinig.
+
+        Making use of Promise.prototype.@then instead of Promise.prototype.then.
+        Covered by updated tests.
+
+        * Modules/mediastream/RTCPeerConnection.js:
+        (createOffer):
+        (createAnswer):
+        (setLocalDescription):
+        (setRemoteDescription):
+        (addIceCandidate):
+        (getStats):
+        * Modules/mediastream/RTCPeerConnectionInternals.js:
+        (enqueueOperation):
+
 2016-07-04  Brady Eidson  <[email protected]>
 
         WebProcesses don't handle DatabaseProcess going away uncleanly..

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js (202809 => 202810)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js	2016-07-04 15:30:50 UTC (rev 202809)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js	2016-07-04 18:31:37 UTC (rev 202810)
@@ -146,7 +146,7 @@
     }, function (successCallback, errorCallback, options) {
         // Legacy callbacks mode
         @enqueueOperation(peerConnection, function () {
-            return peerConnection.@queuedCreateOffer(options).then(successCallback, errorCallback);
+            return peerConnection.@queuedCreateOffer(options).@then(successCallback, errorCallback);
         });
 
         return @Promise.@resolve(@undefined);
@@ -170,7 +170,7 @@
     }, function (successCallback, errorCallback, options) {
         // Legacy callbacks mode
         @enqueueOperation(peerConnection, function () {
-            return peerConnection.@queuedCreateAnswer(options).then(successCallback, errorCallback);
+            return peerConnection.@queuedCreateAnswer(options).@then(successCallback, errorCallback);
         });
 
         return @Promise.@resolve(@undefined);
@@ -199,7 +199,7 @@
     }, function (description, successCallback, errorCallback) {
         // Legacy callbacks mode
         @enqueueOperation(peerConnection, function () {
-            return peerConnection.@queuedSetLocalDescription(description).then(successCallback, errorCallback);
+            return peerConnection.@queuedSetLocalDescription(description).@then(successCallback, errorCallback);
         });
 
         return @Promise.@resolve(@undefined);
@@ -228,7 +228,7 @@
     }, function (description, successCallback, errorCallback) {
         // Legacy callbacks mode
         @enqueueOperation(peerConnection, function () {
-            return peerConnection.@queuedSetRemoteDescription(description).then(successCallback, errorCallback);
+            return peerConnection.@queuedSetRemoteDescription(description).@then(successCallback, errorCallback);
         });
 
         return @Promise.@resolve(@undefined);
@@ -257,7 +257,7 @@
     }, function (candidate, successCallback, errorCallback) {
         // Legacy callbacks mode
         @enqueueOperation(peerConnection, function () {
-            return peerConnection.@queuedAddIceCandidate(candidate).then(successCallback, errorCallback);
+            return peerConnection.@queuedAddIceCandidate(candidate).@then(successCallback, errorCallback);
         });
 
         return @Promise.@resolve(@undefined);
@@ -284,7 +284,7 @@
         return peerConnection.@privateGetStats(selector);
     }, function (selector, successCallback, errorCallback) {
         // Legacy callbacks mode
-        peerConnection.@privateGetStats(selector).then(successCallback, errorCallback);
+        peerConnection.@privateGetStats(selector).@then(successCallback, errorCallback);
 
         return @Promise.@resolve(@undefined);
     });

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js (202809 => 202810)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js	2016-07-04 15:30:50 UTC (rev 202809)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js	2016-07-04 18:31:37 UTC (rev 202810)
@@ -46,7 +46,7 @@
 
     return new @Promise(function (resolve, reject) {
         operations.@push(function() {
-            operation().then(resolve, reject).then(runNext, runNext);
+            operation().@then(resolve, reject).@then(runNext, runNext);
         });
 
         if (operations.length == 1)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to