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 / eslint-errors.log
Created February 15, 2016 19:53
eslint errors on test_ext_bookmarks.html
% ./mach eslint toolkit/components/extensions/ browser/components/extensions/ ~/work/mozlab/mozilla-central-hg
0:00.12 Running /usr/local/bin/eslint
0:00.12 /usr/local/bin/eslint --plugin html --ext [.js,.jsm,.jsx,.xml,.html] toolkit/components/extensions/ browser/components/extensions/
/zfs-tardis/mozlab/desktop/mozilla-central-hg/toolkit/components/extensions/test/mochitest/test_ext_bookmarks.html
92:4 warning Block must not be padded by blank lines padded-blocks
94:9 error Expected indentation of 6 space characters but found 8 indent
95:9 error Expected indentation of 6 space characters but found 8 indent
96:9 error Expected indentation of 6 space characters but found 8 indent
97:9 error Expected indentation of 6 space characters but found 8 indent
@rpl
rpl / mozreview_failure.log
Created February 17, 2016 15:42
mozreview UnicodeDecodeError
Are you sure you want to push to remote? (y/n): y
pushing to ssh://reviewboard-hg.mozilla.org/gecko
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files (+1 heads)
remote: recorded push in pushlog
submitting 1 changesets for review
remote: ** unknown exception encountered, please report by visiting
@rpl
rpl / index.js
Last active March 31, 2016 13:10
Small Firefox for Android addon which use 'rpl/fennec-addon-preferences-workaround' as a dependency to workaround the preferences issue.
// do your stuff or import your modules
const { on } = require("sdk/system/events");
const { id } = require("sdk/self");
console.log("ADDON ID: ", id);
on(`${id}-cmdPressed`, function ({data}) {
console.log("CMD PRESSED", data);
@rpl
rpl / draft-getContentGlobals.patch
Created April 6, 2016 12:41
recognize content scripts on developer toolbox first opened
diff --git a/devtools/server/actors/webbrowser.js b/devtools/server/actors/webbrowser.js
--- a/devtools/server/actors/webbrowser.js
+++ b/devtools/server/actors/webbrowser.js
@@ -30,16 +30,17 @@ loader.lazyRequireGetter(this, "ProcessA
loader.lazyImporter(this, "AddonManager", "resource://gre/modules/AddonManager.jsm");
// Assumptions on events module:
// events needs to be dispatched synchronously,
// by calling the listeners in the order or registration.
loader.lazyRequireGetter(this, "events", "sdk/event/core");
@rpl
rpl / resolve-addon-icon-url.patch
Created April 13, 2016 11:51
resolve addon icon url
diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -6990,22 +6990,23 @@ AddonWrapper.prototype = {
icons[32] = icons[48] = this.getResourceURI("icon.png").spec;
}
if (this.hasResource("icon64.png")) {
icons[64] = this.getResourceURI("icon64.png").spec;
}
}
@rpl
rpl / blocked_image_promise_snippet.js
Created April 13, 2016 13:52
wait for blocked or loaded image
let blockedImagePromise = new Promise((resolve, reject) => {
let blockedImage = document.createElement("img");
blockedImage.setAttribute("src", "http://example.com/tests/toolkit/components/extensions/test/mochitest/file_image_bad.png");
let errorListener = () => {
browser.test.succeed("img got blocked as expected");
cleanupListeners();
resolve();
};
let loadListener = () => {
browser.test.fail("img loaded unexpected");
@rpl
rpl / proposal01.patch
Created April 13, 2016 18:41
"rename webNavigation MessageManager message names" proposals
diff --git a/toolkit/modules/addons/WebNavigation.jsm b/toolkit/modules/addons/WebNavigation.jsm
--- a/toolkit/modules/addons/WebNavigation.jsm
+++ b/toolkit/modules/addons/WebNavigation.jsm
@@ -20,23 +20,25 @@ Cu.import("resource://gre/modules/Servic
// onCreatedNavigationTarget, onHistoryStateUpdated
var Manager = {
listeners: new Map(),
init() {
@rpl
rpl / tweak-bug-1207394-test.patch
Created April 14, 2016 21:37
share content scripts helper function in WebExtensions mochitest
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html b/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html
--- a/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html
@@ -18,47 +18,45 @@
SimpleTest.registerCleanupFunction(() => {
SpecialPowers.clearUserPref("security.mixed_content.block_display_content");
});
let image = atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAA" +
"ACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=");
diff --git a/toolkit/components/extensions/ext-notifications.js b/toolkit/components/extensions/ext-notifications.js
--- a/toolkit/components/extensions/ext-notifications.js
+++ b/toolkit/components/extensions/ext-notifications.js
@@ -47,24 +47,31 @@ Notification.prototype = {
svc.closeAlert(this.id);
} catch (e) {
// This will fail if the OS doesn't support this function.
}
notificationsMap.get(this.extension).delete(this.id);
},
@rpl
rpl / mozconfig.artifact-debug
Created April 21, 2016 16:51
mozconfig file for experimental debug artifacts
# Automatically download and use compiled C++ components:
ac_add_options --enable-artifact-builds --debug-artifact
# Write build artifacts to:
mk_add_options MOZ_OBJDIR=./objdir-frontend-debug