1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 20:02: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))
obj = obj.wrappedJSObject;
*/
try
{
if (obj.wrappedJSObject)
obj = obj.wrappedJSObject;
}
catch (e) {}
for (let [k, v] in this.iter(obj)) // XPCNativeWrappers, etc, don't show all accessible
compl.push([k, v]); // members until they're accessed, so, we look at
// the wrappedJSObject instead, and return any keys
// available in the object itself.
let orig = obj;
if (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]]);
} }
compl = util.Array.flatten(compl);
return cacheResults.js = compl; return cacheResults.js = compl;
} }