I think there are only two events which *may* indicate to the UA to close the service and/or picker for a given activity...1) client closed prematurely (before postResult call):
Example - "pick" intent initiated, user closes client before postResult call.Counter example - User reads article, clicks a button which initiates a "share" intent, closes article (since they are done with it), wants to be able to still complete the share workflow.
2) postResult call:Example - Client initiates a "pick" intent, waits for a service to return picked content via postResult, at which point they want the service to be closed.Counter example - Client initiates a "view" intent for a document, waits for the service to indicate success via a postResult call, the service browswing context should remain open after postResult so the user can view the document.So currently there is not well defined criteria for the UA to use. I think the criteria should be:If the service's only purpose it to return data to the client, then close it anytime it calls postResult or the client is closedThe only question it how to inform the UA that a service has purpose other than returning data to the client. The service will have the best insight into this, thus I propose allowing it to inform the UA by setting a "persistent" property on `window.intent` which defaults to false, that the UA will check when the client is closed or postResult is called. However, if the client is closed before the service is opened (picker is still open), then the service will have not yet had a chance to inform the UA, so I propose letting the client set "persistent" as well. Example code:// share clientvar intent = new Intent("http://webintents.org/share", "text/uri-list", url);intent.persistent = true;window.navigator.startActivity(intent);// view servicevar intent = window.intent;if(intent.type = "http://webintents.org/view") {intent.persistent = true;var success = display(intent.data);window.intent.postResult(success);}
But what about the "pick" example ? There is no reason for a "pick"
service picker or "pick" service to remain open after the client is
closed. Users would be confused and annoyed if they had to close
these themselves.
Also, it would be impossible to keep open "inline" pickers or
services. At the same time services with a "window" disposition would
be kept open. This would be inconsistent and unpredictable for the
user. This may be further reason to remove the "inline" disposition.
The following events can occur in an intent workflow:
1) startActivity call
2) service opened
3) postResult call
A) client closed
My thinking is that:
a) the client should decide whether the picker and/or service is
closed when A occurs between 1 and 3, basically whether to execute the
RPC for side effects, should probably remain open by default
b) the service should decide whether it is closed after 3, basically
whether to clean up the browsing context after the RPC call, should
close by default
I originally thought that the service should decide when A occurs
between 2 and 3, but I think it is more consistent to have the client
decide regardless of whether A occurs before or after 2.
Your false by default postResult argument seems to be the best solution for b).
For a) we could mirror the false by default postResult argument in
startActivity. The argument could be thought of as whether the
activity (RPC) is "dependent" on the client context remaining open.
One issue with this is that startActivity already has an optional
callback argument for which `undefined` would need to be passed.
What do you think ?
Thanks,
Sean Eagan
On Mon, Sep 26, 2011 at 3:08 PM, James Hawkins <jhaw...@chromium.org> wrote:But what about the "pick" example ? There is no reason for a "pick"
> On Mon, Sep 26, 2011 at 8:50 AM, Sean Eagan <seane...@gmail.com> wrote:
>>
>> I think there are only two events which *may* indicate to the UA to close
>> the service and/or picker for a given activity...
>>
>> 1) client closed prematurely (before postResult call):
>>
>> Example - "pick" intent initiated, user closes client before postResult
>> call.
>> Counter example - User reads article, clicks a button which initiates a
>> "share" intent, closes article (since they are done with it), wants to be
>> able to still complete the share workflow.
>
> In this case, we envision letting the service continue it's business (for,
> e.g., your counter-example)
service picker or "pick" service to remain open after the client is
closed. Users would be confused and annoyed if they had to close
these themselves.
Your false by default postResult argument seems to be the best solution for b).
Clients should be allowed to register for an error callback which is
called anytime the UA determines that the result callback will not be
called.
Users should be allowed to go back and change their service
pre-postResult. This could manifest as a back button or a prompt upon
closing the service.
Services should be able to request to stay open after they call
postResult to handle such use cases as a "view" service wanting to
return a success indication but still remain open for content viewing
purposes. Implementation could be a false by default additional
postResult parameter.
Clients should be able to suggest to the UA whether an activity they
start is "dependent", if not then it should be canceled if the client
is closed pre-postResult. This prevents orphaned activities whose
only purpose was to return data to the client, such as"pick", as well
as user prompts as to whether they want to close the service upon
closing the client. Possibly let the service veto its dependency once
it is opened. Could be an optional boolean argument to startActivity
or a property on the intent instance.
--
Sean Eagan
Good points. To summarize my thoughts on web intent browser context
close handling:
Clients should be allowed to register for an error callback which is
called anytime the UA determines that the result callback will not be
called.
Users should be allowed to go back and change their service
pre-postResult. This could manifest as a back button or a prompt upon
closing the service.
Services should be able to request to stay open after they call
postResult to handle such use cases as a "view" service wanting to
return a success indication but still remain open for content viewing
purposes. Implementation could be a false by default additional
postResult parameter.
Clients should be able to suggest to the UA whether an activity they
start is "dependent", if not then it should be canceled if the client
is closed pre-postResult. This prevents orphaned activities whose
only purpose was to return data to the client, such as"pick", as well
as user prompts as to whether they want to close the service upon
closing the client. Possibly let the service veto its dependency once
it is opened. Could be an optional boolean argument to startActivity
or a property on the intent instance.