Changeset 202565 in webkit


Ignore:
Timestamp:
Jun 28, 2016 8:10:50 AM (8 years ago)
Author:
adam.bergkvist@ericsson.com
Message:

WebRTC: Robustify 'this' type check in RTCPeerConnection JS built-ins
https://bugs.webkit.org/show_bug.cgi?id=158831

Reviewed by Youenn Fablet.

Source/WebCore:

Use @operations slot in RTCPeerConnection type check.

Updated results of existing test.

  • Modules/mediastream/RTCPeerConnection.js:

(initializeRTCPeerConnection):
Initialize @operations slot in constructor.

  • Modules/mediastream/RTCPeerConnectionInternals.js:

(isRTCPeerConnection):
Use @operations slot in type check.

LayoutTests:

  • fast/mediastream/RTCPeerConnection-js-built-ins-check-this-expected.txt:

Flip some result lines from FAIL to PASS. Clean out unnecessary tests (third set).

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202564 r202565  
     12016-06-28  Adam Bergkvist  <adam.bergkvist@ericsson.com>
     2
     3        WebRTC: Robustify 'this' type check in RTCPeerConnection JS built-ins
     4        https://bugs.webkit.org/show_bug.cgi?id=158831
     5
     6        Reviewed by Youenn Fablet.
     7
     8        * fast/mediastream/RTCPeerConnection-js-built-ins-check-this-expected.txt:
     9        Flip some result lines from FAIL to PASS. Clean out unnecessary tests (third set).
     10
    1112016-06-28  Frederic Wang  <fwang@igalia.com>
    212
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-js-built-ins-check-this-expected.txt

    r202130 r202565  
    1010PASS promise webkitRTCPeerConnection.prototype.addIceCandidate.call({}) rejected with TypeError: Function should be called on an RTCPeerConnection
    1111PASS promise webkitRTCPeerConnection.prototype.getStats.call({}, null) rejected with TypeError: Function should be called on an RTCPeerConnection
    12 FAIL promise objectWithPcPrototype.createOffer() rejected with TypeError: Can only call RTCPeerConnection.queuedCreateOffer on instances of RTCPeerConnection; expected reason TypeError: Function should be called on an RTCPeerConnection
    13 FAIL promise objectWithPcPrototype.createAnswer() rejected with TypeError: Can only call RTCPeerConnection.queuedCreateAnswer on instances of RTCPeerConnection; expected reason TypeError: Function should be called on an RTCPeerConnection
    14 FAIL promise objectWithPcPrototype.setLocalDescription() rejected with TypeError: Not enough arguments; expected reason TypeError: Function should be called on an RTCPeerConnection
    15 FAIL promise objectWithPcPrototype.setRemoteDescription() rejected with TypeError: Not enough arguments; expected reason TypeError: Function should be called on an RTCPeerConnection
    16 FAIL promise objectWithPcPrototype.addIceCandidate() rejected with TypeError: Not enough arguments; expected reason TypeError: Function should be called on an RTCPeerConnection
    17 FAIL promise objectWithPcPrototype.getStats() rejected with TypeError: Can only call RTCPeerConnection.privateGetStats on instances of RTCPeerConnection; expected reason TypeError: Function should be called on an RTCPeerConnection
    18 FAIL promise pcWithEmptyPrototype.createOffer() fulfilled unexpectedly.
    19 FAIL promise pcWithEmptyPrototype.createAnswer() rejected with Error: InvalidStateError: DOM Exception 11; expected reason TypeError: Function should be called on an RTCPeerConnection
    20 FAIL promise pcWithEmptyPrototype.setLocalDescription() rejected with TypeError: Not enough arguments; expected reason TypeError: Function should be called on an RTCPeerConnection
    21 FAIL promise pcWithEmptyPrototype.setRemoteDescription() rejected with TypeError: Not enough arguments; expected reason TypeError: Function should be called on an RTCPeerConnection
    22 FAIL promise pcWithEmptyPrototype.addIceCandidate() rejected with TypeError: Not enough arguments; expected reason TypeError: Function should be called on an RTCPeerConnection
    23 FAIL promise pcWithEmptyPrototype.getStats() rejected with Error: NotSupportedError: DOM Exception 9; expected reason TypeError: Function should be called on an RTCPeerConnection
     12PASS promise objectWithPcPrototype.createOffer() rejected with TypeError: Function should be called on an RTCPeerConnection
     13PASS promise objectWithPcPrototype.createAnswer() rejected with TypeError: Function should be called on an RTCPeerConnection
     14PASS promise objectWithPcPrototype.setLocalDescription() rejected with TypeError: Function should be called on an RTCPeerConnection
     15PASS promise objectWithPcPrototype.setRemoteDescription() rejected with TypeError: Function should be called on an RTCPeerConnection
     16PASS promise objectWithPcPrototype.addIceCandidate() rejected with TypeError: Function should be called on an RTCPeerConnection
     17PASS promise objectWithPcPrototype.getStats() rejected with TypeError: Function should be called on an RTCPeerConnection
    2418PASS End of test promise chain
    2519PASS successfullyParsed is true
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-js-built-ins-check-this.html

    r202130 r202565  
    1515            let objectWithPcPrototype = new Foo();
    1616
    17             webkitRTCPeerConnection.prototype = {};
    18             let pcWithEmptyPrototype = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    19 
    2017            promiseShouldReject("webkitRTCPeerConnection.prototype.createOffer.call({})", "reason")
    2118            .then(() => promiseShouldReject("webkitRTCPeerConnection.prototype.createAnswer.call({})", "reason"))
     
    2522            .then(() => promiseShouldReject("webkitRTCPeerConnection.prototype.getStats.call({}, null)", "reason"))
    2623
    27             // Tests are expected to fail below this point: http://webkit.org/b/158831
    2824            .then(() => promiseShouldReject("objectWithPcPrototype.createOffer()", "reason"))
    2925            .then(() => promiseShouldReject("objectWithPcPrototype.createAnswer()", "reason"))
     
    3228            .then(() => promiseShouldReject("objectWithPcPrototype.addIceCandidate()", "reason"))
    3329            .then(() => promiseShouldReject("objectWithPcPrototype.getStats()", "reason"))
    34 
    35             .then(() => promiseShouldReject("pcWithEmptyPrototype.createOffer()", "reason"))
    36             .then(() => promiseShouldReject("pcWithEmptyPrototype.createAnswer()", "reason"))
    37             .then(() => promiseShouldReject("pcWithEmptyPrototype.setLocalDescription()", "reason"))
    38             .then(() => promiseShouldReject("pcWithEmptyPrototype.setRemoteDescription()", "reason"))
    39             .then(() => promiseShouldReject("pcWithEmptyPrototype.addIceCandidate()", "reason"))
    40             .then(() => promiseShouldReject("pcWithEmptyPrototype.getStats()", "reason"))
    4130
    4231            .then(() => {
  • trunk/Source/WebCore/ChangeLog

    r202562 r202565  
     12016-06-28  Adam Bergkvist  <adam.bergkvist@ericsson.com>
     2
     3        WebRTC: Robustify 'this' type check in RTCPeerConnection JS built-ins
     4        https://bugs.webkit.org/show_bug.cgi?id=158831
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Use @operations slot in RTCPeerConnection type check.
     9
     10        Updated results of existing test.
     11
     12        * Modules/mediastream/RTCPeerConnection.js:
     13        (initializeRTCPeerConnection):
     14        Initialize @operations slot in constructor.
     15        * Modules/mediastream/RTCPeerConnectionInternals.js:
     16        (isRTCPeerConnection):
     17        Use @operations slot in type check.
     18
    1192016-06-28  Frederic Wang  <fwang@igalia.com>
    220
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js

    r202376 r202565  
    5050    }
    5151
     52    this.@operations = [];
    5253    this.@localStreams = [];
    5354
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js

    r202130 r202565  
    3636{
    3737    "use strict";
    38 
    39     if (!peerConnection.@operations)
    40         peerConnection.@operations = [];
    4138
    4239    const operations = peerConnection.@operations;
     
    134131    "use strict";
    135132
    136     // FIXME: Robustify this check (http://webkit.org/b/158831)
    137     return @isObject(connection) && !!connection.@queuedCreateOffer;
     133    return @isObject(connection) && !!connection.@operations;
    138134}
Note: See TracChangeset for help on using the changeset viewer.