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:
@@ -150,20 +150,21 @@ function Completion() //{{{
|
||||
// Things we can dereference
|
||||
if (["object", "string", "function"].indexOf(typeof obj) == -1)
|
||||
continue;
|
||||
/* Try harder.
|
||||
if (/^\[XPCNativeWrapper /.test(obj))
|
||||
obj = obj.wrappedJSObject;
|
||||
*/
|
||||
try
|
||||
{
|
||||
|
||||
// XPCNativeWrappers, etc, don't show all accessible
|
||||
// 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]]);
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
for (let [k, v] in this.iter(obj))
|
||||
compl.push([k, v]);
|
||||
}
|
||||
compl = util.Array.flatten(compl);
|
||||
return cacheResults.js = compl;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user