mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1062132 - Uplift Add-on SDK to Firefox r=me
This commit is contained in:
parent
b8a13d4ea5
commit
ec99ade4ee
@ -7,22 +7,27 @@ module.metadata = {
|
||||
};
|
||||
|
||||
const { Cc, Ci, Cu } = require('chrome');
|
||||
const { isNative } = require('@loader/options');
|
||||
const { rootURI, metadata, isNative } = require('@loader/options');
|
||||
const { id, loadReason } = require('../self');
|
||||
const { descriptor, Sandbox, evaluate, main, resolveURI } = require('toolkit/loader');
|
||||
const { once } = require('../system/events');
|
||||
const { exit, env, staticArgs } = require('../system');
|
||||
const { when: unload } = require('../system/unload');
|
||||
const { loadReason } = require('../self');
|
||||
const { rootURI, metadata } = require("@loader/options");
|
||||
const globals = require('../system/globals');
|
||||
const xulApp = require('../system/xul-app');
|
||||
const { id } = require('sdk/self');
|
||||
const { get } = require('../preferences/service');
|
||||
const appShellService = Cc['@mozilla.org/appshell/appShellService;1'].
|
||||
getService(Ci.nsIAppShellService);
|
||||
const { preferences } = metadata;
|
||||
|
||||
const Startup = Cu.import("resource://gre/modules/sdk/system/Startup.js", {}).exports;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function () {
|
||||
return Cu.import("resource:///modules/devtools/ToolboxProcess.jsm", {}).
|
||||
BrowserToolboxProcess;
|
||||
});
|
||||
|
||||
// Initializes default preferences
|
||||
function setDefaultPrefs(prefsURI) {
|
||||
const prefs = Cc['@mozilla.org/preferences-service;1'].
|
||||
@ -102,7 +107,9 @@ function run(options) {
|
||||
// native-options does stuff directly with preferences key from package.json
|
||||
if (preferences && preferences.length > 0) {
|
||||
try {
|
||||
require('../preferences/native-options').enable({ preferences: preferences, id: id });
|
||||
require('../preferences/native-options').
|
||||
enable({ preferences: preferences, id: id }).
|
||||
catch(console.exception);
|
||||
}
|
||||
catch (error) {
|
||||
console.exception(error);
|
||||
@ -141,7 +148,6 @@ function run(options) {
|
||||
unload(program.onUnload);
|
||||
|
||||
if (typeof(program.main) === 'function') {
|
||||
|
||||
program.main({
|
||||
loadReason: loadReason,
|
||||
staticArgs: staticArgs
|
||||
@ -150,6 +156,10 @@ function run(options) {
|
||||
quit: exit
|
||||
});
|
||||
}
|
||||
|
||||
if (get("extensions." + id + ".sdk.debug.show", false)) {
|
||||
BrowserToolboxProcess.init({ addonID: id });
|
||||
}
|
||||
} catch (error) {
|
||||
console.exception(error);
|
||||
throw error;
|
||||
|
@ -55,6 +55,10 @@ DEFAULT_NO_CONNECTIONS_PREFS = {
|
||||
# Disable app update
|
||||
'app.update.enabled' : False,
|
||||
|
||||
# Disable about:newtab content fetch and ping
|
||||
'browser.newtabpage.directory.source': 'data:application/json,{"jetpack":1}',
|
||||
'browser.newtabpage.directory.ping': '',
|
||||
|
||||
# Point update checks to a nonexistent local URL for fast failures.
|
||||
'extensions.update.url' : 'http://localhost/extensions-dummy/updateURL',
|
||||
'extensions.blocklist.url' : 'http://localhost/extensions-dummy/blocklistURL',
|
||||
|
17
addon-sdk/source/test/addons/author-email/main.js
Normal file
17
addon-sdk/source/test/addons/author-email/main.js
Normal file
@ -0,0 +1,17 @@
|
||||
/* 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';
|
||||
|
||||
const { Cu } = require('chrome');
|
||||
const self = require('sdk/self');
|
||||
const { AddonManager } = Cu.import('resource://gre/modules/AddonManager.jsm', {});
|
||||
|
||||
exports.testContributors = function(assert, done) {
|
||||
AddonManager.getAddonByID(self.id, (addon) => {
|
||||
assert.equal(addon.creator.name, 'test <test@mozilla.com>', '< and > characters work');
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
||||
require('sdk/test/runner').runTestsFromModule(module);
|
4
addon-sdk/source/test/addons/author-email/package.json
Normal file
4
addon-sdk/source/test/addons/author-email/package.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"id": "test-addon-author-email@jetpack",
|
||||
"author": "test <test@mozilla.com>"
|
||||
}
|
@ -76,7 +76,7 @@ exports['test `load` events'] = function(assert, done) {
|
||||
});
|
||||
};
|
||||
|
||||
exports['test removeing listeners'] = function(assert, done) {
|
||||
exports['test removing listeners'] = function(assert, done) {
|
||||
Loader({
|
||||
onLoad: function(window) {
|
||||
assert.equal(window, this._window, 'windows should match');
|
||||
|
Loading…
Reference in New Issue
Block a user