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 463706 7d1ef08b4ceab853ac395b0c36e046252ddc8730
parent 463705 7f2ca89b9801e747dfcd556908dd6f9e712a66a9
child 463707 7b997d966c3c5fad733d2255a4d57aff2237112a
push id80307
push useraoprea@mozilla.com
push dateTue, 12 Mar 2019 18:18:54 +0000
treeherderautoland@7d1ef08b4cea [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"`);
+      }
     }
   });
 });