Closed Bug 855928 Opened 11 years ago Closed 11 years ago

Story - Add telemetry probe for whether Firefox is the default browser

Categories

(Firefox :: General, defect, P1)

x86
All
defect

Tracking

()

VERIFIED FIXED
Firefox 24

People

(Reporter: TimAbraldes, Assigned: jimm)

References

Details

(Whiteboard: feature=story c=data_submission u=metro_firefox_user p=2)

Attachments

(1 file, 1 obsolete file)

See bug 828562 comment 3.

We will want to implement this in both desktop Firefox and immersive/Metro Firefox.
QA Contact: jbecerra
OS: Windows 8 → Windows 8 Metro
Priority: -- → P2
Priority: P2 → P4
First add a telemetry ID and type of histogram here, example see UPDATER_HAS_PERMISSIONS for a boolean one:
"mozilla-central\toolkit\components\telemetry\Histograms.json"

Telemetry:
> let h = Services.telemetry.getHistogramById("UPDATER_HAS_PERMISSIONS");
> h.add(val);


Here's how you check if we're the default browser:
> shell = Components.classes["@mozilla.org/browser/shell-service;1"].
>         getService(Components.interfaces.nsIShellService);
> shell.isDefaultBrowser(true, false)


  /**
   * Determines whether or not Firefox is the "Default Browser."
   * This is simply whether or not Firefox is registered to handle
   * http links.
   *
   * @param aStartupCheck true if this is the check being performed
   *                      by the first browser window at startup,
   *                      false otherwise.
   * @param aForAllTypes  true if the check should be made for HTTP and HTML.
   *                      false if the check should be made for HTTP only.
   *                      This parameter may be ignored on some platforms.
   */
  boolean isDefaultBrowser(in boolean aStartupCheck,
                           [optional] in boolean aForAllTypes);
Blocks: metrobacklog
No longer blocks: metrov1backlog, 850347
Whiteboard: feature=story c=data_submission u=metro_firefox_user p=3 → feature=story c=data_submission u=metro_firefox_user p=0
Hi Asa, Jim's nomination to elevate Bug 855928 (Add telemetry probe for whether
Firefox is the default browser) to P1 and get it landed on mc.  See this for reference:  https://bugzilla.mozilla.org/show_bug.cgi?id=872712
Flags: needinfo?(asa)
Whiteboard: feature=story c=data_submission u=metro_firefox_user p=0 → feature=story c=data_submission u=metro_firefox_user p=2
Flags: needinfo?(asa)
Priority: P4 → P1
Assignee: nobody → jmathies
Blocks: metrov1it8, 850347
No longer blocks: metrobacklog
Status: NEW → ASSIGNED
Attached patch add default browser probe (obsolete) — Splinter Review
Comment on attachment 754794 [details] [diff] [review]
add default browser probe

It's possible this might show up in startup talos, since we disable this check in prefs for those tests. It will be interesting to see if it does. If so, I think that's ok, since this check is part of our normal startup, and hence should be included in startup perf measurements.
Attachment #754794 - Flags: review?(gavin.sharp)
Comment on attachment 754794 [details] [diff] [review]
add default browser probe

Review of attachment 754794 [details] [diff] [review]:
-----------------------------------------------------------------

