Closed Bug 780805 Opened 12 years ago Closed 9 years ago

Passing a null value into the first parameter of mozGetUserMedia - NS_ERROR_INVALID_POINTER is thrown, instead of a graceful failure

Categories

(Core :: WebRTC, defect, P4)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1161433

People

(Reporter: jsmith, Unassigned)

Details

JS:

function successStream(stream) {
	alert("Success: " + stream);
}

function failStream(err) {
	alert("Failure: " + err);
}

function main()
{
    navigator.mozGetUserMedia(null, successStream, failStream);
}

Expected:

We should handle this gracefully when a null value is passed into the first parameter without dumping a nasty error in the error console.

Actual:

Nasty failure is seen in the error logs:

Timestamp: 8/6/2012 8:10:24 PM
Error: NS_ERROR_INVALID_POINTER: Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMNavigatorUserMedia.mozGetUserMedia]
Source File: file:///C:/Users/jsmith/Documents/Camera%20API/Simple%20Scratchpad.html
Line: 16

We should really try to handle this gracefully.
Whiteboard: [getUserMedia], [blocking-gum+]
Whiteboard: [getUserMedia], [blocking-gum+] → [getUserMedia], [blocking-gum-]
I'm closing this as invalid as apparently this is normal behavior for most DOM APIs upon further investigation.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
getUserMedia(null, ...) shouldn't throw because the first argument of getUserMedia is nullable.
http://dev.w3.org/2011/webrtc/editor/getusermedia.html#navigatorusermedia
But this WebIDL definition is invalid because dictionary types cannot be nullable.
http://dev.w3.org/2006/webapi/WebIDL/#dfn-nullable-type
That said, a dictionary argument will accept null value even if it is not nullable.
http://dev.w3.org/2006/webapi/WebIDL/#es-dictionary
In conclusion, the spec should change |MediaStreamConstraints? constraints| to |MediaStreamConstraints constraints| and we should handle the null argument gracefully.
Fair enough, I'll reopen to track then.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Blocks: webrtc-tests
No longer blocks: webrtc-tests
Are we correct per spec currently?
backlog: --- → webRTC+
Rank: 45
Flags: needinfo?(jib)
Priority: -- → P4
QA Contact: jsmith
Whiteboard: [getUserMedia], [blocking-gum-]
Yes.
Status: REOPENED → RESOLVED
Closed: 12 years ago9 years ago
Flags: needinfo?(jib)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.