Skip to content

Instantly share code, notes, and snippets.

View daleharvey's full-sized avatar

Dale Harvey daleharvey

View GitHub Profile
From eb3687c365f4758d85a919812dc6c917a79e2458 Mon Sep 17 00:00:00 2001
From: Dale Harvey <dale@arandomurl.com>
Date: Mon, 21 Jan 2019 21:33:25 +0000
Subject: [PATCH 1/2] Bug 1486820 - Convert Opensearch files to WebExtensions.
r?mkaply, r?mixedpuppy
Tags: #secure-revision
Differential Revision: https://phabricator.services.mozilla.com/D17213
---
"use strict";
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
const { Region } = ChromeUtils.import("resource://gre/modules/Region.jsm");
function useHttpServer() {
let server = new HttpServer();
server.start(-1);
Services.prefs.setCharPref(
"browser.region.network.url",
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const {ExtensionData} = ChromeUtils.import("resource://gre/modules/Extension.jsm");
const {ExtensionPermissions} = ChromeUtils.import("resource://gre/modules/ExtensionPermissions.jsm");
const SEARCH_EXTENSION_PATH = "resource://search-extensions";
// Works fine
const { SearchService } = ChromeUtils.import(
"resource://gre/modules/SearchService.jsm"
);
but
const { SearchTestUtils } = ChromeUtils.import(
"resource://testing-common/SearchTestUtils.jsm"
);
~/src/gecko (master)$ ./mach run -profile /Users/dale/Desktop/8ctzi41v.default-nightly-1
0:00.66 /Users/dale/src/gecko/objdir/firefox-opt/dist/Nightly.app/Contents/MacOS/firefox -profile /Users/dale/Desktop/8ctzi41v.default-nightly-1 -no-remote -foreground
*** Search: SearchService.init
*** Search: _init start
*** Search: SearchService.init
*** Search: _loadEngines: start
*** Search: _findEngines: looking for engines in JARs
*** Search: _loadEngines: loading - google-b-d,amazon-en-GB,bing,ddg,ebay-uk,twitter,wikipedia
*** Search: _loadEngines: Absent or outdated cache. Loading engines from disk.
*** Search: _loadEngines: Found previously installed extension
~/src/gecko (master)$ ./mach run -profile ~/Desktop/tmpprofile/
0:00.51 /Users/dale/src/gecko/objdir/firefox-opt/dist/Nightly.app/Contents/MacOS/firefox -profile /Users/dale/Desktop/tmpprofile/ -no-remote -foreground
*** Search: SearchService.init
*** Search: _init start
*** Search: SearchService.init
*** Search: _loadEngines: start
*** Search: _findEngines: looking for engines in JARs
*** Search: _loadEngines: loading - google-b-d,amazon-en-GB,bing,ddg,ebay-uk,twitter,wikipedia
*** Search: _loadEngines: Absent or outdated cache. Loading engines from disk.
*** Search: _loadEngines: Found previously installed extension
~/src/gecko (master)$ ./mach run -profile ~/Desktop/newtemp/
0:00.57 /Users/dale/src/gecko/objdir/firefox-opt/dist/Nightly.app/Contents/MacOS/firefox -profile /Users/dale/Desktop/newtemp/ -no-remote -foreground
*** Search: SearchService.init
*** Search: _init start
*** Search: SearchService.init
*** Search: _loadEngines: start
*** Search: _findEngines: looking for engines in JARs
*** Search: _loadEngines: loading - google-b-d,amazon-en-GB,bing,ddg,ebay-uk,twitter,wikipedia
*** Search: _loadEngines: Absent or outdated cache. Loading engines from disk.
*** Search: _loadEngines: Found previously installed extension
> file:///Users/dale/src/palmtree-result-extension/src/experiments/urlbar/mozTrie.jsm - EXPORTED_SYMBOLS is not an array.
$ cat /Users/dale/src/palmtree-result-extension/src/experiments/urlbar/mozTrie.jsm
/* 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/. */
const EXPORTED_SYMBOLS = [ "Foo" ];
function Foo() {
queryScorer.addDocument({
id: "fubar",
phrases: [
"home decor",
"home decoration",
"home decoration ideas",
"home decor stores"
]
})
~/src/gecko/browser/components/newtab (master)$ ./bin/try-runner.js
bash: ./bin/try-runner.js: Permission denied
~/src/gecko/browser/components/newtab (master)$ node ./bin/try-runner.js
TEST START | checkBundles
/Users/dale/src/gecko/browser/components/newtab/node_modules/node-sass/lib/binding.js:13
throw new Error(errors.unsupportedEnvironment());
^
Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (83)
For more information on which environments are supported please see: