Skip to content
This repository has been archived by the owner on Dec 3, 2020. It is now read-only.

Final sunset release of Price Tracker #322

Merged
merged 9 commits into from
Aug 27, 2019
Merged

Final sunset release of Price Tracker #322

merged 9 commits into from
Aug 27, 2019

Conversation

biancadanforth
Copy link
Collaborator

@biancadanforth biancadanforth commented Aug 22, 2019

On update, opens an extension page in a new tab with a notice that the extension will self-uninstall in 30 days. This page also has a button for the user to uninstall Price Tracker sooner.

After 30 days, on the next startup, a final notice is shown (same as initial notice but with slightly modified wording), and one day later on the next startup, the extension self-uninstalls.

The notice page links to a SUMO article that will persist after the extension is uninstalled and delisted from AMO.

Initial retirement notice
Screen Shot 2019-08-21 at 9 45 30 PM

Final retirement notice
Screen Shot 2019-08-21 at 9 45 46 PM

Previously, this page was opened on every 'runtime.onInstalled' event, which includes extension updates and browser updates.
Clicking the 'Uninstall' button on the retirement notice page will prompt the user with a confirmation dialogue before uninstalling the extension.
* Using the web extension 'storage.local' API, store the date of the last update, when the first notice was shown.
* Each subsequent startup, check if 30 or more days have passed since the first notice was shown.
* If so, show a final notice and store the date that the final notice was shown.
* Each subsequent startup, check if 1 or more days have passed since the final notice was shown.
* If so, uninstall the extension.

This logic can be tested by making use of two new config override prefs by adding them to 'web-ext-config.js', e.g. (replace AT with @):
* 'extensions.shopping-testpilotATmozilla.org.initialNoticeDuration=10'
  * Sets the period between the initial and final retirement notice to 10 seconds.
* 'extensions.shopping-testpilotATmozilla.org.finalNoticeDuration=10'
  * Sets the period between the final retirement notice and self-uninstall to 10 seconds.
Though the same page is used, a query string is passed via the url for the page to indicate if it has been opened as the final notice. This modifies the header and one sentence in the first paragraph to indicate the extension will self-uninstall in one day.
As long as Price Tracker is still listed on AMO, it's possible for users to install Price Tracker after the update is published, and those users should receive the retirement notice as well.
@biancadanforth biancadanforth marked this pull request as ready for review August 23, 2019 04:34
@biancadanforth biancadanforth requested a review from rhelmer August 23, 2019 04:51
@biancadanforth
Copy link
Collaborator Author

biancadanforth commented Aug 23, 2019

@rhelmer : Ready for your review!

I know there are a lot of commits here, but most of them are small. The most important thing to check is that the notice and self-uninstall logic works as expected. I tested this using the "simple 5 step process" (hah) below on unbranded local builds of Nightly, Beta and Release, but I would appreciate a confirmation.

We are pushing to publish this final release next Thursday, 8/29 on AMO, so if you can help us achieve that goal with a timely review, that'd be really awesome.

Please let me know if you have any questions! You know how to find me. :-)


How to test the notice and self-uninstall logic

  1. Package the extension into an XPI
    a. npm install
    b. npm run build
    c. cd build
    d. web-ext build (This creates a ./build/web-ext-artifacts/price_tracker-X.0.0.zip.)
  2. Set up a local build of mozilla-central
    a. hg pull central
    b. hg up central
    c. Edit your .mozconfig or mozconfig file to add the line ac_add_options MOZ_ALLOW_LEGACY_EXTENSIONS=1 (also enable artifact builds if you aren't already: ac_add_options --enable-artifact-builds).
    d. ./mach clobber (if needed)
    e. ./mach build
    f. In the Firefox source code, modify toolkit/components/extensions/Extension.jsm[1] to ensure the extension is considered "privileged". (If this step is omitted, the extension will throw an error saying the privileged ”telemetry” permission is invalid, and it will break.)
    g. ./mach build faster
    h. ./mach run --temp-profile (Note the path to the profile, so that it can be reused in later steps (e.g. /Users/bdanforth/src/mozilla-unified/objdir-frontend-debug-artifact/tmp/profile-fpCJJC.)
  3. Set testing preferences and install extension
    a. Go to about:config
    b. Set xpinstall.signatures.required to false
    c. Set extensions.legacy.enabled to true
    d. Create a new Number pref: [email protected], and set it to 10 (This is the period of time in seconds in between showing the initial notice and the final notice. This is only checked once on extension startup.)
    f. Create a new Number pref: [email protected], and set it to 10. (This is the period of time in seconds in between showing the final notice and uninstalling the extension. This is only checked once on extension startup.)
    g. Go to about:addons
    h. Click the gear icon in the top right of the page
    i. Click "Install add-on from file"
    j. Navigate to the build/web-ext-artifacts directory and select the price_tracker-vX.0.0.zip file.
    k. Click through the install doorhangers
  4. Testing the notices and self-uninstall behavior
    a. Upon installing the extension, two pages should open; the page titles are: 1) Firefox Price Tracker Privacy Notice, and 2) Firefox Price Tracker Retirement Notice
    d. The retirement notice page should be focused.
    e. Wait more than 10s, and observe that the extension is still functional: 1) Navigate to an e.g. Amazon product page, 2) See that the browserAction toolbar is badged, and 3) Open the browserAction popup and click "Add"
    f. Close Firefox
    g. Re-open Firefox (be sure to open with the same profile, e.g. ./mach run -profile path/to/profile).
    h. The final retirement notice page should open in a new tab. (The only difference between the initial and final retirement notice is the header and one sentence in the first paragraph. The final notice states that the extension is going to be removed in one day in both locations.)
    i. Wait more than 10s, and observe that the extension is still functional: 1) Click the browserAction toolbar icon and observe the product you added in the previous Firefox session is still there.
    j. Close Firefox
    k. Re-open Firefox (be sure to open with the same profile, e.g. ./mach run -profile path/to/profile).
    i. Notice that shortly after Firefox startup, the extension has been uninstalled. There should be no browserAction toolbar button in the chrome and no Price Tracker listed in about:addons.
  5. Repeat steps 2, 3, and 4 for mozilla-beta and mozilla-release unbranded, local builds of Firefox.

[1]:

diff --git a/toolkit/components/extensions/Extension.jsm b/toolkit/components/extensions/Extension.jsm
--- a/toolkit/components/extensions/Extension.jsm
+++ b/toolkit/components/extensions/Extension.jsm
@@ -1809,13 +1809,14 @@ class Extension extends ExtensionData {
   }
 
   get isPrivileged() {
-    return (
-      this.addonData.signedState === AddonManager.SIGNEDSTATE_PRIVILEGED ||
-      this.addonData.signedState === AddonManager.SIGNEDSTATE_SYSTEM ||
-      this.addonData.builtIn ||
-      (AppConstants.MOZ_ALLOW_LEGACY_EXTENSIONS &&
-        this.addonData.temporarilyInstalled)
-    );
+    return true;
+    // return (
+    //   this.addonData.signedState === AddonManager.SIGNEDSTATE_PRIVILEGED ||
+    //   this.addonData.signedState === AddonManager.SIGNEDSTATE_SYSTEM ||
+    //   this.addonData.builtIn ||
+    //   (AppConstants.MOZ_ALLOW_LEGACY_EXTENSIONS &&
+    //     this.addonData.temporarilyInstalled)
+    // );
   }
 
   get experimentsAllowed() {

@biancadanforth biancadanforth merged commit 3a8435c into master Aug 27, 2019
@biancadanforth biancadanforth deleted the sunset-update branch August 27, 2019 17:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants