<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:youennf&#64;gmail.com" title="youenn fablet &lt;youennf&#64;gmail.com&gt;"> <span class="fn">youenn fablet</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - WebRTC: Update RTCPeerConnection API and introduce PeerConnectionBackend"
   href="https://bugs.webkit.org/show_bug.cgi?id=150166">bug 150166</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>RESOLVED
           </td>
           <td>UNCONFIRMED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>FIXED
           </td>
           <td>---
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Ever confirmed</td>
           <td>1
           </td>
           <td>
               &nbsp;
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - WebRTC: Update RTCPeerConnection API and introduce PeerConnectionBackend"
   href="https://bugs.webkit.org/show_bug.cgi?id=150166#c38">Comment # 38</a>
              on <a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - WebRTC: Update RTCPeerConnection API and introduce PeerConnectionBackend"
   href="https://bugs.webkit.org/show_bug.cgi?id=150166">bug 150166</a>
              from <span class="vcard"><a class="email" href="mailto:youennf&#64;gmail.com" title="youenn fablet &lt;youennf&#64;gmail.com&gt;"> <span class="fn">youenn fablet</span></a>
</span></b>
        <pre>Nice to see this patch landed.

<span class="quote">&gt; &gt; &gt; Source/WebCore/Modules/mediastream/RTCPeerConnection.js:36
&gt; &gt; &gt; +
&gt; &gt; 
&gt; &gt; For all these functions, we should somehow check that &quot;this&quot; has the right
&gt; &gt; type.
&gt; &gt; We should work on that in the future.
&gt; 
&gt; Would it be sufficient to do &#64;isObject() and check for one of the [Private]
&gt; function symbols? For example &#64;queuedCreateOffer? Perhaps we can do this is
&gt; a follow-up patch?</span >

Checking that &#64;queuedCreateOffer exists currently means that the object prototype is not modified by user scripts.
I think C++ implemented APIs work on instances even if their prototypes are changed.
I am not sure whether we should move these private functions to instance slots or not.

<span class="quote">&gt; &gt; &gt; Source/WebCore/Modules/mediastream/RTCPeerConnection.js:74
&gt; &gt; &gt; +    if (arguments.length == 1) {
&gt; &gt; 
&gt; &gt; It would be good to have a test for that behavior (one arg -&gt; promise, more
&gt; &gt; than one arg, legacy callbacks).
&gt; &gt; It may happen that future patches break that behavior without noticing it.
&gt; 
&gt; We can check the return value to see which version was called. I can make a
&gt; bug on it so it's not forgotten.</span >

Sounds good, especially if it ends up being part of WebRTC W3C test suite.
This would ensure every browser has the same understanding.

<span class="quote">&gt; &gt; &gt; Source/WebCore/Modules/mediastream/RTCPeerConnection.js:118
&gt; &gt; &gt; +    peerConnection.&#64;privateGetStats(selector).then(successCallback, errorCallback);
&gt; &gt; 
&gt; &gt; You might want to check whether the direct use of then is appropriate.
&gt; &gt; A user script may modify Promise prototype and its then function.
&gt; &gt; &#64;Promise.prototype.&#64;then.&#64;call is (unfortunately less readable but) safer.
&gt; 
&gt; This is indeed a problem. However I suspect using
&gt; &#64;Promise.prototype.then.&#64;call only helps if the user has modifies then() on
&gt; an instance, not if the actual prototype function is modified. And since the
&gt; bindings only calls then() on internal promise instances created inside the
&gt; binding, using the prototype-call only complicates syntax without any real
&gt; benefit. We should have a general solution for this.</span >

A user script may decide to change the Promise prototype, in which case all promises instances will be affected, hence the unsafe use of then.

We could use InternalPromise for private methods.
But we need to ensure that we never expose any InternalPromise instance to user scripts.

Agreed on the need for a better more general solution.

<span class="quote">&gt; 
&gt; &gt; &gt; Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js:32
&gt; &gt; &gt; +// &#64;internal
&gt; &gt; 
&gt; &gt; How do you expose these internal functions to JS built-ins?
&gt; &gt; I would expect changes within JSDOMWindowBase::finishCreation to do that
&gt; &gt; explicitly.
&gt;  
&gt; The plan is to have that done in a follow-up patch. The license of
&gt; JSDOMWindowBase prevents me from changing it. :/</span >

If that is stopping you from progressing, please drop me a word.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>