Changeset 202130 in webkit


Ignore:
Timestamp:
Jun 16, 2016 11:12:41 AM (8 years ago)
Author:
adam.bergkvist@ericsson.com
Message:

WebRTC: Check type of this in RTCPeerConnection JS built-in functions
https://bugs.webkit.org/show_bug.cgi?id=151303

Reviewed by Youenn Fablet.

Source/WebCore:

Check type of 'this' in RTCPeerConnection JS built-in functions.

Test: fast/mediastream/RTCPeerConnection-js-built-ins-check-this.html

  • Modules/mediastream/RTCPeerConnection.js:

(createOffer):
(createAnswer):
(setLocalDescription):
(setRemoteDescription):
(addIceCandidate):
(getStats):
Reject if 'this' isn't of type RTCPeerConnection.

  • Modules/mediastream/RTCPeerConnectionInternals.js:

(isRTCPeerConnection):
Add helper function to perform type check. Needs further robustifying.

LayoutTests:

Verify that the RTCPeerConnection JS built-in methods checks 'this'. The test has expected
failures (bug: http://webkit.org/b/158831).

  • fast/mediastream/RTCPeerConnection-js-built-ins-check-this-expected.txt: Added.
  • fast/mediastream/RTCPeerConnection-js-built-ins-check-this.html: Added.
  • platform/mac/TestExpectations:

The mac port does not build with WEB_RTC enabled yet.

Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202128 r202130  
     12016-06-16  Adam Bergkvist  <adam.bergkvist@ericsson.com>
     2
     3        WebRTC: Check type of this in RTCPeerConnection JS built-in functions
     4        https://bugs.webkit.org/show_bug.cgi?id=151303
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Verify that the RTCPeerConnection JS built-in methods checks 'this'. The test has expected
     9        failures (bug: http://webkit.org/b/158831).
     10
     11        * fast/mediastream/RTCPeerConnection-js-built-ins-check-this-expected.txt: Added.
     12        * fast/mediastream/RTCPeerConnection-js-built-ins-check-this.html: Added.
     13        * platform/mac/TestExpectations:
     14        The mac port does not build with WEB_RTC enabled yet.
     15
    1162016-06-16  Dean Jackson  <dino@apple.com>
    217
  • trunk/LayoutTests/platform/mac/TestExpectations

    r202117 r202130  
    186186fast/mediastream/RTCPeerConnection-stable.html
    187187fast/mediastream/RTCPeerConnection.html
     188fast/mediastream/RTCPeerConnection-js-built-ins-check-this.html
    188189fast/mediastream/RTCPeerConnection-inspect-offer.html
    189190fast/mediastream/RTCPeerConnection-add-removeTrack.html
  • trunk/Source/WebCore/ChangeLog

    r202127 r202130  
     12016-06-16  Adam Bergkvist  <adam.bergkvist@ericsson.com>
     2
     3        WebRTC: Check type of this in RTCPeerConnection JS built-in functions
     4        https://bugs.webkit.org/show_bug.cgi?id=151303
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Check type of 'this' in RTCPeerConnection JS built-in functions.
     9
     10        Test: fast/mediastream/RTCPeerConnection-js-built-ins-check-this.html
     11
     12        * Modules/mediastream/RTCPeerConnection.js:
     13        (createOffer):
     14        (createAnswer):
     15        (setLocalDescription):
     16        (setRemoteDescription):
     17        (addIceCandidate):
     18        (getStats):
     19        Reject if 'this' isn't of type RTCPeerConnection.
     20        * Modules/mediastream/RTCPeerConnectionInternals.js:
     21        (isRTCPeerConnection):
     22        Add helper function to perform type check. Needs further robustifying.
     23
    1242016-06-16  Myles C. Maxfield  <mmaxfield@apple.com>
    225
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js

    r201455 r202130  
    3535    "use strict";
    3636
     37    if (!@isRTCPeerConnection(this))
     38        return @Promise.@reject(new @TypeError("Function should be called on an RTCPeerConnection"));
     39
    3740    const peerConnection = this;
    3841
     
    5659    "use strict";
    5760
     61    if (!@isRTCPeerConnection(this))
     62        return @Promise.@reject(new @TypeError("Function should be called on an RTCPeerConnection"));
     63
    5864    const peerConnection = this;
    5965
     
    7682{
    7783    "use strict";
     84
     85    if (!@isRTCPeerConnection(this))
     86        return @Promise.@reject(new @TypeError("Function should be called on an RTCPeerConnection"));
    7887
    7988    const peerConnection = this;
     
    103112    "use strict";
    104113
     114    if (!@isRTCPeerConnection(this))
     115        return @Promise.@reject(new @TypeError("Function should be called on an RTCPeerConnection"));
     116
    105117    const peerConnection = this;
    106118
     
    128140{
    129141    "use strict";
     142
     143    if (!@isRTCPeerConnection(this))
     144        return @Promise.@reject(new @TypeError("Function should be called on an RTCPeerConnection"));
    130145
    131146    const peerConnection = this;
     
    155170    "use strict";
    156171
     172    if (!@isRTCPeerConnection(this))
     173        return @Promise.@reject(new @TypeError("Function should be called on an RTCPeerConnection"));
     174
    157175    const peerConnection = this;
    158176
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js

    r201455 r202130  
    129129    return legacyMode(successCallback, errorCallback, args[2]);
    130130}
     131
     132function isRTCPeerConnection(connection)
     133{
     134    "use strict";
     135
     136    // FIXME: Robustify this check (http://webkit.org/b/158831)
     137    return @isObject(connection) && !!connection.@queuedCreateOffer;
     138}
Note: See TracChangeset for help on using the changeset viewer.