mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-30 20:13:32 +02:00
Halve the security errors at startup, but still annoyingly many of them.
This commit is contained in:
@@ -642,7 +642,7 @@ const CommandLine = Module("commandline", {
|
|||||||
commandline.triggerCallback("submit", mode, command);
|
commandline.triggerCallback("submit", mode, command);
|
||||||
}
|
}
|
||||||
// user pressed <Up> or <Down> arrow to cycle this._history completion
|
// user pressed <Up> or <Down> arrow to cycle this._history completion
|
||||||
else if (/^(<Up>|<Down>|<S-Up>|<S-Down>|<PageUp>|<PageDown>)$/.test(key)) {
|
else if (/^<(Up|Down|S-Up|S-Down|PageUp|PageDown)>$/.test(key)) {
|
||||||
// prevent tab from moving to the next field
|
// prevent tab from moving to the next field
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -651,7 +651,7 @@ const CommandLine = Module("commandline", {
|
|||||||
this._history.select(/Up/.test(key), !/(Page|S-)/.test(key));
|
this._history.select(/Up/.test(key), !/(Page|S-)/.test(key));
|
||||||
}
|
}
|
||||||
// user pressed <Tab> to get completions of a command
|
// user pressed <Tab> to get completions of a command
|
||||||
else if (key == "<Tab>" || key == "<S-Tab>") {
|
else if (/^<(Tab|S-Tab)>$/.test(key)) {
|
||||||
// prevent tab from moving to the next field
|
// prevent tab from moving to the next field
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -675,7 +675,7 @@ const CommandLine = Module("commandline", {
|
|||||||
}
|
}
|
||||||
else if (event.type == "keyup") {
|
else if (event.type == "keyup") {
|
||||||
let key = events.toString(event);
|
let key = events.toString(event);
|
||||||
if (key == "<Tab>" || key == "<S-Tab>")
|
if (/^<(Tab|S-Tab)>$/.test(key))
|
||||||
this._tabTimer.flush();
|
this._tabTimer.flush();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
36
common/content/help-single.xsl
Normal file
36
common/content/help-single.xsl
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<!DOCTYPE document SYSTEM "chrome://liberator/content/liberator.dtd">
|
||||||
|
|
||||||
|
<xsl:stylesheet version="1.0"
|
||||||
|
xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:liberator="http://vimperator.org/namespaces/liberator"
|
||||||
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:str="http://exslt.org/strings"
|
||||||
|
xmlns:exsl="http://exslt.org/common"
|
||||||
|
extension-element-prefixes="exsl str">
|
||||||
|
|
||||||
|
<xsl:output method="xml" indent="no"/>
|
||||||
|
|
||||||
|
<xsl:variable name="root" select="/liberator:document"/>
|
||||||
|
<xsl:variable name="tags">
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
<xsl:for-each select="$root//@tag|$root//liberator:tags/text()|$root//liberator:tag/text()">
|
||||||
|
<xsl:value-of select="concat(., ' ')"/>
|
||||||
|
</xsl:for-each>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
|
<xsl:template name="parse-tags">
|
||||||
|
<xsl:param name="text"/>
|
||||||
|
<div liberator:highlight="HelpTags">
|
||||||
|
<xsl:for-each select="str:tokenize($text)">
|
||||||
|
<a id="{.}" liberator:highlight="HelpTag"><xsl:value-of select="."/></a>
|
||||||
|
</xsl:for-each>
|
||||||
|
</div>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="/">
|
||||||
|
<xsl:call-template name="parse-tags">
|
||||||
|
<xsl:with-param name="text" select="$tags"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:template>
|
||||||
|
</xsl:stylesheet>
|
||||||
@@ -544,15 +544,20 @@ const Liberator = Module("liberator", {
|
|||||||
initHelp: function () {
|
initHelp: function () {
|
||||||
let namespaces = [config.name.toLowerCase(), "liberator"];
|
let namespaces = [config.name.toLowerCase(), "liberator"];
|
||||||
services.get("liberator:").init({});
|
services.get("liberator:").init({});
|
||||||
|
|
||||||
let tagMap = services.get("liberator:").HELP_TAGS;
|
let tagMap = services.get("liberator:").HELP_TAGS;
|
||||||
let fileMap = services.get("liberator:").FILE_MAP;
|
let fileMap = services.get("liberator:").FILE_MAP;
|
||||||
let overlayMap = services.get("liberator:").OVERLAY_MAP;
|
let overlayMap = services.get("liberator:").OVERLAY_MAP;
|
||||||
|
|
||||||
|
// Left as an XPCOM instantiation so it can easilly be moved
|
||||||
|
// into XPCOM code.
|
||||||
function XSLTProcessor(sheet) {
|
function XSLTProcessor(sheet) {
|
||||||
let xslt = Cc["@mozilla.org/document-transformer;1?type=xslt"].createInstance(Ci.nsIXSLTProcessor);
|
let xslt = Cc["@mozilla.org/document-transformer;1?type=xslt"].createInstance(Ci.nsIXSLTProcessor);
|
||||||
xslt.importStylesheet(util.httpGet(sheet).responseXML);
|
xslt.importStylesheet(util.httpGet(sheet).responseXML);
|
||||||
return xslt;
|
return xslt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Find help and overlay files with the given name.
|
||||||
function findHelpFile(file) {
|
function findHelpFile(file) {
|
||||||
let result = [];
|
let result = [];
|
||||||
for (let [, namespace] in Iterator(namespaces)) {
|
for (let [, namespace] in Iterator(namespaces)) {
|
||||||
@@ -568,29 +573,36 @@ const Liberator = Module("liberator", {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
// Find the tags in the document.
|
||||||
function addTags(file, doc) {
|
function addTags(file, doc) {
|
||||||
doc = XSLT.transformToDocument(doc);
|
doc = XSLT.transformToDocument(doc);
|
||||||
for (let elem in util.evaluateXPath("//xhtml:a/@id", doc))
|
for (let elem in util.evaluateXPath("//xhtml:a/@id", doc))
|
||||||
tagMap[elem.value] = file;
|
tagMap[elem.value] = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
const XSLT = XSLTProcessor("chrome://liberator/content/help.xsl");
|
const XSLT = XSLTProcessor("chrome://liberator/content/help-single.xsl");
|
||||||
|
|
||||||
|
// Scrape the list of help files from all.xml
|
||||||
|
// Always process main and overlay files, since XSLTProcessor and
|
||||||
|
// XMLHttpRequest don't allow access to chrome documents.
|
||||||
tagMap.all = "all";
|
tagMap.all = "all";
|
||||||
let files = findHelpFile("all").map(function (doc)
|
let files = findHelpFile("all").map(function (doc)
|
||||||
[f.value for (f in util.evaluateXPath(
|
[f.value for (f in util.evaluateXPath(
|
||||||
"//liberator:include/@href", doc))]);
|
"//liberator:include/@href", doc))]);
|
||||||
|
|
||||||
|
// Scrape the tags from the rest of the help files.
|
||||||
util.Array.flatten(files).forEach(function (file) {
|
util.Array.flatten(files).forEach(function (file) {
|
||||||
findHelpFile(file).forEach(function (doc) {
|
findHelpFile(file).forEach(function (doc) {
|
||||||
addTags(file, doc);
|
addTags(file, doc);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Process plugin help entries.
|
||||||
XML.ignoreWhiteSpace = false;
|
XML.ignoreWhiteSpace = false;
|
||||||
XML.prettyPrinting = false;
|
XML.prettyPrinting = false;
|
||||||
XML.prettyPrinting = true; // Should be false, but ignoreWhiteSpace=false doesn't work correctly. This is the lesser evil.
|
XML.prettyPrinting = true; // Should be false, but ignoreWhiteSpace=false doesn't work correctly. This is the lesser evil.
|
||||||
XML.prettyIndent = 4;
|
XML.prettyIndent = 4;
|
||||||
|
|
||||||
let body = XML();
|
let body = XML();
|
||||||
for (let [, context] in Iterator(plugins.contexts))
|
for (let [, context] in Iterator(plugins.contexts))
|
||||||
if (context.INFO instanceof XML)
|
if (context.INFO instanceof XML)
|
||||||
@@ -600,10 +612,8 @@ const Liberator = Module("liberator", {
|
|||||||
let help = '<?xml version="1.0"?>\n' +
|
let help = '<?xml version="1.0"?>\n' +
|
||||||
'<?xml-stylesheet type="text/xsl" href="chrome://liberator/content/help.xsl"?>\n' +
|
'<?xml-stylesheet type="text/xsl" href="chrome://liberator/content/help.xsl"?>\n' +
|
||||||
'<!DOCTYPE document SYSTEM "chrome://liberator/content/liberator.dtd">' +
|
'<!DOCTYPE document SYSTEM "chrome://liberator/content/liberator.dtd">' +
|
||||||
<document
|
<document xmlns={NS}
|
||||||
name="plugins"
|
name="plugins" title={config.name + " Plugins"}>
|
||||||
title={config.name + " Plugins"}
|
|
||||||
xmlns={NS}>
|
|
||||||
<h1 tag="using-plugins">Using Plugins</h1>
|
<h1 tag="using-plugins">Using Plugins</h1>
|
||||||
|
|
||||||
{body}
|
{body}
|
||||||
|
|||||||
@@ -92,12 +92,6 @@ window.addEventListener("load", function () {
|
|||||||
|
|
||||||
function init(mod, module)
|
function init(mod, module)
|
||||||
function () module.INIT[mod].call(modules[module.name], modules[mod]);
|
function () module.INIT[mod].call(modules[module.name], modules[mod]);
|
||||||
function init(mod, module)
|
|
||||||
function () {
|
|
||||||
if (!(mod in modules))
|
|
||||||
dump(mod + " not in modules");
|
|
||||||
return module.INIT[mod].call(modules[module.name], modules[mod]);
|
|
||||||
}
|
|
||||||
for (let mod in values(loaded)) {
|
for (let mod in values(loaded)) {
|
||||||
try {
|
try {
|
||||||
if (mod in module.INIT)
|
if (mod in module.INIT)
|
||||||
|
|||||||
Reference in New Issue
Block a user