summaryrefslogtreecommitdiff
path: root/common/content/completion.js
diff options
context:
space:
mode:
Diffstat (limited to 'common/content/completion.js')
-rw-r--r--common/content/completion.js38
1 files changed, 19 insertions, 19 deletions
diff --git a/common/content/completion.js b/common/content/completion.js
index c7906969..9cd8010a 100644
--- a/common/content/completion.js
+++ b/common/content/completion.js
@@ -726,22 +726,22 @@ function Completion() //{{{
this.completers = {};
- this.iter = function iter(obj)
+ // Some object members are only accessible as function calls
+ function getKey(obj, key)
{
- let iterator = (function objIter()
+ try
{
- for (let k in obj)
- {
- // Some object members are only accessible as function calls
- try
- {
- yield [k, obj[k]];
- continue;
- }
- catch (e) {}
- yield [k, <>inaccessable</>]
- }
- })();
+ return obj[key];
+ }
+ catch (e)
+ {
+ return undefined;
+ }
+ }
+
+ this.iter = function iter(obj)
+ {
+ let iterator = ([k, getKey(obj, k)] for (k in obj));
try
{
// The point of 'for k in obj' is to get keys
@@ -781,21 +781,21 @@ function Completion() //{{{
// available in the object itself.
let orig = obj;
- // v[0] in orig and orig[v[0]] catch different cases. XPCOM
- // objects are problematic, to say the least.
if (modules.isPrototypeOf(obj))
compl = [v for (v in Iterator(obj))];
else
{
- if (obj.wrappedJSObject)
+ if (getKey(obj, 'wrappedJSObject'))
obj = obj.wrappedJSObject;
+ // v[0] in orig and orig[v[0]] catch different cases. XPCOM
+ // objects are problematic, to say the least.
compl = [v for (v in this.iter(obj))
- if ((typeof orig == "object" && v[0] in orig) || orig[v[0]] !== undefined)];
+ if ((typeof orig == "object" && v[0] in orig) || getKey(orig, v[0]) !== undefined)];
}
// And if wrappedJSObject happens to be available,
// return that, too.
- if (orig.wrappedJSObject)
+ if (getKey(orig, 'wrappedJSObject'))
compl.push(["wrappedJSObject", obj]);
// Add keys for sorting later.