mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-06 22:54:12 +01:00
Don't explode when trying to list a broken localized pref.
This commit is contained in:
@@ -1540,6 +1540,12 @@ var DOM = Class("DOM", {
|
|||||||
function tag(args, namespaces) {
|
function tag(args, namespaces) {
|
||||||
let _namespaces = namespaces;
|
let _namespaces = namespaces;
|
||||||
|
|
||||||
|
// Deal with common error case
|
||||||
|
if (args == null) {
|
||||||
|
util.reportError(Error("Unexpected null when processing XML."));
|
||||||
|
args = ["html:i", {}, "[NULL]"];
|
||||||
|
}
|
||||||
|
|
||||||
if (isinstance(args, ["String", "Number", "Boolean", _]))
|
if (isinstance(args, ["String", "Number", "Boolean", _]))
|
||||||
return doc.createTextNode(args);
|
return doc.createTextNode(args);
|
||||||
if (isXML(args))
|
if (isXML(args))
|
||||||
@@ -1575,7 +1581,7 @@ var DOM = Class("DOM", {
|
|||||||
for (var key in attr) {
|
for (var key in attr) {
|
||||||
if (/^xmlns(?:$|:)/.test(key)) {
|
if (/^xmlns(?:$|:)/.test(key)) {
|
||||||
if (_namespaces === namespaces)
|
if (_namespaces === namespaces)
|
||||||
namespaces = update({}, namespaces);
|
namespaces = Object.create(namespaces);
|
||||||
|
|
||||||
namespaces[key.substr(6)] = namespaces[attr[key]] || attr[key];
|
namespaces[key.substr(6)] = namespaces[attr[key]] || attr[key];
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -111,10 +111,11 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case Ci.nsIPrefBranch.PREF_STRING:
|
case Ci.nsIPrefBranch.PREF_STRING:
|
||||||
let value = this.branch.getComplexValue(name, Ci.nsISupportsString).data;
|
let value = this.branch.getComplexValue(name, Ci.nsISupportsString).data;
|
||||||
// try in case it's a localized string (will throw an exception if not)
|
try {
|
||||||
if (!this.branch.prefIsLocked(name) && !this.branch.prefHasUserValue(name) &&
|
if (/^[a-z0-9-]+:/i.test(value))
|
||||||
RegExp("chrome://.+/locale/.+\\.properties").test(value))
|
|
||||||
value = this.branch.getComplexValue(name, Ci.nsIPrefLocalizedString).data;
|
value = this.branch.getComplexValue(name, Ci.nsIPrefLocalizedString).data;
|
||||||
|
}
|
||||||
|
catch (e) {}
|
||||||
return value;
|
return value;
|
||||||
case Ci.nsIPrefBranch.PREF_INT:
|
case Ci.nsIPrefBranch.PREF_INT:
|
||||||
return this.branch.getIntPref(name);
|
return this.branch.getIntPref(name);
|
||||||
|
|||||||
Reference in New Issue
Block a user