1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 22:12:25 +01:00

Ameliorate completion with wrappedJSObjects a bit

This commit is contained in:
Kris Maglione
2008-11-18 02:01:40 +00:00
parent 1bb9d4337d
commit 870538e032

View File

@@ -150,20 +150,21 @@ function Completion() //{{{
// Things we can dereference // Things we can dereference
if (["object", "string", "function"].indexOf(typeof obj) == -1) if (["object", "string", "function"].indexOf(typeof obj) == -1)
continue; continue;
/* Try harder.
if (/^\[XPCNativeWrapper /.test(obj)) // XPCNativeWrappers, etc, don't show all accessible
obj = obj.wrappedJSObject; // members until they're accessed, so, we look at
*/ // the wrappedJSObject instead, and return any keys
try // available in the object itself.
{ let orig = obj;
if (obj.wrappedJSObject) if (obj.wrappedJSObject)
obj = obj.wrappedJSObject; obj = obj.wrappedJSObject;
compl.push([v for (v in this.iter(obj)) if (v[0] in orig)])
// And if wrappedJSObject happens to be available,
// return that, too.
if (orig.wrappedJSObject)
compl.push([["wrappedJSObject", obj]]);
} }
catch (e) {} compl = util.Array.flatten(compl);
for (let [k, v] in this.iter(obj))
compl.push([k, v]);
}
return cacheResults.js = compl; return cacheResults.js = compl;
} }