Skip to content

"setting presentation.defaultRequest will have no effect" note is ambiguous #359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tidoust opened this issue Oct 14, 2016 · 6 comments
Closed

Comments

@tidoust
Copy link
Member

tidoust commented Oct 14, 2016

See related discussion between @schien and @tomoyukilabs on Web Platform Tests repository: web-platform-tests/wpt#3844

In particular, @schien notes that:

However, in the second note it says "setting presentation.defaultRequest" should take no effect. I take this sentence as "assigning value to defaultRequest will be no-op", which means presentation.defaultRequest will still be null after the assignment. That's my interpretation.

To which @tomoyukilabs replies:

I'm afraid that the spec might look ambiguous. I regard it as "Although the defaultRequest property can be set to any instance of PresentationRequest or null, browsers which do not support defaultRequest will never refer to its value unless a script accesses it directly".

I would read the spec as @tomoyukilabs. Regardless of who is correct, it seems a good idea to clarify the expected behavior!

@markafoltz
Copy link
Contributor

The intent is that the attribute setting algorithm [1] completes, but there is no attribute-specific behavior for defaultRequest in the controlling user agent (step 9).

Since the spec does not override the attribute setting algorithm, the meaning seems clear enough to me, but the text could be explicit that the attribute is set.

[1] https://www.w3.org/TR/WebIDL/#dfn-attribute-setter

@markafoltz
Copy link
Contributor

There's another issue with starting a default presentation. The spec says that the controlling user agent should run the steps to start a presentation (starting at step 2). However, it's not clear that the user agent should construct a Promise as part of those steps (as there's nowhere to return it.) Maybe we can adjust the language or construct a new algorithm that omits the Promise related steps.

@louaybassbouss
Copy link
Contributor

I am now thinking about the current behaviour of defaultRequest. In current spec the controlling page get notified (using onconnectionavailable) only if the user selects a display in the dialog. Do we need to inform the page that the selection dialog is open? in this case we need to change the spec as following:

navigator.presentation.defaultRequest = new PresentationRequest(presUrls);
navigator.presentation.defaultRequest.onstart = function(evt) {
    // here the page knows that a dialog is open
    evt.promise.then(setConnection).catch(...)
};

in this case we don't need to constrict a new algorithm for default request. What do you think?

@markafoltz
Copy link
Contributor

The current spec doesn't assume there's a dialog (permission can be granted other ways) so we'd have to craft an algorithm that fires a dummy event in those cases to deliver a Promise that resolves immediately. In my opinion it adds extra complexity to the API, which can be avoided by adjusting other parts of the spec.

I think a simpler fix is to just break the start a presentation algorithm into two parts (at step 13) and make step 19 optional (i.e. pass an optional Promise to the second half of the algorithm). When the user agents wants to start a presentation from a defaultRequest, it would pass D with no Promise to step 13.

@markafoltz
Copy link
Contributor

PR #369 updates the specs along the lines of my previous comment.

@louaybassbouss Would you like to continue discussion of a new event for display selection? I can file a separate issue for that.

@markafoltz
Copy link
Contributor

Assuming the PR addressed the original issue, closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants