mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-22 16:25:47 +01:00
Fix help on FF3, overly long URL chains in context filenames, etc.
This commit is contained in:
13
common/bootstrap.js
vendored
13
common/bootstrap.js
vendored
@@ -121,14 +121,14 @@ function init() {
|
|||||||
|
|
||||||
let result = [];
|
let result = [];
|
||||||
|
|
||||||
|
let suffix = "-";
|
||||||
|
let chars = "0123456789abcdefghijklmnopqrstuv";
|
||||||
|
for (let n = Date.now(); n; n = Math.round(n / chars.length))
|
||||||
|
suffix += "0123456789abcdef"[n % chars.length];
|
||||||
|
|
||||||
for each (let line in manifest.split("\n")) {
|
for each (let line in manifest.split("\n")) {
|
||||||
let fields = line.split(/\s+/);
|
let fields = line.split(/\s+/);
|
||||||
switch(fields[0]) {
|
switch(fields[0]) {
|
||||||
case "#":
|
|
||||||
if (fields[1] == "Suffix:")
|
|
||||||
var suffix = "-" + fields[2];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "category":
|
case "category":
|
||||||
categoryManager.addCategoryEntry(fields[1], fields[2], fields[3], false, true);
|
categoryManager.addCategoryEntry(fields[1], fields[2], fields[3], false, true);
|
||||||
break;
|
break;
|
||||||
@@ -140,8 +140,9 @@ function init() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "resource":
|
case "resource":
|
||||||
resources.push(fields[1]);
|
resources.push(fields[1], fields[1] + suffix);
|
||||||
resourceProto.setSubstitution(fields[1], getURI(fields[2]));
|
resourceProto.setSubstitution(fields[1], getURI(fields[2]));
|
||||||
|
resourceProto.setSubstitution(fields[1] + suffix, getURI(fields[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
* should be loaded.
|
* should be loaded.
|
||||||
*/
|
*/
|
||||||
loadScript: function (uri, context) {
|
loadScript: function (uri, context) {
|
||||||
services.subscriptLoader.loadSubScript(uri, context, File.defaultEncoding);
|
JSMLoader.loadSubScript(uri, context, File.defaultEncoding);
|
||||||
},
|
},
|
||||||
|
|
||||||
userEval: function (str, context, fileName, lineNumber) {
|
userEval: function (str, context, fileName, lineNumber) {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dump("=========== load bootstrap.jsm ===========\n");
|
|
||||||
|
|
||||||
if (!JSMLoader || JSMLoader.bump != 1)
|
if (!JSMLoader || JSMLoader.bump != 1)
|
||||||
var JSMLoader = {
|
var JSMLoader = {
|
||||||
@@ -16,6 +15,7 @@ if (!JSMLoader || JSMLoader.bump != 1)
|
|||||||
factories: [],
|
factories: [],
|
||||||
globals: {},
|
globals: {},
|
||||||
io: Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService),
|
io: Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService),
|
||||||
|
loader: Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader),
|
||||||
manager: Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar),
|
manager: Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar),
|
||||||
stale: {},
|
stale: {},
|
||||||
suffix: "",
|
suffix: "",
|
||||||
@@ -29,17 +29,13 @@ if (!JSMLoader || JSMLoader.bump != 1)
|
|||||||
if (url.indexOf(":") === -1)
|
if (url.indexOf(":") === -1)
|
||||||
url = "resource://dactyl" + this.suffix + "/" + url;
|
url = "resource://dactyl" + this.suffix + "/" + url;
|
||||||
|
|
||||||
let stale = this.stale[url];
|
if (url in this.stale) {
|
||||||
if (stale) {
|
let stale = this.stale[url];
|
||||||
dump("JSMLoader: load " + name + " " + stale + "\n");
|
|
||||||
dump("JSMLoader: load " + name + " " + this.getTarget(url) + "\n");
|
|
||||||
delete this.stale[url];
|
delete this.stale[url];
|
||||||
|
|
||||||
let global = this.globals[url];
|
let global = this.globals[url];
|
||||||
if (stale === this.getTarget(url))
|
if (stale === this.getTarget(url))
|
||||||
Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
|
this.loadSubScript(url, global.global || global);
|
||||||
.getService(Components.interfaces.mozIJSSubScriptLoader)
|
|
||||||
.loadSubScript(url, global.global || global);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -58,6 +54,7 @@ if (!JSMLoader || JSMLoader.bump != 1)
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
loadSubScript: function loadSubScript() this.loader.loadSubScript.apply(this.loader, arguments),
|
||||||
cleanup: function unregister() {
|
cleanup: function unregister() {
|
||||||
for each (let factory in this.factories.splice(0))
|
for each (let factory in this.factories.splice(0))
|
||||||
this.manager.unregisterFactory(factory.classID, factory);
|
this.manager.unregisterFactory(factory.classID, factory);
|
||||||
@@ -94,6 +91,6 @@ Components.classes["@mozilla.org/fuel/application;1"]
|
|||||||
.storage.set("dactyl.JSMLoader", JSMLoader);
|
.storage.set("dactyl.JSMLoader", JSMLoader);
|
||||||
|
|
||||||
JSMLoader.load("base.jsm", this);
|
JSMLoader.load("base.jsm", this);
|
||||||
dump("exports: " + this.JSMLoader+" " +this.EXPORTED_SYMBOLS + "\n");
|
|
||||||
|
|
||||||
}catch(e){dump(e+"\n"+(e.stack || Error().stack));Components.utils.reportError(e)}
|
}catch(e){ dump(e + "\n" + (e.stack || Error().stack)); Components.utils.reportError(e) }
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,8 @@ var ConfigBase = Class("ConfigBase", {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return array(f.leafName
|
return array(f.leafName
|
||||||
for (f in util.getFile(uri).iterDirectory())
|
// Fails on FF3: for (f in util.getFile(uri).iterDirectory())
|
||||||
|
for (f in values(util.getFile(uri).readDirectory()))
|
||||||
if (f.isDirectory())).array;
|
if (f.isDirectory())).array;
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@@ -636,7 +637,7 @@ var ConfigBase = Class("ConfigBase", {
|
|||||||
]]></>)
|
]]></>)
|
||||||
});
|
});
|
||||||
|
|
||||||
services.subscriptLoader.loadSubScript("resource://dactyl-local-content/config.js", this);
|
JSMLoader.loadSubScript("resource://dactyl-local-content/config.js", this);
|
||||||
|
|
||||||
config.INIT = update(Object.create(config.INIT), config.INIT, {
|
config.INIT = update(Object.create(config.INIT), config.INIT, {
|
||||||
init: function init(dactyl, modules, window) {
|
init: function init(dactyl, modules, window) {
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ var Overlay = Module("Overlay", {
|
|||||||
|
|
||||||
const create = window.Object.create || (function () {
|
const create = window.Object.create || (function () {
|
||||||
window.__dactyl_eval_string = "(function (proto) ({ __proto__: proto }))";
|
window.__dactyl_eval_string = "(function (proto) ({ __proto__: proto }))";
|
||||||
services.subscriptLoader.loadSubScript(BASE + "eval.js", window);
|
JSMLoader.loadSubScript(BASE + "eval.js", window);
|
||||||
|
|
||||||
let res = window.__dactyl_eval_result;
|
let res = window.__dactyl_eval_result;
|
||||||
delete window.__dactyl_eval_string;
|
delete window.__dactyl_eval_string;
|
||||||
@@ -110,7 +110,7 @@ var Overlay = Module("Overlay", {
|
|||||||
load: function load(script) {
|
load: function load(script) {
|
||||||
for (let [i, base] in Iterator(prefix)) {
|
for (let [i, base] in Iterator(prefix)) {
|
||||||
try {
|
try {
|
||||||
services.subscriptLoader.loadSubScript(base + script + ".js", modules, "UTF-8");
|
JSMLoader.loadSubScript(base + script + ".js", modules, "UTF-8");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ defineModule("sanitizer", {
|
|||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
let tmp = {};
|
let tmp = {};
|
||||||
services.subscriptLoader.loadSubScript("chrome://browser/content/sanitize.js", tmp);
|
JSMLoader.loadSubScript("chrome://browser/content/sanitize.js", tmp);
|
||||||
tmp.Sanitizer.prototype.__proto__ = Class.prototype;
|
tmp.Sanitizer.prototype.__proto__ = Class.prototype;
|
||||||
|
|
||||||
var Range = Struct("min", "max");
|
var Range = Struct("min", "max");
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ default xml namespace = XHTML;
|
|||||||
memoize(this, "Commands", function () {
|
memoize(this, "Commands", function () {
|
||||||
// FIXME
|
// FIXME
|
||||||
let obj = { Module: Class };
|
let obj = { Module: Class };
|
||||||
services.subscriptLoader.loadSubScript("chrome://dactyl/content/commands.js", obj);
|
JSMLoader.loadSubScript("resource://dactyl-content/commands.js", obj);
|
||||||
return obj.Commands;
|
return obj.Commands;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
BEGIN {
|
BEGIN {
|
||||||
chrome = "chrome"
|
chrome = "chrome"
|
||||||
if (suffix) {
|
if (suffix)
|
||||||
chrome = suffix
|
chrome = suffix
|
||||||
print "# Suffix: " suffix
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
{ content = $1 ~ /^(content|skin|locale|resource)$/ }
|
{ content = $1 ~ /^(content|skin|locale|resource)$/ }
|
||||||
content && $NF ~ /^[a-z]/ { $NF = "/" name "/" $NF }
|
content && $NF ~ /^[a-z]/ { $NF = "/" name "/" $NF }
|
||||||
@@ -17,10 +15,6 @@ content {
|
|||||||
{
|
{
|
||||||
sub("^\\.\\./common/", "", $NF)
|
sub("^\\.\\./common/", "", $NF)
|
||||||
print
|
print
|
||||||
if (content && suffix && $1 == "resource") {
|
|
||||||
$2 = $2 "-" suffix
|
|
||||||
print
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# vim:se sts=4 sw=4 et ft=awk:
|
# vim:se sts=4 sw=4 et ft=awk:
|
||||||
|
|||||||
Reference in New Issue
Block a user