Bug 1480610 - Implement Firefox Monitor add-on stub. r=johannh

This commit is contained in:
Nihanth Subramanya 2018-08-02 16:41:47 +02:00
Родитель 6b47da6dac
Коммит d60e939f6a
7 изменённых файлов: 90 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1 @@
browser.fxmonitor.start();

Просмотреть файл

@ -0,0 +1,24 @@
{
"manifest_version": 2,
"name": "Firefox Monitor",
"version": "2.0",
"background": {
"scripts": ["background.js"]
},
"applications": {
"gecko": {
"id": "fxmonitor@mozilla.org",
"strict_min_version": "62.0"
}
},
"experiment_apis": {
"fxmonitor": {
"schema": "./privileged/schema.json",
"parent": {
"scopes": ["addon_parent"],
"script": "./privileged/api.js",
"paths": [["fxmonitor"]]
}
}
}
}

Просмотреть файл

@ -0,0 +1,19 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
with Files("**"):
BUG_COMPONENT = ("Firefox", "Firefox Monitor")
FINAL_TARGET_FILES.features['fxmonitor@mozilla.org'] += [
'background.js',
'manifest.json'
]
FINAL_TARGET_FILES.features['fxmonitor@mozilla.org']['privileged'] += [
'privileged/api.js',
'privileged/FirefoxMonitor.jsm',
'privileged/schema.json'
]

Просмотреть файл

@ -0,0 +1,14 @@
ChromeUtils.defineModuleGetter(this, "Preferences",
"resource://gre/modules/Preferences.jsm");
this.FirefoxMonitor = {
kEnabledPref: "extensions.fxmonitor.enabled",
extension: null,
init(aExtension) {
this.extension = aExtension;
if (!Preferences.get(this.kEnabledPref, false)) {
return;
}
},
};

Просмотреть файл

@ -0,0 +1,18 @@
ChromeUtils.defineModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
this.fxmonitor = class extends ExtensionAPI {
getAPI(context) {
const FirefoxMonitorContainer = {};
Services.scriptloader.loadSubScript(
context.extension.getURL("privileged/FirefoxMonitor.jsm"),
FirefoxMonitorContainer);
return {
fxmonitor: {
async start() {
FirefoxMonitorContainer.FirefoxMonitor.init(context.extension);
},
},
};
}
};

Просмотреть файл

@ -0,0 +1,13 @@
[
{
"namespace": "fxmonitor",
"functions": [
{
"name": "start",
"type": "function",
"async": true,
"parameters": []
}
]
}
]

Просмотреть файл

@ -7,6 +7,7 @@
DIRS += [
'aushelper',
'formautofill',
'fxmonitor',
'onboarding',
'pdfjs',
'pocket',