Closed Bug 859612 Opened 11 years ago Closed 6 years ago

mozCameras API - return undefined if the API is unsupported on the platform, not null

Categories

(Core :: DOM: Device Interfaces, defect)

defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: jsmith, Unassigned)

References

Details

See the discussion on bug 859554 for context. Any WebAPI that is not supported on a platform should return undefined, not null. null is only returned if the API is supported on the platform, but the web content does not have access to that API.
Blocks: 859554
blocking-b2g: --- → tef?
Actually, this doesn't need to block tef. The changes required here would be needed for desktop and android primarily.
blocking-b2g: tef? → ---
Component: General → DOM: Device Interfaces
Product: Boot2Gecko → Core
Version: unspecified → Trunk
How is this usually done?  Is there a handy return value, or do I need to change:

NS_IMETHODIMP
Navigator::GetMozCameras(nsIDOMCameraManager** aCameraManager)

...to return a a JS::Value that I can set to JSVAL_VOID [1]?

1. http://mxr.mozilla.org/mozilla-central/source/js/public/Value.h#851
I'll redirect to Doug on your question in comment 2.
Flags: needinfo?(doug.turner)
Mike, what about just guarding that with #ifdef MOZ_B2G since we only have support there?
correct.  this change should be uplifted though -- we want to make sure that we don't expose this API on desktop or mobile.
Flags: needinfo?(doug.turner)
Assignee: nobody → mhabicher
Status: NEW → ASSIGNED
Do you think it would be worth having a mochitest that runs on desktop to verify that the api is not exposed ?
(In reply to dclarke@mozilla.com  [:onecyrenus] from comment #6)
> Do you think it would be worth having a mochitest that runs on desktop to
> verify that the api is not exposed ?

Yup, we should do that.
I assume the mochitest change won't land without this change?  Else we'll need to revisit prioritization of this bug.
(In reply to Jason Smith [:jsmith] from comment #7)
> (In reply to dclarke@mozilla.com  [:onecyrenus] from comment #6)
> > Do you think it would be worth having a mochitest that runs on desktop to
> > verify that the api is not exposed ?
> 
> Yup, we should do that.

Can we get a followup bug filed for this?

What happened with this bug?  I don't see that anything related ever landed in my repo.
Too busy with blocking issues. If someone wants to tackle this, go ahead; else I'll get to it when I can.
Assignee: mhabicher → nobody
Cleaning up Device Interfaces component, and mass-marking old FxOS bugs as incomplete.

If any of these bugs are still valid, please let me know.
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.