Skip to content

Instantly share code, notes, and snippets.

View rpl's full-sized avatar

Luca Greco rpl

  • Mozilla
  • Lecce, Italy
View GitHub Profile
@rpl
rpl / gettext.js
Last active February 13, 2018 15:35 — forked from EnTeQuAk/gettext.js
// i18n data that get's passed to jed
let DEFAULT_I18N_DATA = {
messages: {
en: {
'This is a test': 'This is a test',
},
fr: {
'This is a test': 'C\'est un test',
},
ja: {
@rpl
rpl / README.md
Last active January 23, 2018 16:50
A fiction example webextension (used to design a new userScripts WE API)

TBD

@rpl
rpl / generate_jscov_report_from_firefox_tests.md
Last active September 7, 2017 14:28
Locally generate JS coverage reports from Firefox tests

Generate JSCOV reports from mochitest and xpcshell tests locally

  • create the directory where the lcov files will be stored
 mkdir /tmp/JSCOV 
  • generate the lcov files:
@rpl
rpl / android-support-activity-diagram.plantuml
Last active July 4, 2017 16:07
web-ext Android Support diagrams
@startuml
title FirefoxAndroidExtensionRunner\n"run" Activity Diagram
partition "androidRunner.run" {
"adb.createClient" --> "this.adbDevicesDiscoveryAndSelect"
"this.adbDevicesDiscoveryAndSelect" --> "this.apkPackagesDiscoveryAndSelect"
@rpl
rpl / sinonstubs-to-jestmocks.js
Created April 15, 2017 20:50
jscodeship transform to help me porting a bunch of tests based on sinon to jest
// BE CAREFULL: commit any changes first and run the tests, don't trust the robots ;-)
const getSinonCalls = call => ({
type: 'CallExpression',
callee: {
type: 'MemberExpression',
object: {
type: 'Identifier',
name: 'sinon'
},
@rpl
rpl / api.js
Created March 15, 2017 16:54
tabTracker snippet
const {Management} = Cu.import("resource://gre/modules/Extension.jsm", {});
....
class API extends ExtensionAPI {
getAPI(context) {
const {tabTracker} = Management.global;
return {
mynamespace: {
@rpl
rpl / src-cmd-create.js
Created February 14, 2017 14:03
web-ext create PR tweaks
/* @flow */
import path from 'path';
import readline from 'readline';
import tty from 'tty';
import {fs} from 'mz';
import mkdirp from 'mkdirp';
import promisify from 'es6-promisify';
import {createLogger} from '../util/logger';
@rpl
rpl / promise-example.js
Last active November 21, 2016 18:59
small promise example
function () {
if (...) {
return Promise.resolve();
}
const isDonePromise = doSomethingAsync().then(() => {
});
...
@rpl
rpl / webextensions.flow.js
Last active February 26, 2024 04:32
WebExtension Flow Type declarations generated from the APIs JSON Schema
// Auto-generated WebExtensions Flow types definitions generated from WebExtensions JSON API schema.
declare type webext$alarms$Alarm = {|
name: string,
scheduledTime: number,
periodInMinutes?: number
|};
declare function webext$alarms$create(alarmInfo: {|
when?: number,
@rpl
rpl / logs.txt
Created October 20, 2016 21:48
emoji keyboard stacktrace by loading the xpi from about:debugging#addons
1476999152622 addons.xpi ERROR Error: aAddon must include an id, version, and type (resource://gre/modules/addons/XPIProvider.jsm:4716:20) JS Stack trace: this.XPIProvider.callBootstrapMethod@XPIProvider.jsm:4716:20 < this.XPIProvider.installTemporaryAddon<@XPIProvider.jsm:3964:5
1476999152634 addons.xpi ERROR Error: aAddon must include an id, version, and type (resource://gre/modules/addons/XPIProvider.jsm:4716:20) JS Stack trace: this.XPIProvider.callBootstrapMethod@XPIProvider.jsm:4716:20 < this.XPIProvider.installTemporaryAddon<@XPIProvider.jsm:3978:5
1476999364314 addons.manager WARN Error in background update: [Exception... "aID must be a non-empty string" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: resource://gre/modules/AddonManager.jsm :: AddonManagerInternal.getAddonByID :: line 2395" data: no] Stack trace: AddonManagerInternal.getAddonByID()@resource://gre/modules/AddonManager.jsm:2395 < AddonManagerInternal.getAddonsByIDs/promises<()@resource:/