mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-29 03:32:27 +01:00
Death to E4X and stuff.
This commit is contained in:
@@ -57,9 +57,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
delete window.liberator;
|
||||
|
||||
// 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; }
|
||||
]]>);
|
||||
*/));
|
||||
styles.unregisterSheet("resource://dactyl-skin/dactyl.css");
|
||||
DOM('#TabsToolbar tab', document).style.display;
|
||||
},
|
||||
@@ -1055,15 +1055,15 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
}, this);
|
||||
},
|
||||
stringToURLArray: deprecated("dactyl.parseURLs", "parseURLs"),
|
||||
urlish: Class.Memoize(function () util.regexp(<![CDATA[
|
||||
urlish: Class.Memoize(function () util.regexp(literal(/*
|
||||
^ (
|
||||
<domain>+ (:\d+)? (/ .*) |
|
||||
<domain>+ (:\d+) |
|
||||
<domain>+ \. [a-z0-9]+ |
|
||||
localhost
|
||||
) $
|
||||
]]>, "ix", {
|
||||
domain: util.regexp(String.replace(<![CDATA[
|
||||
*/), "ix", {
|
||||
domain: util.regexp(String.replace(literal(/*
|
||||
[^
|
||||
U0000-U002c // U002d-U002e --.
|
||||
U002f // /
|
||||
@@ -1072,7 +1072,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
U005b-U0060 // U0061-U007a A-Z
|
||||
U007b-U007f
|
||||
]
|
||||
]]>, /U/g, "\\u"), "x")
|
||||
*/), /U/g, "\\u"), "x")
|
||||
})),
|
||||
|
||||
pluginFiles: {},
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//
|
||||
// This work is licensed for reuse under an MIT license. Details are
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
/* use strict */
|
||||
"use strict";
|
||||
|
||||
/** @scope modules */
|
||||
|
||||
|
||||
@@ -487,7 +487,9 @@ var Modes = Module("modes", {
|
||||
update(StackElement.prototype, {
|
||||
get toStringParams() !loaded.modes ? 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;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//
|
||||
// This work is licensed for reuse under an MIT license. Details are
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
/* use strict */
|
||||
"use strict";
|
||||
|
||||
/** @scope modules */
|
||||
|
||||
@@ -15,28 +15,26 @@ var StatusLine = Module("statusline", {
|
||||
this.baseGroup = this.statusBar == this._statusLine ? "StatusLine " : "";
|
||||
|
||||
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; }
|
||||
#addon-bar > statusbar { -moz-box-flex: 1 }
|
||||
#addon-bar > #addonbar-closebutton { visibility: collapse; }
|
||||
#addon-bar > xul|toolbarspring { visibility: collapse; }
|
||||
]]></css>);
|
||||
*/));
|
||||
|
||||
overlay.overlayWindow(window, {
|
||||
append: [
|
||||
["statusbar", { id: "status-bar", ordinal: "0" }]]
|
||||
});
|
||||
|
||||
highlight.loadCSS(util.compileMacro(<![CDATA[
|
||||
highlight.loadCSS(util.compileMacro(literal(/*
|
||||
!AddonBar;#addon-bar {
|
||||
/* The Add-on Bar */
|
||||
padding-left: 0 !important;
|
||||
min-height: 18px !important;
|
||||
-moz-appearance: none !important;
|
||||
<padding>
|
||||
}
|
||||
!AddonButton;#addon-bar xul|toolbarbutton {
|
||||
/* An Add-on Bar button */
|
||||
-moz-appearance: none !important;
|
||||
padding: 0 !important;
|
||||
border-width: 0px !important;
|
||||
@@ -44,13 +42,12 @@ var StatusLine = Module("statusline", {
|
||||
color: inherit !important;
|
||||
}
|
||||
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"))
|
||||
highlight.loadCSS(<![CDATA[
|
||||
AppmenuButton /* The app-menu button */ \
|
||||
min-width: 0 !important; padding: 0 .5em !important;
|
||||
]]>);
|
||||
highlight.loadCSS(literal(/*
|
||||
AppmenuButton min-width: 0 !important; padding: 0 .5em !important;
|
||||
*/));
|
||||
}
|
||||
|
||||
XML.ignoreWhitespace = true;
|
||||
|
||||
@@ -35,9 +35,9 @@ var Tabs = Module("tabs", {
|
||||
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; }
|
||||
]]></>, /tab-./g, function (m) config.OS.isMacOSX ? "tab-mac" : m),
|
||||
*/), /tab-./g, function (m) config.OS.isMacOSX ? "tab-mac" : m),
|
||||
false, true);
|
||||
|
||||
this.timeout(function () {
|
||||
|
||||
@@ -144,17 +144,40 @@ defineModule("base", {
|
||||
"Set", "Struct", "StructBase", "Timer", "UTF8", "XPCOM", "XPCOMShim", "XPCOMUtils",
|
||||
"XPCSafeJSObjectWrapper", "array", "bind", "call", "callable", "ctypes", "curry",
|
||||
"debuggerProperties", "defineModule", "deprecated", "endModule", "forEach", "isArray",
|
||||
"isGenerator", "isinstance", "isObject", "isString", "isSubclass", "isXML", "iter", "iterAll",
|
||||
"iterOwnProperties", "keys", "memoize", "octal", "properties", "require", "set", "update",
|
||||
"values"
|
||||
"isGenerator", "isinstance", "isObject", "isString", "isSubclass", "isXML", "iter",
|
||||
"iterAll", "iterOwnProperties", "keys", "literal", "memoize", "octal", "properties",
|
||||
"require", "set", "update", "values"
|
||||
]
|
||||
});
|
||||
|
||||
this.lazyRequire("cache", ["cache"]);
|
||||
this.lazyRequire("config", ["config"]);
|
||||
this.lazyRequire("messages", ["_", "Messages"]);
|
||||
this.lazyRequire("services", ["services"]);
|
||||
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
|
||||
* way of the debugger.
|
||||
|
||||
@@ -118,7 +118,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
|
||||
}
|
||||
},
|
||||
|
||||
closeWriter: function closeWriter() {
|
||||
closeWriter: util.wrapCallback(function closeWriter() {
|
||||
this.closeReader();
|
||||
|
||||
if (this._cacheWriter) {
|
||||
@@ -129,7 +129,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
|
||||
if (this.cacheFile.fileSize <= 22)
|
||||
this.cacheFile.remove(false);
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
flush: function flush() {
|
||||
cache.cache = {};
|
||||
@@ -202,8 +202,12 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
|
||||
return cache.force(name);
|
||||
},
|
||||
|
||||
get: function get(name) {
|
||||
get: function get(name, callback, self) {
|
||||
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);
|
||||
util.assert(this.cache[name] !== undefined,
|
||||
"No such cache key", false);
|
||||
|
||||
@@ -488,7 +488,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
|
||||
let { cache } = this.modules;
|
||||
this.cached = true;
|
||||
|
||||
cache.register(this.cacheKey, function () {
|
||||
let cached = cache.get(this.cacheKey, function () {
|
||||
self.cached = false;
|
||||
this.modules.moduleManager.initDependencies("commands");
|
||||
|
||||
@@ -1225,14 +1225,14 @@ var Commands = Module("commands", {
|
||||
}
|
||||
},
|
||||
|
||||
nameRegexp: util.regexp(<![CDATA[
|
||||
nameRegexp: util.regexp(literal(/*
|
||||
[^
|
||||
0-9
|
||||
<forbid>
|
||||
]
|
||||
[^ <forbid> ]*
|
||||
]]>, "gx", {
|
||||
forbid: util.regexp(String.replace(<![CDATA[
|
||||
*/), "gx", {
|
||||
forbid: util.regexp(String.replace(literal(/*
|
||||
U0000-U002c // U002d -
|
||||
U002e-U002f
|
||||
U003a-U0040 // U0041-U005a a-z
|
||||
@@ -1255,12 +1255,12 @@ var Commands = Module("commands", {
|
||||
Ufe70-Ufeff // Arabic Presentation Forms-B
|
||||
Uff00-Uffef // Halfwidth and Fullwidth Forms
|
||||
Ufff0-Uffff // Specials
|
||||
]]>, /U/g, "\\u"), "x")
|
||||
*/), /U/g, "\\u"), "x")
|
||||
}),
|
||||
|
||||
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<prespace> [:\s]*)
|
||||
@@ -1275,7 +1275,7 @@ var Commands = Module("commands", {
|
||||
(?:. | \n)*?
|
||||
)?
|
||||
$
|
||||
]]>, "x", {
|
||||
*/), "x", {
|
||||
name: this.nameRegexp
|
||||
})),
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ var ConfigBase = Class("ConfigBase", {
|
||||
highlight.loadCSS(this.helpCSS.replace(/__MSG_(.*?)__/g, function (m0, m1) _(m1)));
|
||||
|
||||
if (!this.haveGecko("2b"))
|
||||
highlight.loadCSS(<![CDATA[
|
||||
highlight.loadCSS(literal(/*
|
||||
!TabNumber font-weight: bold; margin: 0px; padding-right: .8ex;
|
||||
!TabIconNumber {
|
||||
font-weight: bold;
|
||||
@@ -163,7 +163,7 @@ var ConfigBase = Class("ConfigBase", {
|
||||
text-align: center;
|
||||
text-shadow: black -1px 0 1px, black 0 1px 1px, black 1px 0 1px, black 0 -1px 1px;
|
||||
}
|
||||
]]>);
|
||||
*/));
|
||||
|
||||
let hl = highlight.set("Find", "");
|
||||
hl.onChange = function () {
|
||||
|
||||
@@ -108,7 +108,7 @@ var Help = Module("Help", {
|
||||
{ mimeType: "text/plain;charset=UTF-8" })
|
||||
.responseText;
|
||||
|
||||
let re = util.regexp(UTF8(<![CDATA[
|
||||
let re = util.regexp(UTF8(literal(/*
|
||||
^ (?P<comment> \s* # .*\n)
|
||||
|
||||
| ^ (?P<space> \s*)
|
||||
@@ -124,7 +124,7 @@ var Help = Module("Help", {
|
||||
)
|
||||
|
||||
| (?: ^ [^\S\n]* \n) +
|
||||
]]>), "gmxy");
|
||||
*/)), "gmxy");
|
||||
|
||||
let betas = util.regexp(/\[((?:b|rc)\d)\]/, "gx");
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This work is licensed for reuse under an MIT license. Details are
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
/* use strict */
|
||||
"use strict";
|
||||
|
||||
defineModule("highlight", {
|
||||
exports: ["Highlight", "Highlights", "highlight"],
|
||||
@@ -224,14 +224,14 @@ var Highlights = Module("Highlight", {
|
||||
(self.highlight[hl] && self.highlight[hl].class != class_
|
||||
? self.highlight[hl].selector : "[dactyl|highlight~=" + hl + "]")),
|
||||
|
||||
groupRegexp: util.regexp(<![CDATA[
|
||||
groupRegexp: util.regexp(literal(/*
|
||||
^
|
||||
(\s* (?:\S|\s\S)+ \s+)
|
||||
\{ ([^}]*) \}
|
||||
\s*
|
||||
$
|
||||
]]>, "gmx"),
|
||||
sheetRegexp: util.regexp(<![CDATA[
|
||||
*/), "gmx"),
|
||||
sheetRegexp: util.regexp(literal(/*
|
||||
^\s*
|
||||
!? \*?
|
||||
(?P<group> (?:[^;\s]|\s[^;\s])+ )
|
||||
@@ -240,7 +240,7 @@ var Highlights = Module("Highlight", {
|
||||
(?:; (?P<extends> (?:[^;\s]|\s[^;\s])+ )? )?
|
||||
\s* (?P<css> .*)
|
||||
$
|
||||
]]>, "x"),
|
||||
*/), "x"),
|
||||
|
||||
/**
|
||||
* Bulk loads new CSS rules, in the format of,
|
||||
@@ -322,7 +322,7 @@ var Highlights = Module("Highlight", {
|
||||
commands.add(["hi[ghlight]"],
|
||||
"Set the style of certain display elements",
|
||||
function (args) {
|
||||
let style = <![CDATA[
|
||||
let style = literal(/*
|
||||
;
|
||||
display: inline-block !important;
|
||||
position: static !important;
|
||||
@@ -330,7 +330,7 @@ var Highlights = Module("Highlight", {
|
||||
width: 3em !important; min-width: 3em !important; max-width: 3em !important;
|
||||
height: 1em !important; min-height: 1em !important; max-height: 1em !important;
|
||||
overflow: hidden !important;
|
||||
]]>;
|
||||
*/);
|
||||
let clear = args[0] == "clear";
|
||||
if (clear)
|
||||
args.shift();
|
||||
|
||||
@@ -676,13 +676,13 @@ var IO = Module("io", {
|
||||
}
|
||||
|
||||
rtItems.ftdetect.template = // {{{
|
||||
<![CDATA[" Vim filetype detection file
|
||||
literal(/*" Vim filetype detection file
|
||||
<header>
|
||||
|
||||
au BufNewFile,BufRead *<name>rc*,*.<fileext> set filetype=<name>
|
||||
]]>;//}}}
|
||||
*/);//}}}
|
||||
rtItems.ftplugin.template = // {{{
|
||||
<![CDATA[" Vim filetype plugin file
|
||||
literal(/*" Vim filetype plugin file
|
||||
<header>
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
@@ -707,9 +707,9 @@ endif
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
]]>;//}}}
|
||||
*/);//}}}
|
||||
rtItems.syntax.template = // {{{
|
||||
<![CDATA[" Vim syntax file
|
||||
literal(/*" Vim syntax file
|
||||
<header>
|
||||
|
||||
if exists("b:current_syntax")
|
||||
@@ -788,7 +788,7 @@ let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: tw=130 et ts=8 sts=4 sw=4:
|
||||
]]>;//}}}
|
||||
*/);//}}}
|
||||
|
||||
const { options } = modules;
|
||||
|
||||
@@ -1041,7 +1041,7 @@ unlet s:cpo_save
|
||||
};
|
||||
|
||||
completion.addUrlCompleter("file", "Local files", function (context, full) {
|
||||
let match = util.regexp(<![CDATA[
|
||||
let match = util.regexp(literal(/*
|
||||
^
|
||||
(?P<prefix>
|
||||
(?P<proto>
|
||||
@@ -1052,7 +1052,7 @@ unlet s:cpo_save
|
||||
)
|
||||
(?P<path> \/[^\/]* )?
|
||||
$
|
||||
]]>, "x").exec(context.filter);
|
||||
*/), "x").exec(context.filter);
|
||||
if (match) {
|
||||
if (!match.path) {
|
||||
context.key = match.proto;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//
|
||||
// This work is licensed for reuse under an MIT license. Details are
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
/* use strict */
|
||||
"use strict";
|
||||
|
||||
try {
|
||||
|
||||
@@ -14,7 +14,7 @@ defineModule("prefs", {
|
||||
});
|
||||
|
||||
lazyRequire("messages", ["_"]);
|
||||
lazyRequire("template", ["template"]);
|
||||
lazyRequire("template", ["template", "template_"]);
|
||||
|
||||
var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), {
|
||||
ORIGINAL: "extensions.dactyl.original.",
|
||||
@@ -404,7 +404,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
|
||||
let option = {
|
||||
isDefault: !userValue,
|
||||
default: this.defaults.get(pref, null),
|
||||
value: <>={template.highlight(value, true, 100)}</>,
|
||||
value: ["", "=", template.highlight(value, true, 100)],
|
||||
name: pref,
|
||||
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));
|
||||
},
|
||||
}, {
|
||||
}, {
|
||||
|
||||
@@ -186,7 +186,7 @@ function XMLChannel(uri, contentType, noErrorChannel, unprivileged) {
|
||||
let type = this.channel.contentType;
|
||||
if (/^text\/|[\/+]xml$/.test(type)) {
|
||||
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[^[])*))
|
||||
@@ -194,7 +194,7 @@ function XMLChannel(uri, contentType, noErrorChannel, unprivileged) {
|
||||
([^]*)
|
||||
)?
|
||||
$
|
||||
]]>, "x").exec(stream.read(4096));
|
||||
*/), "x").exec(stream.read(4096));
|
||||
this.writes.push(pre);
|
||||
if (doctype) {
|
||||
this.writes.push(doctype + (extra || "") + " [\n");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This work is licensed for reuse under an MIT license. Details are
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
/* use strict */
|
||||
"use strict";
|
||||
|
||||
try {
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This work is licensed for reuse under an MIT license. Details are
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
/* use strict */
|
||||
"use strict";
|
||||
|
||||
defineModule("storage", {
|
||||
exports: ["File", "Storage", "storage"],
|
||||
|
||||
@@ -461,7 +461,7 @@ var Styles = Module("Styles", {
|
||||
}
|
||||
},
|
||||
|
||||
propertyPattern: util.regexp(<![CDATA[
|
||||
propertyPattern: util.regexp(literal(/*
|
||||
(?:
|
||||
(?P<preSpace> <space>*)
|
||||
(?P<name> [-a-z]*)
|
||||
@@ -483,14 +483,14 @@ var Styles = Module("Styles", {
|
||||
)?
|
||||
)
|
||||
(?P<postSpace> <space>* (?: ; | $) )
|
||||
]]>, "gix",
|
||||
*/), "gix",
|
||||
{
|
||||
space: /(?: \s | \/\* .*? \*\/ )/,
|
||||
string: /(?:" (?:[^\\"]|\\.)* (?:"|$) | '(?:[^\\']|\\.)* (?:'|$) )/
|
||||
}),
|
||||
|
||||
patterns: memoize({
|
||||
get property() util.regexp(<![CDATA[
|
||||
get property() util.regexp(literal(/*
|
||||
(?:
|
||||
(?P<preSpace> <space>*)
|
||||
(?P<name> [-a-z]*)
|
||||
@@ -501,26 +501,26 @@ var Styles = Module("Styles", {
|
||||
)?
|
||||
)
|
||||
(?P<postSpace> <space>* (?: ; | $) )
|
||||
]]>, "gix", this),
|
||||
*/), "gix", this),
|
||||
|
||||
get function() util.regexp(<![CDATA[
|
||||
get function() util.regexp(literal(/*
|
||||
(?P<function>
|
||||
\s* \( \s*
|
||||
(?: <string> | [^)]* )
|
||||
\s* (?: \) | $)
|
||||
)
|
||||
]]>, "gx", this),
|
||||
*/), "gx", this),
|
||||
|
||||
space: /(?: \s | \/\* .*? \*\/ )/,
|
||||
|
||||
get string() util.regexp(<![CDATA[
|
||||
get string() util.regexp(literal(/*
|
||||
(?P<string>
|
||||
" (?:[^\\"]|\\.)* (?:"|$) |
|
||||
' (?:[^\\']|\\.)* (?:'|$)
|
||||
)
|
||||
]]>, "gx", this),
|
||||
*/), "gx", this),
|
||||
|
||||
get token() util.regexp(<![CDATA[
|
||||
get token() util.regexp(literal(/*
|
||||
(?P<token>
|
||||
(?P<word> [-\w]+)
|
||||
<function>?
|
||||
@@ -530,7 +530,7 @@ var Styles = Module("Styles", {
|
||||
| <space>+
|
||||
| [^;}\s]+
|
||||
)
|
||||
]]>, "gix", this)
|
||||
*/), "gix", this)
|
||||
}),
|
||||
|
||||
/**
|
||||
|
||||
@@ -202,17 +202,15 @@ var Template = Module("Template", {
|
||||
var desc = this.processor[1].call(this, item, item.description);
|
||||
}
|
||||
|
||||
XML.ignoreWhitespace = XML.prettyPrinting = false;
|
||||
// <e4x>
|
||||
return <div highlight={highlightGroup || "CompItem"} style="white-space: nowrap">
|
||||
<!-- The non-breaking spaces prevent empty elements
|
||||
- from pushing the baseline down and enlarging
|
||||
- the row.
|
||||
-->
|
||||
<li highlight={"CompResult " + item.highlight}>{text} </li>
|
||||
<li highlight="CompDesc">{desc} </li>
|
||||
</div>;
|
||||
// </e4x>
|
||||
return ["div", { highlight: highlightGroup || "CompItem", style: "white-space: nowrap" },
|
||||
/* The non-breaking spaces prevent empty elements
|
||||
* from pushing the baseline down and enlarging
|
||||
* the row.
|
||||
*/
|
||||
["li", { highlight: "CompResult " + item.highlight },
|
||||
text, "\u00a0"],
|
||||
["li", { highlight: "CompDesc" },
|
||||
desc, "\u00a0"]];
|
||||
},
|
||||
|
||||
helpLink: function (token, text, type) {
|
||||
@@ -257,11 +255,11 @@ var Template = Module("Template", {
|
||||
return <{tag} xmlns={NS}>{topic}</{tag}>;
|
||||
},
|
||||
linkifyHelp: function linkifyHelp(str, help) {
|
||||
let re = util.regexp(<![CDATA[
|
||||
let re = util.regexp(literal(/*
|
||||
(?P<pre> [/\s]|^)
|
||||
(?P<tag> '[\w-]+' | :(?:[\w-]+!?|!) | (?:._)?<[\w-]+>\w* | \b[a-zA-Z]_(?:[\w[\]]+|.) | \[[\w-;]+\] | E\d{3} )
|
||||
(?= [[\)!,:;./\s]|$)
|
||||
]]>, "gx");
|
||||
*/), "gx");
|
||||
return this.highlightSubstrings(str, (function () {
|
||||
for (let res in re.iterate(str))
|
||||
yield [res.index + res.pre.length, res.tag.length];
|
||||
@@ -623,6 +621,23 @@ var Template_ = Module("Template_", {
|
||||
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) {
|
||||
let table = ["table", {},
|
||||
["tr", { highlight: "Title", align: "left" },
|
||||
|
||||
@@ -341,14 +341,14 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
|
||||
let defaults = { lt: "<", gt: ">" };
|
||||
|
||||
let re = util.regexp(<![CDATA[
|
||||
let re = util.regexp(literal(/*
|
||||
([^]*?) // 1
|
||||
(?:
|
||||
(<\{) | // 2
|
||||
(< ((?:[a-z]-)?[a-z-]+?) (?:\[([0-9]+)\])? >) | // 3 4 5
|
||||
(\}>) // 6
|
||||
)
|
||||
]]>, "gixy");
|
||||
*/), "gixy");
|
||||
macro = String(macro);
|
||||
let end = 0;
|
||||
for (let match in re.iterate(macro)) {
|
||||
@@ -864,7 +864,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
},
|
||||
|
||||
// ripped from Firefox; modified
|
||||
unsafeURI: Class.Memoize(function () util.regexp(String.replace(<![CDATA[
|
||||
unsafeURI: Class.Memoize(function () util.regexp(String.replace(literal(/*
|
||||
[
|
||||
\s
|
||||
// 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)
|
||||
U200E U200F U202A U202B U202C U202D U202E
|
||||
]
|
||||
]]>, /U/g, "\\u"),
|
||||
*/), /U/g, "\\u"),
|
||||
"gx")),
|
||||
losslessDecodeURI: function losslessDecodeURI(url) {
|
||||
return url.split("%25").map(function (url) {
|
||||
|
||||
Reference in New Issue
Block a user