Skip to content

Instantly share code, notes, and snippets.

View Moments pages
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 Jul 18, 2020
wip bug 1618356
View patch.diff
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(
View gist:dbf06d0c9b46c0a680d3cb0910e7f907
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 Feb 19, 2020
Use a DOMLocalization instance separate from document.l10n
View customElement.js
/* 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 Feb 25, 2019
snippets payload
View response.json
This file has been truncated, but you can view the full file.
@piatra
piatra / steps.js
Last active Feb 12, 2019
caching_qa_test_steps
View steps.js
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 {
View snippet.json
{
"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
View gist:3978729ad651de9e9cf02c17a8bc7e7e
{"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 Jul 26, 2019
newsletter snippet
View bookmark_endpoint.json
{
"messages": [
{
"weight": 100,
"content": {
"cta": {
"string_id": "cfr-doorhanger-bookmark-fxa-link-text"
},
"text": {
View gist:d45d10f1aee80a5ac46c9a664cab1f44
{
"messages": [
{
"id": "1",
"template": "eoy_snippet",
"template_version": "1.0.0",
"campaign": "foobar",
"content": {
"background_color": "yellow",
"test": "bold",