mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 07:28:00 +01:00
Move magical-non-bootstrappable manifest directives to config.json.
This commit is contained in:
45
common/bootstrap.js
vendored
45
common/bootstrap.js
vendored
@@ -215,32 +215,28 @@ let JSMLoader = {
|
||||
function init() {
|
||||
debug("bootstrap: init");
|
||||
|
||||
let manifestURI = getURI("chrome.manifest");
|
||||
let manifest = httpGet(manifestURI)
|
||||
.responseText
|
||||
.replace(/#(resource)#/g, "$1")
|
||||
.replace(/^\s*|\s*$|#.*/g, "")
|
||||
.replace(/^\s*\n/gm, "");
|
||||
let manifest = JSON.parse(httpGet(getURI("config.json"))
|
||||
.responseText);
|
||||
|
||||
for each (let line in manifest.split("\n")) {
|
||||
let fields = line.split(/\s+/);
|
||||
switch (fields[0]) {
|
||||
case "category":
|
||||
categoryManager.addCategoryEntry(fields[1], fields[2], fields[3], false, true);
|
||||
categories.push([fields[1], fields[2]]);
|
||||
break;
|
||||
case "component":
|
||||
components[fields[1]] = new FactoryProxy(getURI(fields[2]).spec, fields[1]);
|
||||
break;
|
||||
case "contract":
|
||||
components[fields[2]].contractID = fields[1];
|
||||
break;
|
||||
if (!manifest.categories)
|
||||
manifest.categories = [];
|
||||
|
||||
case "resource":
|
||||
moduleName = moduleName || fields[1];
|
||||
resources.push(fields[1]);
|
||||
resourceProto.setSubstitution(fields[1], getURI(fields[2]));
|
||||
for (let [classID, { contract, path, category }] of Iterator(manifest.components || {})) {
|
||||
components[classID] = new FactoryProxy(getURI(path).spec, classID, contract);
|
||||
if (category)
|
||||
manifest.categories.push([category[0], category[1], contract]);
|
||||
}
|
||||
|
||||
for (let [category, id, value] of manifest.categories) {
|
||||
categoryManager.addCategoryEntry(category, id, value,
|
||||
false, true);
|
||||
categories.push([category, id]);
|
||||
}
|
||||
|
||||
for (let [pkg, path] in Iterator(manifest.resources || {})) {
|
||||
moduleName = moduleName || pkg;
|
||||
resources.push(pkg);
|
||||
resourceProto.setSubstitution(pkg, getURI(path));
|
||||
}
|
||||
|
||||
JSMLoader.config = JSON.parse(httpGet("resource://dactyl-local/config.json").responseText);
|
||||
@@ -381,9 +377,10 @@ function startup(data, reason) {
|
||||
* @param {string} url The URL of the module housing the real factory.
|
||||
* @param {string} classID The CID of the class this factory represents.
|
||||
*/
|
||||
function FactoryProxy(url, classID) {
|
||||
function FactoryProxy(url, classID, contractID) {
|
||||
this.url = url;
|
||||
this.classID = Components.ID(classID);
|
||||
this.contractID = contractID;
|
||||
}
|
||||
FactoryProxy.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI(Ci.nsIFactory),
|
||||
|
||||
@@ -1,17 +1 @@
|
||||
resource dactyl ../common/modules/
|
||||
resource dactyl-common ../common/
|
||||
resource dactyl-content ../common/content/
|
||||
resource dactyl-skin ../common/skin/
|
||||
resource dactyl-locale ../common/locale/
|
||||
|
||||
resource dactyl-local ./
|
||||
resource dactyl-local-content content/
|
||||
resource dactyl-local-skin skin/
|
||||
resource dactyl-local-locale locale/
|
||||
|
||||
content dactyl ../common/content/
|
||||
|
||||
component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js
|
||||
contract @mozilla.org/commandlinehandler/general-startup;1?type=dactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}
|
||||
category command-line-handler m-dactyl @mozilla.org/commandlinehandler/general-startup;1?type=dactyl
|
||||
|
||||
|
||||
@@ -9,6 +9,27 @@
|
||||
"resource://dactyl/"
|
||||
],
|
||||
|
||||
"resources": {
|
||||
"dactyl": "../common/modules/",
|
||||
"dactyl-common": "../common/",
|
||||
"dactyl-content": "../common/content/",
|
||||
"dactyl-skin": "../common/skin/",
|
||||
"dactyl-locale": "../common/locale/",
|
||||
|
||||
"dactyl-local": "./",
|
||||
"dactyl-local-content": "content/",
|
||||
"dactyl-local-skin": "skin/",
|
||||
"dactyl-local-locale": "locale/"
|
||||
},
|
||||
|
||||
"components": {
|
||||
"{16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}": {
|
||||
"path": "components/commandline-handler.js",
|
||||
"contract": "@mozilla.org/commandlinehandler/general-startup;1?type=dactyl",
|
||||
"category": ["command-line-handler", "m-dactyl"]
|
||||
}
|
||||
},
|
||||
|
||||
"autocommands": {
|
||||
"BookmarkAdd": "Triggered after a page is bookmarked",
|
||||
"BookmarkChange": "Triggered after a page's bookmark is changed",
|
||||
|
||||
Reference in New Issue
Block a user