::: toolkit/components/telemetry/Histograms.json
@@ +3313,5 @@
>      "description": "The time (in milliseconds) that it took a 'detach' request to go round trip."
> +  },
> +  "BROWSER_IS_USER_DEFAULT": {
> +    "kind": "boolean",
> +    "description": "The result of the startup default destop browser check."

nit - 'desktop' fixed locally
Comment on attachment 754794 [details] [diff] [review]
add default browser probe

>diff -r ca7f8131a8d4 browser/components/nsBrowserGlue.js

>+      // Get default browser status on startup and report the result to telemetry
>+      // so we can track whether we are the default.
>+      let isDefault = shell.isDefaultBrowser(true, false); // startup check, check all assoc
>+      let telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
>+      if (telemetry) {

getService never returns null in JS - it either succeeds and returns the service, or throws an exception. So the null check is unnecessary (we also don't need to worry about the telemetry service not existing, AFAIK).

>+        let histogram = telemetry.getHistogramById("BROWSER_IS_USER_DEFAULT");
>+        if (histogram) {

Same thing here - just remove the null check. You can just call getHistogramById().add(), to simplify.

>+      if (shouldCheck && isDefault && !willRecoverSession) {

Looks like you inverted the condition here - should be !isDefault. Was this tested? :)
Attachment #754794 - Flags: review?(gavin.sharp) → review-
Sorry that was sloppy. Tested this time to be sure everything is working.
Attachment #754794 - Attachment is obsolete: true
Attachment #755900 - Flags: review?(gavin.sharp)
Comment on attachment 755900 [details] [diff] [review]
add default browser probe v.2

Actually I also remembered that you can just use Services.telemetry.getHistogramById (Services.jsm is already imported in this file).

r=me with that.

Seems like we should be moving this bug to Firefox::General, though? Or are you also going to patch metro here?
Attachment #755900 - Flags: review?(gavin.sharp) → review+
Metro would simply always return that metro is the default since it can only be used when it is the default.
* that Metro Fireofx is the default
Component: Metro Operations → General
OS: Windows 8 Metro → All
Product: Tracking → Firefox
Summary: Story - Add telemetry probe for whether Firefox is the default browser → Add telemetry probe for whether Firefox is the default browser
Version: --- → Trunk
http://hg.mozilla.org/integration/mozilla-inbound/rev/7dbcdd81bd1c

Landed, but it might have to bounce due to pushlog problems.
Summary: Add telemetry probe for whether Firefox is the default browser → Story - Add telemetry probe for whether Firefox is the default browser
https://hg.mozilla.org/mozilla-central/rev/7dbcdd81bd1c
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 24
Mozilla/5.0 (Windows NT 6.2; rv:24.0) Gecko/20130610 Firefox/24.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20130611 Firefox/24.0
Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20130603 Firefox/24.0

The BROWSER_IS_USER_DEFAULT histogram was added to the about:telemetry page, but only for normal (non-Metro mode) and it only updates after browser restart. Is this expected?

Steps:
1. Make sure Firefox is not default browser
2. Open about:telemetry
3. Check BROWSER_IS_USER_DEFAULT chart under Histograms section -> it should show average = 0, sum = 0
4. Make Firefox default browser and refresh about:telemetry page
-> Actual result: the  BROWSER_IS_USER_DEFAULT chart didn't change the values
5. Restart Firefox and check again the about:telemetry page
-> Actual result: the  BROWSER_IS_USER_DEFAULT chart changed the values: average = 1, sum = 1
Flags: needinfo?
(In reply to Mihaela Velimiroviciu [QA] (:mihaelav) from comment #13)
> Mozilla/5.0 (Windows NT 6.2; rv:24.0) Gecko/20130610 Firefox/24.0
> Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20130611
> Firefox/24.0
> Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20130603 Firefox/24.0
> 
> The BROWSER_IS_USER_DEFAULT histogram was added to the about:telemetry page,
> but only for normal (non-Metro mode) and it only updates after browser
> restart. Is this expected?

Yes. Metro can't launch unless it's the default, so there's no point in reporting from that browser, and the default startup check was the most convenient place to collect.
Flags: needinfo?
Thank you Jim. Marking verified based on comment #14.
Status: RESOLVED → VERIFIED
verified for it8 using about:telemetry.
Jim can you request to get this uplifted?

We may find for example that only 10% of users on Beta have Beta set as their default and hence there is no value in uplifting early.
Went through the following "Story" for iteration #9 testing without any issues. Used the following build:

http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2013-07-06-03-12-13-mozilla-central/

- Went through the test case that has been added in comment 13 without any issues
User Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0
Build ID: 20130819030205
Built from http://hg.mozilla.org/mozilla-central/rev/c8c9bd74cc40

WFM
Tested on windows 8 using latest nightly for iteration-12. Followed steps provided in comment13 and got expected result.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: