mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 16:57:57 +01:00
improvements in :echo object, :echo getBrowser() should work now reliable
This commit is contained in:
@@ -41,6 +41,9 @@ vimperator.util = {
|
|||||||
{
|
{
|
||||||
var type = typeof(arg);
|
var type = typeof(arg);
|
||||||
|
|
||||||
|
// some objects like window.JSON or getBrowsers()._browsers need the try/catch
|
||||||
|
try
|
||||||
|
{
|
||||||
if (type == "number")
|
if (type == "number")
|
||||||
{
|
{
|
||||||
return "<span style=\"color: red;\">" + arg + "</span>";
|
return "<span style=\"color: red;\">" + arg + "</span>";
|
||||||
@@ -73,8 +76,13 @@ vimperator.util = {
|
|||||||
else
|
else
|
||||||
return "undefined";
|
return "undefined";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
return "<unknown>";
|
||||||
|
}
|
||||||
|
|
||||||
return arg;
|
return "<unknown type>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -360,19 +360,18 @@ const vimperator = (function() //{{{
|
|||||||
else
|
else
|
||||||
string += obj + "::\n";
|
string += obj + "::\n";
|
||||||
|
|
||||||
|
try // window.content often does not want to be queried with "var i in object"
|
||||||
|
{
|
||||||
for (var i in object)
|
for (var i in object)
|
||||||
{
|
{
|
||||||
var value;
|
var value;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (i == "JSON") // without this ugly hack, ":echo window" does not work
|
|
||||||
value = "[object JSON]";
|
|
||||||
else
|
|
||||||
value = object[i];
|
value = object[i];
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
value = "";
|
value = "<no value>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (color)
|
if (color)
|
||||||
@@ -383,6 +382,9 @@ const vimperator = (function() //{{{
|
|||||||
else
|
else
|
||||||
string += i + ": " + value + "\n";
|
string += i + ": " + value + "\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (e) { };
|
||||||
|
|
||||||
return string;
|
return string;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user