Closed Bug 1568595 Opened 11 months ago Closed 8 months ago

[Nudges] Implement an experiment API to check whether a notification is being displayed in Firefox

Categories

(Firefox :: Address Bar, task, P3)

task
Points:
5

Tracking

()

RESOLVED FIXED
Firefox 72
Iteration:
72.2 - Nov 4 - 17
Tracking Status
firefox72 --- fixed

People

(Reporter: okonaraddi, Assigned: adw)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Web extensions should be able to check whether a notification (default browser prompt, doorhanger, etc.) is being displayed. This could be useful for the search tips web extension; we can avoid showing a search tip if there's another notification present.

Blocks: 1568594

Morphing this a little. We need this for the nudges/tips experiment, but we should implement it as a webextension experiment API (inside the webextension) rather than in mozilla-central.

Assignee: okonaraddi → nobody
Mentor: adw
Status: ASSIGNED → NEW
Summary: Web extensions should be able to check whether a notification is being displayed → [Nudges] Implement an experiment API to check whether a notification is being displayed in Firefox
Assignee: nobody → htwyford
Iteration: --- → 72.2 - Nov 4 - 17
Assignee: htwyford → adw

This sets up a browser.urlbarExperiments WebExtension Experiment API and adds a function called isBrowserShowingNotification. To recap, for the nudges experiment, we want to open the urlbar view automatically in some cases to show a nudge, but only if the browser isn't already showing a notification.

There are a few things to point out about this patch.

What counts as a notification is a little fuzzy. I chose: the tracking protection doorhanger, site identity doorhanger, app menu notifications, page action panels, and toolbar button panels. The last two aren't really notifications, but they're panels similar to doorhanger notifications. I also count the urlbar view as a notification since we don't want to show a nudge if the urlbar view is already open. I didn't bother with tab-modal dialogs since none of the pages we want to show nudges on will have them. I didn't bother with app-modal dialogs since the user can't interact with the browser until they're dismissed. Am I missing anything else?

I chose browser.urlbarExperiments as the namespace. I'd prefer browser.experiments.urlbar, but the webextensions framework doesn't allow two APIs with the same base name ("urlbar" in this case). There was also discussion of browser.experiments.app (bug 1579933), but I think we should keep all our urlbar experiment-related APIs in a urlbar namespace even when they aren't actually related to the urlbar. It's not a big deal though.

Shane recommends that we land tests for our experiment APIs in mozilla-central even though they won't ship in mozilla-central, at least for APIs that will be used in more than one version of Firefox. I think that's also a good idea for APIs we reuse in multiple experiments. It may not be necessary in this case since I'm not sure how broadly useful this notification API is, so I'm open to removing it and keeping it only in the experiment's GitHub repo. But I found that this was actually a nice way to develop and test this patch. Also, if we keep our experiment APIs in mozilla-central this way, we may not need a separate GitHub repo for them, or at most it'll just be a copy of this browser/components/urlbar/tests/ext directory.

As mentioned, I made a new ext tests directory. I think we should keep these files separate from the normal tests.

Status: NEW → ASSIGNED
Blocks: 1579933
Pushed by dwillcoxon@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4b3eacb45a38
[Nudges] Implement an experiment API to check whether a notification is being displayed in Firefox r=mak,mixedpuppy
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 72
Depends on: 1595678
You need to log in before you can comment on or make changes to this bug.