mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-05 04:14:12 +01:00
Fix NS_ERROR_NOT_INITIALIZED on some :write filename completions.
This commit is contained in:
@@ -46,6 +46,18 @@ jsmodules.jsmodules = jsmodules;
|
||||
|
||||
function toString() "[module-global " + this.NAME + "]";
|
||||
|
||||
function objToString(obj) {
|
||||
try {
|
||||
return objproto.toString.call(obj);
|
||||
}
|
||||
catch (e) {
|
||||
var type_ = typeof obj;
|
||||
if (e == null)
|
||||
type_ = String(e);
|
||||
return "[non-object " + type_ + "]";
|
||||
}
|
||||
}
|
||||
|
||||
let use = {};
|
||||
let loaded = {};
|
||||
let currentModule;
|
||||
@@ -635,7 +647,7 @@ function isinstance(object, interfaces) {
|
||||
|
||||
return Array.concat(interfaces).some(function isinstance_some(iface) {
|
||||
if (typeof iface === "string") {
|
||||
if (objproto.toString.call(object) === "[object " + iface + "]")
|
||||
if (objToString(object) === "[object " + iface + "]")
|
||||
return true;
|
||||
}
|
||||
else if (typeof object === "object" && "isinstance" in object && object.isinstance !== isinstance) {
|
||||
@@ -674,7 +686,7 @@ var isArray =
|
||||
* functions containing the 'yield' statement and generator
|
||||
* statements such as (x for (x in obj)).
|
||||
*/
|
||||
function isGenerator(val) objproto.toString.call(val) == "[object Generator]";
|
||||
function isGenerator(val) objToString(val) == "[object Generator]";
|
||||
|
||||
/**
|
||||
* Returns true if and only if its sole argument is a String,
|
||||
@@ -683,7 +695,7 @@ function isGenerator(val) objproto.toString.call(val) == "[object Generator]";
|
||||
* namespace, or execution context, which is not the case when
|
||||
* using (obj instanceof String) or (typeof obj == "string").
|
||||
*/
|
||||
function isString(val) objproto.toString.call(val) == "[object String]";
|
||||
function isString(val) objToString(val) == "[object String]";
|
||||
|
||||
/**
|
||||
* Returns true if and only if its sole argument may be called
|
||||
|
||||
@@ -1517,7 +1517,12 @@ var Buffer = Module("Buffer", {
|
||||
if (type === "text/plain")
|
||||
ext = "." + (currExt || "txt");
|
||||
else
|
||||
ext = "." + services.mime.getPrimaryExtension(type, currExt);
|
||||
try {
|
||||
ext = "." + services.mime.getPrimaryExtension(type, currExt);
|
||||
}
|
||||
catch (e) {
|
||||
ext = currExt ? "." + curExt : "";
|
||||
}
|
||||
}
|
||||
else if (currExt)
|
||||
ext = "." + currExt;
|
||||
|
||||
Reference in New Issue
Block a user