Closed Bug 685045 Opened 15 years ago Closed 10 years ago

Port TP async filter function to mobile version

Categories

(Mozilla Labs Graveyard :: Test Pilot, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: jono, Unassigned)

Details

(Whiteboard: mobile, api)

Attachments

(1 file, 1 obsolete file)

Specifically this is to enable the Firebug survey, which needs a filter function that checks if the user has Firebug installed. Checking for an extension is an asynchronous API, so we either have to block on it (bad) or rewrite the test pilot extension <-> study API to be async as well. (This will also enable us to use other async APIs in filter functions in the future.)
For backwards compatibility between studies and old TP versions, I gave the new async function the name "filter" instead of the old name "runOrNotFunc". A study can thus implement both.
Attachment #558687 - Flags: review?(gavin.sharp)
Target Milestone: --- → 1.2
Comment on attachment 558687 [details] [diff] [review] Patch making the API asynchronous >diff --git a/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/setup.js b/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/setup.js >+ _checkExperimentRequirements: function TPS__requirementsMet(experiment, callback) { >+ let numExperiments = [filename for (filename in experiments)].length; Object.keys(experiments).length? >+ numExperimentsProcessed ++; >+ if (numExperimentsProcessed == numExperiments) { If a poorly written study fails to call the callback, this code will never run. That seems like it could be problematic - the old code would catch such issues with a try/catch. I guess there isn't much that can be done about that short of setting up a watchdog timer. Perhaps that's overkill?
So, do you want me to write a watchdog timer, or can we just say that every study needs to call the callback 100% of the time and leave it at that?
I was looking for your thoughts, since you know how studies are written and deployed (and by whom), and what the likelihood of this posing a problem in practice is. If you don't think it's necessary, that's fine by me.
Took your suggestion for a cleaner way to count the number of keys. I'm not going to set up a watchdog, though; it will just make things a lot more complicated (as we have to worry about the case where the watchdog triggers but then the original study calls back after all, meaning the callback will be called twice. Instead, it must be up to the study to ensure that the filter function is guaranteed to be called. I think I can handle that in the server-side base classes used by all studies.
Attachment #558687 - Attachment is obsolete: true
Attachment #558687 - Flags: review?(gavin.sharp)
Attachment #563856 - Flags: review?(gavin.sharp)
Attachment #563856 - Flags: review?(gavin.sharp)
Done on desktop. Needs to be ported to mobile for v 1.3.
Whiteboard: mobile, api
Target Milestone: 1.2 → 1.3
Summary: Test Pilot API - filter function needs to be asynchronous → Port TP async filter function to mobile version
Product: Mozilla Labs → Mozilla Labs Graveyard
decommissioned
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: