Closed Bug 1186142 Opened 10 years ago Closed 10 years ago

TypeError on PeerConnection.getStats() with no arguments.

Categories

(Core :: WebRTC, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: jib, Assigned: jib)

References

()

Details

Attachments

(1 file)

STR: 'use strict'; new mozRTCPeerConnection().getStats().catch(e => console.error(e)); Expected result: success Actual result: TypeError: Not enough arguments to mozRTCPeerConnection.getStats. Regular non-strict mode saves us, because undefined gets promoted to null there, and since the argument is nullable, the right call signature (the promise one) is chosen, the call is called and succeeds. The selector argument to getStats needs to be nullable AND optional to work in strict mode. The spec has this (see URL), so we just need to update our webidl to fix this.
Bug 1186142 - Make selector arg optional on PeerConnection.getStats().
Attachment #8636780 - Flags: review?(bzbarsky)
Comment on attachment 8636780 [details] MozReview Request: Bug 1186142 - Make selector arg optional on PeerConnection.getStats(). https://reviewboard.mozilla.org/r/13705/#review12549 I don't see what strict mode has to do with this. In non-strict mode you get the same behavior: <script> new mozRTCPeerConnection().getStats().catch(e => console.error(e)); </script> logs an error. The spec's language also doesn't make sense to me; it never handles the "not passed" case. It should probably have null as default value and change the check for an invalid selector to not happen if the value is null. Please file a spec issue to that effect? r=me
Attachment #8636780 - Flags: review?(bzbarsky) → review+
You're right. Pilot error on my part (I was thrown by pc.getStats(); suppressing errors). PR for spec changes here https://github.com/w3c/webrtc-pc/pull/256 Thanks!
Summary: TypeError on PeerConnection.getStats() with no arguments in strict mode. → TypeError on PeerConnection.getStats() with no arguments.
backlog: --- → webRTC+
Rank: 19
Priority: -- → P1
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: