Skip to content

Instantly share code, notes, and snippets.

Some comments about the targeting:
1. WNP_MOMENTS_MOBILE
* firefox version 70+ (70 _or more_)
* tier 1 and 14 days old profile
* isFxAEnabled && sync.mobileDevices == 0
* this isn't 100% correct
* it means: user did not turn of sync AND did not sync any mobile devices, BUT it doesn't check if the user is
signed in to FxA. This targeting expression includes both users logged in to FxA AND not logged in who do not
have a mobile device synced.
* I _think_ it should have included "is signed in to FxA"
@piatra
piatra / patch.diff
Last active July 18, 2020 09:22
wip bug 1618356
diff --git a/toolkit/components/messaging-system/schemas/SpecialMessageActionSchemas/test/browser/browser_sma_docs.js b/toolkit/components/messaging-system/schemas/SpecialMessageActionSchemas/test/browser/browser_sma_docs.js
index 7aff1422288a..6809d0093617 100644
--- a/toolkit/components/messaging-system/schemas/SpecialMessageActionSchemas/test/browser/browser_sma_docs.js
+++ b/toolkit/components/messaging-system/schemas/SpecialMessageActionSchemas/test/browser/browser_sma_docs.js
@@ -18,7 +18,7 @@ add_task(async function test_sma_docs() {
let request = await fetch(TEST_URL);
let docs = await request.text();
let headings = getHeadingsFromDocs(docs);
- const schemaTypes = (await fetchSMASchema).anyOf.map(
+ const schemaTypes = (await fetchSMASchema()).anyOf.map(
diff --git a/browser/components/newtab/AboutNewTabService.jsm b/browser/components/newtab/AboutNewTabService.jsm
index 69390dfbc8a2..30796b29f398 100644
--- a/browser/components/newtab/AboutNewTabService.jsm
+++ b/browser/components/newtab/AboutNewTabService.jsm
@@ -23,6 +23,13 @@ ChromeUtils.defineModuleGetter(
"AboutNewTab",
"resource:///modules/AboutNewTab.jsm"
);
+const PREF_SEPARATE_ABOUT_WELCOME = "browser.aboutwelcome.enabled";
+XPCOMUtils.defineLazyPreferenceGetter(
@piatra
piatra / customElement.js
Created February 19, 2020 14:34
Use a DOMLocalization instance separate from document.l10n
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// This is loaded into all XUL windows. Wrap in a block to prevent
// leaking to window scope.
{
const { RemoteL10n } = ChromeUtils.import(
@piatra
piatra / response.json
Created February 25, 2019 08:40
snippets payload
This file has been truncated, but you can view the full file.
{"messages": [{"id": "10795", "template": "simple_snippet", "template_version": "1.0.0", "weight": 100, "content": {"icon": "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTc2IDE1NCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtOTYgMTczYTg4IDg4IDAgMCAxIC04OC04OHYtNDRhMjIgMjIgMCAwIDEgMjItMjJoMTMyYTIyIDIyIDAgMCAxIDIyIDIydjQ0YTg4IDg4IDAgMCAxIC04OCA4OHptNDMuODMtMTEwLjM1YTEwLjg3IDEwLjg3IDAgMCAwIC04IDMuNTFsLTM2LjEgMzYuMTEtMzUuNDItMzUuNTdhMTAuODIgMTAuODIgMCAwIDAgLTguMzEtNC4wNSAxMSAxMSAwIDAgMCAtNy44NSAxOC43bC0uMTguMTIgMzYuMjIgMzYuMzcgNy44MSA3Ljc3YTExIDExIDAgMCAwIDE1LjU1IDBsNy43OC03Ljc3IDM2LjQtMzYuMzdhMTEgMTEgMCAwIDAgLTcuODctMTguODJ6IiBmaWxsPSIjZWY0MTU2IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtOCAtMTkpIi8+PC9zdmc+", "button_label": "Launch in Firefox", "button_url": "https://getpocket.com/firefox_learnmore/?utm_source=desktop-snippet&utm_medium=snippet&utm_campaign=pocket2019&utm_term=10795&utm_content=evergreen\n", "text": "Brain Food delivered fresh! Pocket makes it easy to find and focus on content that fu
@piatra
piatra / steps.js
Last active February 12, 2019 16:31
caching_qa_test_steps
XPCOMUtils.defineLazyGetter(this, "gTextDecoder", () => new TextDecoder());
const filepath = OS.Path.join(OS.Constants.Path.localProfileDir, "activity-stream.discovery_stream.json");
OS.File.read(filepath).then(binaryData => {
const json = gTextDecoder.decode(binaryData);
data = JSON.parse(json);
for (let i in data) {
if (i === "feeds") {
for (j in data[i]) { console.log(i, data[i][j].lastUpdated); }
} else {
{
"messages": [
{
"weight": 50,
"id": "1053xx3",
"template": "simple_snippet",
"template_version": "1.0.0",
"content": {
"icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAEJ5JREFUeAG9W3uMXFUZP+c+ZvY1u9sH2Cotr4AGalAgGCp0d3HboSAL0i4NIsFHAhr4Q4kSH9Fu/0ODxCgqGGIwREK6Bbotj25X6G4fKqEl0YSnWBBEkq7Sx+xr7uv4+507Z3pnd3a7MzvD2ezce88993t/3/nOd8+VokZta+9Wu1f0CtkvQwNyT+ceJ1xiX+AIeaGU8mIh5QolxHlCibNw3RKpMPT9/HgkoimprP9Jqd4XUhzGmDdx/ncl1GvZp7JHDDxcy+HOYbtzuDOUQmLYwptc
{"spocs":{"url":"https:\/\/getpocket.cdn.mozilla.net\/v3\/firefox\/global-recs?version=3&consumer_key=40249-e88c401e1b1f2242d9e441c4&locale_lang=en-US&feed_variant=default_spocs_on"},"layout":[{"width":12,"components":[{"type":"TopSites","header":{"title":"Top Sites"},"properties":{}},{"type":"SectionTitle","header":{"title":"Best of the Web"},"properties":{}},{"type":"HorizontalRule","properties":{}},{"type":"SectionTitle","header":{"title":"Best of the Web","subtitle":"Brought to you by the Pocket Editorial Team"},"properties":{}},{"type":"Navigation","properties":{"alignment":"centered","links":[{"name":"Must Reads","url":"https:\/\/getpocket.com\/explore\/must-reads?src=fx_new_tab"},{"name":"Productivity","url":"https:\/\/getpocket.com\/explore\/productivity?src=fx_new_tab"},{"name":"Health","url":"https:\/\/getpocket.com\/explore\/health?src=fx_new_tab"},{"name":"Finance","url":"https:\/\/getpocket.com\/explore\/finance?src=fx_new_tab"},{"name":"Technology","url":"https:\/\/getpocket.com\/explore\/techno
@piatra
piatra / bookmark_endpoint.json
Last active July 26, 2019 13:10
newsletter snippet
{
"messages": [
{
"weight": 100,
"content": {
"cta": {
"string_id": "cfr-doorhanger-bookmark-fxa-link-text"
},
"text": {
{
"messages": [
{
"id": "1",
"template": "eoy_snippet",
"template_version": "1.0.0",
"campaign": "foobar",
"content": {
"background_color": "yellow",
"test": "bold",