Closed Bug 1288600 Opened 6 years ago Closed 6 years ago

[Presentation WebAPI] No available device, return NotFoundError exception

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla51
blocking-b2g 2.6+
Tracking Status
firefox51 --- fixed

People

(Reporter: twen, Assigned: schien)

References

Details

(Whiteboard: [ETA 8/19])

Attachments

(1 file, 1 obsolete file)

According to https://www.w3.org/TR/presentation-api/#starting-a-presentation
10. If either of the following is true:
     1. The list of available presentation displays is empty and will remain so before the request for user permission is completed.
    ...
   Then run the following steps:
     1. Reject P with a NotFoundError exception.
     2. Abort all remaining steps.

If there is no device available for presentation display, WebAPI should return NotFoundError.
blocking-b2g: --- → 2.6?
@Teri can you upload or link your test case to this bug?
Flags: needinfo?(twen)
STR:
1. Make sure no device is in the environment
2. Try to launch a presentation

Expected Behavior:
Return NotFoundError and abort

Actual Behavior:
>>start error: AbortError: The operation was aborted.
Flags: needinfo?(twen)
Ok, this line of code should be responsible: https://dxr.mozilla.org/mozilla-central/source/dom/presentation/PresentationService.cpp#178

This part of spec is changed after our first implementation.
In order to fulfill the step #10 and #11 of the start session procedure, we'll need PresentationDevicePrompt to provide error cause while canceling the prompt request.
Assignee: nobody → schien
1. reject promise with NotFoundError while no available device
2. reject promise with NotAllowedError while canceled by user
3. expose NS_ERROR_DOM_NOT_FOUND_ERR and NS_ERROR_DOM_NOT_ALLOWED_ERR in Components.results.
Attachment #8778780 - Flags: review?(bugs)
Comment on attachment 8778780 [details] [diff] [review]
not-found-error-while-no-device.patch

>+
>+/* Codes related to Presentation API */
>+XPC_MSG_DEF(NS_ERROR_DOM_NOT_FOUND_ERR                , "The object can not be found here.")
>+XPC_MSG_DEF(NS_ERROR_DOM_NOT_ALLOWED_ERR              , "The request is not allowed.")
Not really related to presentation API only, since they are defined in Webidl.
So you can drop the comment, or mention webidl
Attachment #8778780 - Flags: review?(bugs) → review+
update according to review comment, carry r+.
Attachment #8778780 - Attachment is obsolete: true
Attachment #8779163 - Flags: review+
Status: NEW → ASSIGNED
Whiteboard: [ETA 8/19]
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f30384ba6bc3
reject promise with NotFoundError while no device, and NotAllowedError while canceled by user. r=smaug.
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/f30384ba6bc3
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
blocking-b2g: 2.6? → 2.6+
Hi SC,

Found that fennec shuts down when the request is canceled by user. 
Can you take a look?
Flags: needinfo?(schien)
(In reply to Teri Wen [:twen] from comment #10)
> Hi SC,
> 
> Found that fennec shuts down when the request is canceled by user. 
> Can you take a look?

This fix is also included in the final version of patch that landed on m-c, do you want an update version of ENG build for verification?
Flags: needinfo?(schien) → needinfo?(twen)
Yes, please send me the build.
Flags: needinfo?(twen)
Verified fixed. 

No device.
>>start error: NotFoundError: Node was not found

User cancel request.
>>start error: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
Status: RESOLVED → VERIFIED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.