Skip to content

Instantly share code, notes, and snippets.

const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
const {FileUtils} = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyServiceGetters(this, {
gCertDB: ["@mozilla.org/security/x509certdb;1", "nsIX509CertDB"],
});
function verifyJar(file) {
@rhelmer
rhelmer / hotfix.js
Created May 21, 2019 20:29
legacy hotfix
// First, check if there's a master password on the token DB. If so,
// the user will need to login before we can add a certificate.
try {
let tokendb = Cc["@mozilla.org/security/pk11tokendb;1"].getService(Ci.nsIPK11TokenDB);
let token = tokendb.getInternalKeyToken();
if (!token.checkPassword("")) {
token.login(true);
}
} catch (e) {
@rhelmer
rhelmer / gist:b18f50f668b0d6336997c30f6727dcfd
Last active March 12, 2019 22:45
WIP moving shield-addon-utils in-tree
diff --git a/toolkit/components/extensions/ext-toolkit.json b/toolkit/components/extensions/ext-toolkit.json
--- a/toolkit/components/extensions/ext-toolkit.json
+++ b/toolkit/components/extensions/ext-toolkit.json
@@ -152,6 +152,14 @@
["runtime"]
]
},
+ "study": {
+ "url": "chrome://extensions/content/parent/ext-study.js",
+ "schema": "chrome://extensions/content/schemas/study.json",
--- a/ptest/client_test.c 2018-09-28 02:06:50.207986209 +0000
+++ b/ptest/client_test.c 2018-09-28 02:07:12.445975672 +0000
@@ -9,10 +9,10 @@
#include <mprio.h>
#include "mutest.h"
-#include "test_util.h"
#include "prio/client.h"
#include "prio/server.h"
#include "prio/util.h"
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
const ENABLE_PROB = 0.01;
const ADDON_ID = "telemetry-coverage-bug1487578@mozilla.org";
const TOTAL_SAMPLES = 100000;
Cu.importGlobalProperties(["crypto", "TextEncoder"]);
XPCOMUtils.defineLazyServiceGetters(this, {
  1. Clone the gecko-dev (git version of mozilla-central) repository. It is quite large so only clone the latest 100 revisions:
$ git clone --depth=100 https://github.com/mozilla/gecko-dev
$ cd gecko-dev
  1. Install dependencies needed to build Firefox:
$ ./mach bootstrap
  1. Create a file called mozconfig with the following contents:
#include <assert.h>
#include <limits.h>
#include <nspr/prinit.h>
#include <nss/nss.h>
#include <nss/pk11pub.h>
#define ASSERT(a) (assert((a) != NULL))
#define KEYLEN (128/8)
diff --git a/third_party/prio/moz.build b/third_party/prio/moz.build
--- a/third_party/prio/moz.build
+++ b/third_party/prio/moz.build
@@ -52,3 +52,11 @@ SOURCES += [
]
FINAL_LIBRARY = 'xul'
+
+Program('browser-test')
+USE_LIBS += [
diff --git a/browser/app/moz.build b/browser/app/moz.build
--- a/browser/app/moz.build
+++ b/browser/app/moz.build
@@ -125,6 +125,9 @@ if CONFIG['MOZ_LINUX_32_SSE2_STARTUP_ERR
'-mno-sse', '-mno-sse2', '-mfpmath=387',
]
+if CONFIG['LIBPRIO']:
+ DEFINES['MOZ_LIBPRIO'] = True
+
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const ENABLE_PROB = 0.01;
const ADDON_ID = "...";
XPCOMUtils.defineLazyServiceGetters(this, {
uuidGen: ["@mozilla.org/uuid-generator;1", "nsIUUIDGenerator"],
});
async function generateVariate(seed, label) {