mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-12 05:25:46 +01:00
Skip inaccessable elements in javascript completion
This commit is contained in:
@@ -318,16 +318,21 @@ liberator.Completion = function () //{{{
|
|||||||
{
|
{
|
||||||
if (typeof obj == "string")
|
if (typeof obj == "string")
|
||||||
obj = window.eval("with (liberator) {" + obj + "}");
|
obj = window.eval("with (liberator) {" + obj + "}");
|
||||||
|
if (typeof obj != "object")
|
||||||
|
continue;
|
||||||
|
|
||||||
for (let k in obj)
|
for (let k in obj)
|
||||||
{
|
{
|
||||||
let v, type = "inaccessable"
|
let v, type;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
v = obj[k];
|
v = obj[k];
|
||||||
type = typeof v;
|
type = typeof v;
|
||||||
}
|
}
|
||||||
catch(e) {}
|
catch(e)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (["string", "number", "boolean", "function"].indexOf(type) > -1)
|
if (["string", "number", "boolean", "function"].indexOf(type) > -1)
|
||||||
type += ": " + String(v).replace("\n", "\\n", "g");
|
type += ": " + String(v).replace("\n", "\\n", "g");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user