Changeset 202810 in webkit


Ignore:
Timestamp:
Jul 4, 2016 11:31:37 AM (8 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Youenn Fablet <youenn@apple.com> 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:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202805 r202810  
     12016-07-04  Youenn Fablet  <youenn@apple.com>
     2
     3        Shield WebRTC JS built-ins from user scripts
     4        https://bugs.webkit.org/show_bug.cgi?id=155964
     5
     6        Reviewed by Sam Weinig.
     7
     8        * fast/mediastream/RTCPeerConnection-createOffer.html:
     9        * fast/mediastream/RTCPeerConnection-stable.html:
     10
    1112016-07-04  Yusuke Suzuki  <utatane.tea@gmail.com>
    212
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer.html

    r165226 r202810  
    77        <script>
    88            description("Tests RTCPeerConnection createOffer.");
     9
     10            // Let's ensure built-ins are shielded from user scripts
     11            var thenPromise = Promise.prototype.then;
     12            Promise.prototype.then = function() {
     13                console.log("Promise.prototype.then is called internally");
     14                return thenPromise.apply(this, arguments);
     15            }
    916
    1017            var pc = null;
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stable.html

    r164602 r202810  
    99
    1010            var pc = null;
     11
     12            // Let's ensure built-ins are shielded from user scripts
     13            var thenPromise = Promise.prototype.then;
     14            Promise.prototype.then = function() {
     15                console.log("Promise.prototype.then is called internally");
     16                return thenPromise.apply(this, arguments);
     17            }
    1118
    1219            function requestSucceeded2()
  • trunk/Source/WebCore/ChangeLog

    r202809 r202810  
     12016-07-04  Youenn Fablet  <youenn@apple.com>
     2
     3        Shield WebRTC JS built-ins from user scripts
     4        https://bugs.webkit.org/show_bug.cgi?id=155964
     5
     6        Reviewed by Sam Weinig.
     7
     8        Making use of Promise.prototype.@then instead of Promise.prototype.then.
     9        Covered by updated tests.
     10
     11        * Modules/mediastream/RTCPeerConnection.js:
     12        (createOffer):
     13        (createAnswer):
     14        (setLocalDescription):
     15        (setRemoteDescription):
     16        (addIceCandidate):
     17        (getStats):
     18        * Modules/mediastream/RTCPeerConnectionInternals.js:
     19        (enqueueOperation):
     20
    1212016-07-04  Brady Eidson  <beidson@apple.com>
    222
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js

    r202565 r202810  
    147147        // Legacy callbacks mode
    148148        @enqueueOperation(peerConnection, function () {
    149             return peerConnection.@queuedCreateOffer(options).then(successCallback, errorCallback);
     149            return peerConnection.@queuedCreateOffer(options).@then(successCallback, errorCallback);
    150150        });
    151151
     
    171171        // Legacy callbacks mode
    172172        @enqueueOperation(peerConnection, function () {
    173             return peerConnection.@queuedCreateAnswer(options).then(successCallback, errorCallback);
     173            return peerConnection.@queuedCreateAnswer(options).@then(successCallback, errorCallback);
    174174        });
    175175
     
    200200        // Legacy callbacks mode
    201201        @enqueueOperation(peerConnection, function () {
    202             return peerConnection.@queuedSetLocalDescription(description).then(successCallback, errorCallback);
     202            return peerConnection.@queuedSetLocalDescription(description).@then(successCallback, errorCallback);
    203203        });
    204204
     
    229229        // Legacy callbacks mode
    230230        @enqueueOperation(peerConnection, function () {
    231             return peerConnection.@queuedSetRemoteDescription(description).then(successCallback, errorCallback);
     231            return peerConnection.@queuedSetRemoteDescription(description).@then(successCallback, errorCallback);
    232232        });
    233233
     
    258258        // Legacy callbacks mode
    259259        @enqueueOperation(peerConnection, function () {
    260             return peerConnection.@queuedAddIceCandidate(candidate).then(successCallback, errorCallback);
     260            return peerConnection.@queuedAddIceCandidate(candidate).@then(successCallback, errorCallback);
    261261        });
    262262
     
    285285    }, function (selector, successCallback, errorCallback) {
    286286        // Legacy callbacks mode
    287         peerConnection.@privateGetStats(selector).then(successCallback, errorCallback);
    288 
    289         return @Promise.@resolve(@undefined);
    290     });
    291 }
     287        peerConnection.@privateGetStats(selector).@then(successCallback, errorCallback);
     288
     289        return @Promise.@resolve(@undefined);
     290    });
     291}
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js

    r202565 r202810  
    4747    return new @Promise(function (resolve, reject) {
    4848        operations.@push(function() {
    49             operation().then(resolve, reject).then(runNext, runNext);
     49            operation().@then(resolve, reject).@then(runNext, runNext);
    5050        });
    5151
Note: See TracChangeset for help on using the changeset viewer.