Changes

Jump to: navigation, search

WebAPI/WebActivities/LessonsLearned

1,965 bytes added, 09:55, 9 May 2014
no edit summary
Another question is if it should be possible to target _self if the current page is open in an iframe. I.e. should activity handlers need to worry about possibly being opened in a subframe?
 
== Finding activity handlers that match a given activity request ==
 
When an activity is initiated we want to fairly quickly bring up a list of apps that are able to handle the activity. In WebActivities we allow activity handlers to provide an object which describes a filter which the activity data is matched against.
 
However it's proven pretty hard to find a format to express these filters. For example for the "pick" activity if an application asks for a picture it could do that either by specifying any of <tt>type: 'image/*'</tt>, <tt>type: 'image/gif'</tt> or <tt>type: 'image/jpg'</tt>. So any activity handler for the "pick" activity that can provide an picture has to enumerate at least all of those types. And it also has to make sure that its filter matches if no specific type is requested.
 
Another problem is that if a contact-manager app provides a handler for the "pick" activity in order to allow the user to choose a contact when a contact is explicitly requested, but not come up when the "pick" activity is activated to select an arbitrary file, i.e. when no <tt>type</tt> is specified.
 
'''Recommended solutions'''
 
It's possible that WebActivities' current filter mechanism actually can handle most use cases. It currently supports features like "match any of the values in this array", regexps and optional vs. required attributes. However mimetype matching has been awkward and handler applications have forgotten to enumerate wildcard types like "image/*" which means that they don't always show up when they should.
 
Possibly the situation can be improved by providing explicit features for mimetype matching.
 
Another thing that we might ultimately want to do is to allow passing a javascript expression which is evaluated on the activity data and then returns true/false. However this is not something we'd be able to implement in FirefoxOS right now since we're trying to keep process separation between code from different apps.
Confirm
716
edits

Navigation menu