Bug 1534719 - Restrict CFR pin tabs targeting to en-US r=k88hudson
authorAndrei Oprea <andrei.br92@gmail.com>
Tue, 12 Mar 2019 18:10:13 +0000
changeset 521581 7d1ef08b4cea
parent 521580 7f2ca89b9801
child 521582 7b997d966c3c
push id10867
push userdvarga@mozilla.com
push dateThu, 14 Mar 2019 15:20:45 +0000
treeherdermozilla-beta@abad13547875 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersk88hudson
bugs1534719
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1534719 - Restrict CFR pin tabs targeting to en-US r=k88hudson Differential Revision: https://phabricator.services.mozilla.com/D23189
browser/components/newtab/lib/CFRMessageProvider.jsm
browser/components/newtab/test/unit/asrouter/CFRMessageProvider.test.js
--- a/browser/components/newtab/lib/CFRMessageProvider.jsm
+++ b/browser/components/newtab/lib/CFRMessageProvider.jsm
@@ -345,17 +345,17 @@ const CFR_MESSAGES = [
           label: {string_id: "cfr-doorhanger-extension-manage-settings-button"},
           action: {
             type: "OPEN_PREFERENCES_PAGE",
             data: {category: "general-cfrfeatures", origin: "CFR"},
           },
         }],
       },
     },
-    targeting: `localeLanguageCode == "en" && !hasPinnedTabs && recentVisits[.timestamp > (currentDate|date - 3600 * 1000 * 1)]|length >= 3`,
+    targeting: `locale == "en-US" && !hasPinnedTabs && recentVisits[.timestamp > (currentDate|date - 3600 * 1000 * 1)]|length >= 3`,
     frequency: {lifetime: 3},
     trigger: {id: "frequentVisits", params: PINNED_TABS_TARGET_SITES},
   },
 ];
 
 const CFRMessageProvider = {
   getMessages() {
     return CFR_MESSAGES.filter(msg => !msg.exclude);
--- a/browser/components/newtab/test/unit/asrouter/CFRMessageProvider.test.js
+++ b/browser/components/newtab/test/unit/asrouter/CFRMessageProvider.test.js
@@ -29,12 +29,16 @@ describe("CFRMessageProvider", () => {
       // See bug 1494778 and 1497653
       if (message.id !== "PIN_TAB") {
         assert.include(message.targeting, `(xpinstallEnabled == true)`);
       }
     }
   });
   it("should restrict all messages to `en` locale for now", () => {
     for (const message of messages) {
-      assert.include(message.targeting, `localeLanguageCode == "en"`);
+      if (message.id !== "PIN_TAB") {
+        assert.include(message.targeting, `localeLanguageCode == "en"`);
+      } else {
+        assert.include(message.targeting, `locale == "en-US"`);
+      }
     }
   });
 });