1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 18:44:14 +01:00

Death to E4X and stuff.

This commit is contained in:
Kris Maglione
2012-11-28 20:24:44 -08:00
parent 23b6c07666
commit 276956284e
19 changed files with 129 additions and 88 deletions

View File

@@ -57,9 +57,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
delete window.liberator; delete window.liberator;
// Prevents box ordering bugs after our stylesheet is removed. // Prevents box ordering bugs after our stylesheet is removed.
styles.system.add("cleanup-sheet", config.styleableChrome, <![CDATA[ styles.system.add("cleanup-sheet", config.styleableChrome, literal(/*
#TabsToolbar tab { display: none; } #TabsToolbar tab { display: none; }
]]>); */));
styles.unregisterSheet("resource://dactyl-skin/dactyl.css"); styles.unregisterSheet("resource://dactyl-skin/dactyl.css");
DOM('#TabsToolbar tab', document).style.display; DOM('#TabsToolbar tab', document).style.display;
}, },
@@ -1055,15 +1055,15 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
}, this); }, this);
}, },
stringToURLArray: deprecated("dactyl.parseURLs", "parseURLs"), stringToURLArray: deprecated("dactyl.parseURLs", "parseURLs"),
urlish: Class.Memoize(function () util.regexp(<![CDATA[ urlish: Class.Memoize(function () util.regexp(literal(/*
^ ( ^ (
<domain>+ (:\d+)? (/ .*) | <domain>+ (:\d+)? (/ .*) |
<domain>+ (:\d+) | <domain>+ (:\d+) |
<domain>+ \. [a-z0-9]+ | <domain>+ \. [a-z0-9]+ |
localhost localhost
) $ ) $
]]>, "ix", { */), "ix", {
domain: util.regexp(String.replace(<![CDATA[ domain: util.regexp(String.replace(literal(/*
[^ [^
U0000-U002c // U002d-U002e --. U0000-U002c // U002d-U002e --.
U002f // / U002f // /
@@ -1072,7 +1072,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
U005b-U0060 // U0061-U007a A-Z U005b-U0060 // U0061-U007a A-Z
U007b-U007f U007b-U007f
] ]
]]>, /U/g, "\\u"), "x") */), /U/g, "\\u"), "x")
})), })),
pluginFiles: {}, pluginFiles: {},

View File

@@ -3,7 +3,7 @@
// //
// This work is licensed for reuse under an MIT license. Details are // This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file. // given in the LICENSE.txt file included with this file.
/* use strict */ "use strict";
/** @scope modules */ /** @scope modules */

View File

@@ -487,7 +487,9 @@ var Modes = Module("modes", {
update(StackElement.prototype, { update(StackElement.prototype, {
get toStringParams() !loaded.modes ? this.main.name : [ get toStringParams() !loaded.modes ? this.main.name : [
this.main.name, this.main.name,
<>({ modes.all.filter(function (m) this.extended & m, this).map(function (m) m.name).join("|") })</> ["(", modes.all.filter(function (m) this.extended & m, this)
.map(function (m) m.name).join("|"),
")"].join("")
] ]
}); });
return StackElement; return StackElement;

View File

@@ -4,7 +4,7 @@
// //
// This work is licensed for reuse under an MIT license. Details are // This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file. // given in the LICENSE.txt file included with this file.
/* use strict */ "use strict";
/** @scope modules */ /** @scope modules */
@@ -15,28 +15,26 @@ var StatusLine = Module("statusline", {
this.baseGroup = this.statusBar == this._statusLine ? "StatusLine " : ""; this.baseGroup = this.statusBar == this._statusLine ? "StatusLine " : "";
if (this.statusBar.localName == "toolbar") { if (this.statusBar.localName == "toolbar") {
styles.system.add("addon-bar", config.styleableChrome, <css><![CDATA[ styles.system.add("addon-bar", config.styleableChrome, literal(/*
#status-bar { margin-top: 0 !important; } #status-bar { margin-top: 0 !important; }
#addon-bar > statusbar { -moz-box-flex: 1 } #addon-bar > statusbar { -moz-box-flex: 1 }
#addon-bar > #addonbar-closebutton { visibility: collapse; } #addon-bar > #addonbar-closebutton { visibility: collapse; }
#addon-bar > xul|toolbarspring { visibility: collapse; } #addon-bar > xul|toolbarspring { visibility: collapse; }
]]></css>); */));
overlay.overlayWindow(window, { overlay.overlayWindow(window, {
append: [ append: [
["statusbar", { id: "status-bar", ordinal: "0" }]] ["statusbar", { id: "status-bar", ordinal: "0" }]]
}); });
highlight.loadCSS(util.compileMacro(<![CDATA[ highlight.loadCSS(util.compileMacro(literal(/*
!AddonBar;#addon-bar { !AddonBar;#addon-bar {
/* The Add-on Bar */
padding-left: 0 !important; padding-left: 0 !important;
min-height: 18px !important; min-height: 18px !important;
-moz-appearance: none !important; -moz-appearance: none !important;
<padding> <padding>
} }
!AddonButton;#addon-bar xul|toolbarbutton { !AddonButton;#addon-bar xul|toolbarbutton {
/* An Add-on Bar button */
-moz-appearance: none !important; -moz-appearance: none !important;
padding: 0 !important; padding: 0 !important;
border-width: 0px !important; border-width: 0px !important;
@@ -44,13 +42,12 @@ var StatusLine = Module("statusline", {
color: inherit !important; color: inherit !important;
} }
AddonButton:not(:hover) background: transparent; AddonButton:not(:hover) background: transparent;
]]>)({ padding: config.OS.isMacOSX ? "padding-right: 10px !important;" : "" })); */))({ padding: config.OS.isMacOSX ? "padding-right: 10px !important;" : "" }));
if (document.getElementById("appmenu-button")) if (document.getElementById("appmenu-button"))
highlight.loadCSS(<![CDATA[ highlight.loadCSS(literal(/*
AppmenuButton /* The app-menu button */ \ AppmenuButton min-width: 0 !important; padding: 0 .5em !important;
min-width: 0 !important; padding: 0 .5em !important; */));
]]>);
} }
XML.ignoreWhitespace = true; XML.ignoreWhitespace = true;

View File

@@ -35,9 +35,9 @@ var Tabs = Module("tabs", {
tabs.switchTo(event.originalTarget.getAttribute("identifier")); tabs.switchTo(event.originalTarget.getAttribute("identifier"));
}; };
this.tabBinding = styles.system.add("tab-binding", "chrome://browser/content/browser.xul", String.replace(<><![CDATA[ this.tabBinding = styles.system.add("tab-binding", "chrome://browser/content/browser.xul", String.replace(literal(/*
xul|tab { -moz-binding: url(chrome://dactyl/content/bindings.xml#tab) !important; } xul|tab { -moz-binding: url(chrome://dactyl/content/bindings.xml#tab) !important; }
]]></>, /tab-./g, function (m) config.OS.isMacOSX ? "tab-mac" : m), */), /tab-./g, function (m) config.OS.isMacOSX ? "tab-mac" : m),
false, true); false, true);
this.timeout(function () { this.timeout(function () {

View File

@@ -144,17 +144,40 @@ defineModule("base", {
"Set", "Struct", "StructBase", "Timer", "UTF8", "XPCOM", "XPCOMShim", "XPCOMUtils", "Set", "Struct", "StructBase", "Timer", "UTF8", "XPCOM", "XPCOMShim", "XPCOMUtils",
"XPCSafeJSObjectWrapper", "array", "bind", "call", "callable", "ctypes", "curry", "XPCSafeJSObjectWrapper", "array", "bind", "call", "callable", "ctypes", "curry",
"debuggerProperties", "defineModule", "deprecated", "endModule", "forEach", "isArray", "debuggerProperties", "defineModule", "deprecated", "endModule", "forEach", "isArray",
"isGenerator", "isinstance", "isObject", "isString", "isSubclass", "isXML", "iter", "iterAll", "isGenerator", "isinstance", "isObject", "isString", "isSubclass", "isXML", "iter",
"iterOwnProperties", "keys", "memoize", "octal", "properties", "require", "set", "update", "iterAll", "iterOwnProperties", "keys", "literal", "memoize", "octal", "properties",
"values" "require", "set", "update", "values"
] ]
}); });
this.lazyRequire("cache", ["cache"]);
this.lazyRequire("config", ["config"]); this.lazyRequire("config", ["config"]);
this.lazyRequire("messages", ["_", "Messages"]); this.lazyRequire("messages", ["_", "Messages"]);
this.lazyRequire("services", ["services"]); this.lazyRequire("services", ["services"]);
this.lazyRequire("util", ["FailedAssertion", "util"]); this.lazyRequire("util", ["FailedAssertion", "util"]);
function literal(/* comment */) {
let { caller } = Components.stack;
let file = caller.filename.replace(/.* -> /, "");
let key = "literal:" + file + ":" + caller.line;
let source = util.httpGet(file).responseText;
let match = RegExp("(?:.*\\n){" + (caller.lineNumber - 1) + "}" +
".*literal\\(/\\*([^]*?)\\*/\\)").exec(source);
return match[1];
// Later...
return cache.get(key, function () {
let source = cache.get("literal:" + file,
function () util.httpGet(file).responseText);
let match = RegExp("(?:.*\\n){" + (caller.lineNumber - 1) + "}" +
".*literal\\(/\\*([^]*?)\\*/\\)").exec(source);
return match[1];
});
}
/** /**
* Returns a list of all of the top-level properties of an object, by * Returns a list of all of the top-level properties of an object, by
* way of the debugger. * way of the debugger.

View File

@@ -118,7 +118,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
} }
}, },
closeWriter: function closeWriter() { closeWriter: util.wrapCallback(function closeWriter() {
this.closeReader(); this.closeReader();
if (this._cacheWriter) { if (this._cacheWriter) {
@@ -129,7 +129,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
if (this.cacheFile.fileSize <= 22) if (this.cacheFile.fileSize <= 22)
this.cacheFile.remove(false); this.cacheFile.remove(false);
} }
}, }),
flush: function flush() { flush: function flush() {
cache.cache = {}; cache.cache = {};
@@ -202,8 +202,12 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
return cache.force(name); return cache.force(name);
}, },
get: function get(name) { get: function get(name, callback, self) {
if (!Set.has(this.cache, name)) { if (!Set.has(this.cache, name)) {
if (callback && !(Set.has(this.providers, name) ||
Set.has(this.localProviders, name)))
this.register(name, callback, self);
this.cache[name] = this.force(name); this.cache[name] = this.force(name);
util.assert(this.cache[name] !== undefined, util.assert(this.cache[name] !== undefined,
"No such cache key", false); "No such cache key", false);

View File

@@ -488,7 +488,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
let { cache } = this.modules; let { cache } = this.modules;
this.cached = true; this.cached = true;
cache.register(this.cacheKey, function () { let cached = cache.get(this.cacheKey, function () {
self.cached = false; self.cached = false;
this.modules.moduleManager.initDependencies("commands"); this.modules.moduleManager.initDependencies("commands");
@@ -1225,14 +1225,14 @@ var Commands = Module("commands", {
} }
}, },
nameRegexp: util.regexp(<![CDATA[ nameRegexp: util.regexp(literal(/*
[^ [^
0-9 0-9
<forbid> <forbid>
] ]
[^ <forbid> ]* [^ <forbid> ]*
]]>, "gx", { */), "gx", {
forbid: util.regexp(String.replace(<![CDATA[ forbid: util.regexp(String.replace(literal(/*
U0000-U002c // U002d - U0000-U002c // U002d -
U002e-U002f U002e-U002f
U003a-U0040 // U0041-U005a a-z U003a-U0040 // U0041-U005a a-z
@@ -1255,12 +1255,12 @@ var Commands = Module("commands", {
Ufe70-Ufeff // Arabic Presentation Forms-B Ufe70-Ufeff // Arabic Presentation Forms-B
Uff00-Uffef // Halfwidth and Fullwidth Forms Uff00-Uffef // Halfwidth and Fullwidth Forms
Ufff0-Uffff // Specials Ufff0-Uffff // Specials
]]>, /U/g, "\\u"), "x") */), /U/g, "\\u"), "x")
}), }),
validName: Class.Memoize(function validName() util.regexp("^" + this.nameRegexp.source + "$")), validName: Class.Memoize(function validName() util.regexp("^" + this.nameRegexp.source + "$")),
commandRegexp: Class.Memoize(function commandRegexp() util.regexp(<![CDATA[ commandRegexp: Class.Memoize(function commandRegexp() util.regexp(literal(/*
^ ^
(?P<spec> (?P<spec>
(?P<prespace> [:\s]*) (?P<prespace> [:\s]*)
@@ -1275,7 +1275,7 @@ var Commands = Module("commands", {
(?:. | \n)*? (?:. | \n)*?
)? )?
$ $
]]>, "x", { */), "x", {
name: this.nameRegexp name: this.nameRegexp
})), })),

View File

@@ -155,7 +155,7 @@ var ConfigBase = Class("ConfigBase", {
highlight.loadCSS(this.helpCSS.replace(/__MSG_(.*?)__/g, function (m0, m1) _(m1))); highlight.loadCSS(this.helpCSS.replace(/__MSG_(.*?)__/g, function (m0, m1) _(m1)));
if (!this.haveGecko("2b")) if (!this.haveGecko("2b"))
highlight.loadCSS(<![CDATA[ highlight.loadCSS(literal(/*
!TabNumber font-weight: bold; margin: 0px; padding-right: .8ex; !TabNumber font-weight: bold; margin: 0px; padding-right: .8ex;
!TabIconNumber { !TabIconNumber {
font-weight: bold; font-weight: bold;
@@ -163,7 +163,7 @@ var ConfigBase = Class("ConfigBase", {
text-align: center; text-align: center;
text-shadow: black -1px 0 1px, black 0 1px 1px, black 1px 0 1px, black 0 -1px 1px; text-shadow: black -1px 0 1px, black 0 1px 1px, black 1px 0 1px, black 0 -1px 1px;
} }
]]>); */));
let hl = highlight.set("Find", ""); let hl = highlight.set("Find", "");
hl.onChange = function () { hl.onChange = function () {

View File

@@ -108,7 +108,7 @@ var Help = Module("Help", {
{ mimeType: "text/plain;charset=UTF-8" }) { mimeType: "text/plain;charset=UTF-8" })
.responseText; .responseText;
let re = util.regexp(UTF8(<![CDATA[ let re = util.regexp(UTF8(literal(/*
^ (?P<comment> \s* # .*\n) ^ (?P<comment> \s* # .*\n)
| ^ (?P<space> \s*) | ^ (?P<space> \s*)
@@ -124,7 +124,7 @@ var Help = Module("Help", {
) )
| (?: ^ [^\S\n]* \n) + | (?: ^ [^\S\n]* \n) +
]]>), "gmxy"); */)), "gmxy");
let betas = util.regexp(/\[((?:b|rc)\d)\]/, "gx"); let betas = util.regexp(/\[((?:b|rc)\d)\]/, "gx");

View File

@@ -2,7 +2,7 @@
// //
// This work is licensed for reuse under an MIT license. Details are // This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file. // given in the LICENSE.txt file included with this file.
/* use strict */ "use strict";
defineModule("highlight", { defineModule("highlight", {
exports: ["Highlight", "Highlights", "highlight"], exports: ["Highlight", "Highlights", "highlight"],
@@ -224,14 +224,14 @@ var Highlights = Module("Highlight", {
(self.highlight[hl] && self.highlight[hl].class != class_ (self.highlight[hl] && self.highlight[hl].class != class_
? self.highlight[hl].selector : "[dactyl|highlight~=" + hl + "]")), ? self.highlight[hl].selector : "[dactyl|highlight~=" + hl + "]")),
groupRegexp: util.regexp(<![CDATA[ groupRegexp: util.regexp(literal(/*
^ ^
(\s* (?:\S|\s\S)+ \s+) (\s* (?:\S|\s\S)+ \s+)
\{ ([^}]*) \} \{ ([^}]*) \}
\s* \s*
$ $
]]>, "gmx"), */), "gmx"),
sheetRegexp: util.regexp(<![CDATA[ sheetRegexp: util.regexp(literal(/*
^\s* ^\s*
!? \*? !? \*?
(?P<group> (?:[^;\s]|\s[^;\s])+ ) (?P<group> (?:[^;\s]|\s[^;\s])+ )
@@ -240,7 +240,7 @@ var Highlights = Module("Highlight", {
(?:; (?P<extends> (?:[^;\s]|\s[^;\s])+ )? )? (?:; (?P<extends> (?:[^;\s]|\s[^;\s])+ )? )?
\s* (?P<css> .*) \s* (?P<css> .*)
$ $
]]>, "x"), */), "x"),
/** /**
* Bulk loads new CSS rules, in the format of, * Bulk loads new CSS rules, in the format of,
@@ -322,7 +322,7 @@ var Highlights = Module("Highlight", {
commands.add(["hi[ghlight]"], commands.add(["hi[ghlight]"],
"Set the style of certain display elements", "Set the style of certain display elements",
function (args) { function (args) {
let style = <![CDATA[ let style = literal(/*
; ;
display: inline-block !important; display: inline-block !important;
position: static !important; position: static !important;
@@ -330,7 +330,7 @@ var Highlights = Module("Highlight", {
width: 3em !important; min-width: 3em !important; max-width: 3em !important; width: 3em !important; min-width: 3em !important; max-width: 3em !important;
height: 1em !important; min-height: 1em !important; max-height: 1em !important; height: 1em !important; min-height: 1em !important; max-height: 1em !important;
overflow: hidden !important; overflow: hidden !important;
]]>; */);
let clear = args[0] == "clear"; let clear = args[0] == "clear";
if (clear) if (clear)
args.shift(); args.shift();

View File

@@ -676,13 +676,13 @@ var IO = Module("io", {
} }
rtItems.ftdetect.template = // {{{ rtItems.ftdetect.template = // {{{
<![CDATA[" Vim filetype detection file literal(/*" Vim filetype detection file
<header> <header>
au BufNewFile,BufRead *<name>rc*,*.<fileext> set filetype=<name> au BufNewFile,BufRead *<name>rc*,*.<fileext> set filetype=<name>
]]>;//}}} */);//}}}
rtItems.ftplugin.template = // {{{ rtItems.ftplugin.template = // {{{
<![CDATA[" Vim filetype plugin file literal(/*" Vim filetype plugin file
<header> <header>
if exists("b:did_ftplugin") if exists("b:did_ftplugin")
@@ -707,9 +707,9 @@ endif
let &cpo = s:cpo_save let &cpo = s:cpo_save
unlet s:cpo_save unlet s:cpo_save
]]>;//}}} */);//}}}
rtItems.syntax.template = // {{{ rtItems.syntax.template = // {{{
<![CDATA[" Vim syntax file literal(/*" Vim syntax file
<header> <header>
if exists("b:current_syntax") if exists("b:current_syntax")
@@ -788,7 +788,7 @@ let &cpo = s:cpo_save
unlet s:cpo_save unlet s:cpo_save
" vim: tw=130 et ts=8 sts=4 sw=4: " vim: tw=130 et ts=8 sts=4 sw=4:
]]>;//}}} */);//}}}
const { options } = modules; const { options } = modules;
@@ -1041,7 +1041,7 @@ unlet s:cpo_save
}; };
completion.addUrlCompleter("file", "Local files", function (context, full) { completion.addUrlCompleter("file", "Local files", function (context, full) {
let match = util.regexp(<![CDATA[ let match = util.regexp(literal(/*
^ ^
(?P<prefix> (?P<prefix>
(?P<proto> (?P<proto>
@@ -1052,7 +1052,7 @@ unlet s:cpo_save
) )
(?P<path> \/[^\/]* )? (?P<path> \/[^\/]* )?
$ $
]]>, "x").exec(context.filter); */), "x").exec(context.filter);
if (match) { if (match) {
if (!match.path) { if (!match.path) {
context.key = match.proto; context.key = match.proto;

View File

@@ -4,7 +4,7 @@
// //
// This work is licensed for reuse under an MIT license. Details are // This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file. // given in the LICENSE.txt file included with this file.
/* use strict */ "use strict";
try { try {
@@ -14,7 +14,7 @@ defineModule("prefs", {
}); });
lazyRequire("messages", ["_"]); lazyRequire("messages", ["_"]);
lazyRequire("template", ["template"]); lazyRequire("template", ["template", "template_"]);
var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), { var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), {
ORIGINAL: "extensions.dactyl.original.", ORIGINAL: "extensions.dactyl.original.",
@@ -404,7 +404,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
let option = { let option = {
isDefault: !userValue, isDefault: !userValue,
default: this.defaults.get(pref, null), default: this.defaults.get(pref, null),
value: <>={template.highlight(value, true, 100)}</>, value: ["", "=", template.highlight(value, true, 100)],
name: pref, name: pref,
pre: "\u00a0\u00a0" // Unicode nonbreaking space. pre: "\u00a0\u00a0" // Unicode nonbreaking space.
}; };
@@ -413,7 +413,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
} }
}; };
return template.options(_("pref.hostPreferences", config.host), prefs.call(this)); return template_.options(_("pref.hostPreferences", config.host), prefs.call(this));
}, },
}, { }, {
}, { }, {

View File

@@ -186,7 +186,7 @@ function XMLChannel(uri, contentType, noErrorChannel, unprivileged) {
let type = this.channel.contentType; let type = this.channel.contentType;
if (/^text\/|[\/+]xml$/.test(type)) { if (/^text\/|[\/+]xml$/.test(type)) {
let stream = services.InputStream(channelStream); let stream = services.InputStream(channelStream);
let [, pre, doctype, url, extra, open, post] = util.regexp(<![CDATA[ let [, pre, doctype, url, extra, open, post] = util.regexp(literal(/*
^ ([^]*?) ^ ([^]*?)
(?: (?:
(<!DOCTYPE \s+ \S+ \s+) (?:SYSTEM \s+ "([^"]*)" | ((?:[^[>\s]|\s[^[])*)) (<!DOCTYPE \s+ \S+ \s+) (?:SYSTEM \s+ "([^"]*)" | ((?:[^[>\s]|\s[^[])*))
@@ -194,7 +194,7 @@ function XMLChannel(uri, contentType, noErrorChannel, unprivileged) {
([^]*) ([^]*)
)? )?
$ $
]]>, "x").exec(stream.read(4096)); */), "x").exec(stream.read(4096));
this.writes.push(pre); this.writes.push(pre);
if (doctype) { if (doctype) {
this.writes.push(doctype + (extra || "") + " [\n"); this.writes.push(doctype + (extra || "") + " [\n");

View File

@@ -2,7 +2,7 @@
// //
// This work is licensed for reuse under an MIT license. Details are // This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file. // given in the LICENSE.txt file included with this file.
/* use strict */ "use strict";
try { try {

View File

@@ -2,7 +2,7 @@
// //
// This work is licensed for reuse under an MIT license. Details are // This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file. // given in the LICENSE.txt file included with this file.
/* use strict */ "use strict";
defineModule("storage", { defineModule("storage", {
exports: ["File", "Storage", "storage"], exports: ["File", "Storage", "storage"],

View File

@@ -461,7 +461,7 @@ var Styles = Module("Styles", {
} }
}, },
propertyPattern: util.regexp(<![CDATA[ propertyPattern: util.regexp(literal(/*
(?: (?:
(?P<preSpace> <space>*) (?P<preSpace> <space>*)
(?P<name> [-a-z]*) (?P<name> [-a-z]*)
@@ -483,14 +483,14 @@ var Styles = Module("Styles", {
)? )?
) )
(?P<postSpace> <space>* (?: ; | $) ) (?P<postSpace> <space>* (?: ; | $) )
]]>, "gix", */), "gix",
{ {
space: /(?: \s | \/\* .*? \*\/ )/, space: /(?: \s | \/\* .*? \*\/ )/,
string: /(?:" (?:[^\\"]|\\.)* (?:"|$) | '(?:[^\\']|\\.)* (?:'|$) )/ string: /(?:" (?:[^\\"]|\\.)* (?:"|$) | '(?:[^\\']|\\.)* (?:'|$) )/
}), }),
patterns: memoize({ patterns: memoize({
get property() util.regexp(<![CDATA[ get property() util.regexp(literal(/*
(?: (?:
(?P<preSpace> <space>*) (?P<preSpace> <space>*)
(?P<name> [-a-z]*) (?P<name> [-a-z]*)
@@ -501,26 +501,26 @@ var Styles = Module("Styles", {
)? )?
) )
(?P<postSpace> <space>* (?: ; | $) ) (?P<postSpace> <space>* (?: ; | $) )
]]>, "gix", this), */), "gix", this),
get function() util.regexp(<![CDATA[ get function() util.regexp(literal(/*
(?P<function> (?P<function>
\s* \( \s* \s* \( \s*
(?: <string> | [^)]* ) (?: <string> | [^)]* )
\s* (?: \) | $) \s* (?: \) | $)
) )
]]>, "gx", this), */), "gx", this),
space: /(?: \s | \/\* .*? \*\/ )/, space: /(?: \s | \/\* .*? \*\/ )/,
get string() util.regexp(<![CDATA[ get string() util.regexp(literal(/*
(?P<string> (?P<string>
" (?:[^\\"]|\\.)* (?:"|$) | " (?:[^\\"]|\\.)* (?:"|$) |
' (?:[^\\']|\\.)* (?:'|$) ' (?:[^\\']|\\.)* (?:'|$)
) )
]]>, "gx", this), */), "gx", this),
get token() util.regexp(<![CDATA[ get token() util.regexp(literal(/*
(?P<token> (?P<token>
(?P<word> [-\w]+) (?P<word> [-\w]+)
<function>? <function>?
@@ -530,7 +530,7 @@ var Styles = Module("Styles", {
| <space>+ | <space>+
| [^;}\s]+ | [^;}\s]+
) )
]]>, "gix", this) */), "gix", this)
}), }),
/** /**

View File

@@ -202,17 +202,15 @@ var Template = Module("Template", {
var desc = this.processor[1].call(this, item, item.description); var desc = this.processor[1].call(this, item, item.description);
} }
XML.ignoreWhitespace = XML.prettyPrinting = false; return ["div", { highlight: highlightGroup || "CompItem", style: "white-space: nowrap" },
// <e4x> /* The non-breaking spaces prevent empty elements
return <div highlight={highlightGroup || "CompItem"} style="white-space: nowrap"> * from pushing the baseline down and enlarging
<!-- The non-breaking spaces prevent empty elements * the row.
- from pushing the baseline down and enlarging */
- the row. ["li", { highlight: "CompResult " + item.highlight },
--> text, "\u00a0"],
<li highlight={"CompResult " + item.highlight}>{text}&#xa0;</li> ["li", { highlight: "CompDesc" },
<li highlight="CompDesc">{desc}&#xa0;</li> desc, "\u00a0"]];
</div>;
// </e4x>
}, },
helpLink: function (token, text, type) { helpLink: function (token, text, type) {
@@ -257,11 +255,11 @@ var Template = Module("Template", {
return <{tag} xmlns={NS}>{topic}</{tag}>; return <{tag} xmlns={NS}>{topic}</{tag}>;
}, },
linkifyHelp: function linkifyHelp(str, help) { linkifyHelp: function linkifyHelp(str, help) {
let re = util.regexp(<![CDATA[ let re = util.regexp(literal(/*
(?P<pre> [/\s]|^) (?P<pre> [/\s]|^)
(?P<tag> '[\w-]+' | :(?:[\w-]+!?|!) | (?:._)?<[\w-]+>\w* | \b[a-zA-Z]_(?:[\w[\]]+|.) | \[[\w-;]+\] | E\d{3} ) (?P<tag> '[\w-]+' | :(?:[\w-]+!?|!) | (?:._)?<[\w-]+>\w* | \b[a-zA-Z]_(?:[\w[\]]+|.) | \[[\w-;]+\] | E\d{3} )
(?= [[\)!,:;./\s]|$) (?= [[\)!,:;./\s]|$)
]]>, "gx"); */), "gx");
return this.highlightSubstrings(str, (function () { return this.highlightSubstrings(str, (function () {
for (let res in re.iterate(str)) for (let res in re.iterate(str))
yield [res.index + res.pre.length, res.tag.length]; yield [res.index + res.pre.length, res.tag.length];
@@ -623,6 +621,23 @@ var Template_ = Module("Template_", {
return s; return s;
}, },
options: function options(title, opts, verbose) {
return ["table", {},
["tr", { highlight: "Title", align: "left" },
["th", {}, "--- " + title + " ---"]],
this.map(opts, function (opt)
["tr", {},
["td", {},
["div", { highlight: "Message" },
["span", { style: opt.isDefault ? "" : "font-weight: bold" },
opt.pre, opt.name],
["span", {}, opt.value],
opt.isDefault || opt.default == null ? "" : ["span", { class: "extra-info" }, " (default: ", opt.default, ")"]],
verbose && opt.setFrom ? ["div", { highlight: "Message" },
" Last set from ",
template.sourceLink(opt.setFrom)] : ""]])];
},
table: function table(title, data, indent) { table: function table(title, data, indent) {
let table = ["table", {}, let table = ["table", {},
["tr", { highlight: "Title", align: "left" }, ["tr", { highlight: "Title", align: "left" },

View File

@@ -341,14 +341,14 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
let defaults = { lt: "<", gt: ">" }; let defaults = { lt: "<", gt: ">" };
let re = util.regexp(<![CDATA[ let re = util.regexp(literal(/*
([^]*?) // 1 ([^]*?) // 1
(?: (?:
(<\{) | // 2 (<\{) | // 2
(< ((?:[a-z]-)?[a-z-]+?) (?:\[([0-9]+)\])? >) | // 3 4 5 (< ((?:[a-z]-)?[a-z-]+?) (?:\[([0-9]+)\])? >) | // 3 4 5
(\}>) // 6 (\}>) // 6
) )
]]>, "gixy"); */), "gixy");
macro = String(macro); macro = String(macro);
let end = 0; let end = 0;
for (let match in re.iterate(macro)) { for (let match in re.iterate(macro)) {
@@ -864,7 +864,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
}, },
// ripped from Firefox; modified // ripped from Firefox; modified
unsafeURI: Class.Memoize(function () util.regexp(String.replace(<![CDATA[ unsafeURI: Class.Memoize(function () util.regexp(String.replace(literal(/*
[ [
\s \s
// Invisible characters (bug 452979) // Invisible characters (bug 452979)
@@ -878,7 +878,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
// Bidi formatting characters. (RFC 3987 sections 3.2 and 4.1 paragraph 6) // Bidi formatting characters. (RFC 3987 sections 3.2 and 4.1 paragraph 6)
U200E U200F U202A U202B U202C U202D U202E U200E U200F U202A U202B U202C U202D U202E
] ]
]]>, /U/g, "\\u"), */), /U/g, "\\u"),
"gx")), "gx")),
losslessDecodeURI: function losslessDecodeURI(url) { losslessDecodeURI: function losslessDecodeURI(url) {
return url.split("%25").map(function (url) { return url.split("%25").map(function (url) {