summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/content/liberator.js14
-rw-r--r--common/content/ui.js11
-rw-r--r--common/content/util.js25
3 files changed, 36 insertions, 14 deletions
diff --git a/common/content/liberator.js b/common/content/liberator.js
index 3c531434..2e72880f 100644
--- a/common/content/liberator.js
+++ b/common/content/liberator.js
@@ -1240,7 +1240,6 @@ const liberator = (function () //{{{
return value;
}
-
// String
else if (matches = string.match(/^(['"])([^\1]*?[^\\]?)\1/))
{
@@ -1249,7 +1248,6 @@ const liberator = (function () //{{{
else
return void this.echoerr("E115: Missing quote: " + string);
}
-
// Number
else if (matches = string.match(/^(\d+)$/))
return parseInt(matches[1], 10);
@@ -1659,9 +1657,16 @@ const liberator = (function () //{{{
try
{
+ try
+ {
+ var string = String(error);
+ var stack = error.stack;
+ }
+ catch (e) {}
+
let obj = {
- toString: function () error.toString(),
- stack: <>{(error.stack || Error().stack).replace(/^/mg, "\t")}</>
+ toString: function () string || {}.toString.call(error),
+ stack: <>{String.replace(stack || Error().stack, /^/mg, "\t")}</>
};
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.push([new Date, obj + obj.stack]);
}
+ liberator.dump(string);
liberator.dump(obj);
liberator.dump("");
}
diff --git a/common/content/ui.js b/common/content/ui.js
index 9902f6fe..4d6eec9b 100644
--- a/common/content/ui.js
+++ b/common/content/ui.js
@@ -360,7 +360,16 @@ function CommandLine() //{{{
{
let node = this.editor.rootElement.firstChild;
if (node && node.nextSibling)
- this.editor.deleteNode(node.nextSibling);
+ {
+ try
+ {
+ this.editor.deleteNode(node.nextSibling);
+ }
+ catch (e)
+ {
+ node.nextSibling.textContent = "";
+ }
+ }
else if (this.removeSubstring)
{
let str = this.removeSubstring;
diff --git a/common/content/util.js b/common/content/util.js
index 915a665d..d2d2c9b0 100644
--- a/common/content/util.js
+++ b/common/content/util.js
@@ -474,15 +474,22 @@ const util = { //{{{
return ns + ":" + node.localName;
return node.localName.toLowerCase();
}
- let tag = "<" + [namespaced(elem)].concat(
- [namespaced(a) + "=" + template.highlight(a.value, true)
- for ([i, a] in util.Array.iteritems(elem.attributes))]).join(" ");
-
- if (!elem.firstChild || /^\s*$/.test(elem.firstChild) && !elem.firstChild.nextSibling)
- tag += '/>';
- else
- tag += '>...</' + namespaced(elem) + '>';
- return tag;
+ try
+ {
+ let tag = "<" + [namespaced(elem)].concat(
+ [namespaced(a) + "=" + template.highlight(a.value, true)
+ for ([i, a] in util.Array.iteritems(elem.attributes))]).join(" ");
+
+ if (!elem.firstChild || /^\s*$/.test(elem.firstChild) && !elem.firstChild.nextSibling)
+ tag += '/>';
+ else
+ tag += '>...</' + namespaced(elem) + '>';
+ return tag;
+ }
+ catch (e)
+ {
+ return {}.toString.call(elem);
+ }
}
try