1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 00:17:59 +01:00

Fix completion preview error in 3.6a2

--HG--
extra : rebase_source : 33da194d4dc35758f42183b0969132289d9594cc
This commit is contained in:
Kris Maglione
2009-10-24 05:49:45 -04:00
parent 3651a0a403
commit 2add32c3f2
3 changed files with 35 additions and 13 deletions

View File

@@ -1240,7 +1240,6 @@ const liberator = (function () //{{{
return value; return value;
} }
// String // String
else if (matches = string.match(/^(['"])([^\1]*?[^\\]?)\1/)) else if (matches = string.match(/^(['"])([^\1]*?[^\\]?)\1/))
{ {
@@ -1249,7 +1248,6 @@ const liberator = (function () //{{{
else else
return void this.echoerr("E115: Missing quote: " + string); return void this.echoerr("E115: Missing quote: " + string);
} }
// Number // Number
else if (matches = string.match(/^(\d+)$/)) else if (matches = string.match(/^(\d+)$/))
return parseInt(matches[1], 10); return parseInt(matches[1], 10);
@@ -1659,9 +1657,16 @@ const liberator = (function () //{{{
try try
{ {
try
{
var string = String(error);
var stack = error.stack;
}
catch (e) {}
let obj = { let obj = {
toString: function () error.toString(), toString: function () string || {}.toString.call(error),
stack: <>{(error.stack || Error().stack).replace(/^/mg, "\t")}</> stack: <>{String.replace(stack || Error().stack, /^/mg, "\t")}</>
}; };
for (let [k, v] in Iterator(error)) for (let [k, v] in Iterator(error))
{ {
@@ -1674,6 +1679,7 @@ const liberator = (function () //{{{
errors.toString = function () [String(v[0]) + "\n" + v[1] for ([k, v] in this)].join("\n\n"); errors.toString = function () [String(v[0]) + "\n" + v[1] for ([k, v] in this)].join("\n\n");
errors.push([new Date, obj + obj.stack]); errors.push([new Date, obj + obj.stack]);
} }
liberator.dump(string);
liberator.dump(obj); liberator.dump(obj);
liberator.dump(""); liberator.dump("");
} }

View File

@@ -360,7 +360,16 @@ function CommandLine() //{{{
{ {
let node = this.editor.rootElement.firstChild; let node = this.editor.rootElement.firstChild;
if (node && node.nextSibling) if (node && node.nextSibling)
{
try
{
this.editor.deleteNode(node.nextSibling); this.editor.deleteNode(node.nextSibling);
}
catch (e)
{
node.nextSibling.textContent = "";
}
}
else if (this.removeSubstring) else if (this.removeSubstring)
{ {
let str = this.removeSubstring; let str = this.removeSubstring;

View File

@@ -474,6 +474,8 @@ const util = { //{{{
return ns + ":" + node.localName; return ns + ":" + node.localName;
return node.localName.toLowerCase(); return node.localName.toLowerCase();
} }
try
{
let tag = "<" + [namespaced(elem)].concat( let tag = "<" + [namespaced(elem)].concat(
[namespaced(a) + "=" + template.highlight(a.value, true) [namespaced(a) + "=" + template.highlight(a.value, true)
for ([i, a] in util.Array.iteritems(elem.attributes))]).join(" "); for ([i, a] in util.Array.iteritems(elem.attributes))]).join(" ");
@@ -484,6 +486,11 @@ const util = { //{{{
tag += '>...</' + namespaced(elem) + '>'; tag += '>...</' + namespaced(elem) + '>';
return tag; return tag;
} }
catch (e)
{
return {}.toString.call(elem);
}
}
try try
{ // for window.JSON { // for window.JSON