Mercurial > my-ubiquity-commands
diff random-stuff/random-stuff.js @ 22:ecd868a32247
better error logging, streamlined example
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Thu, 07 May 2009 15:42:53 -0700 |
parents | e82bff1ef296 |
children |
line wrap: on
line diff
--- a/random-stuff/random-stuff.js Thu May 07 15:26:40 2009 -0700 +++ b/random-stuff/random-stuff.js Thu May 07 15:42:53 2009 -0700 @@ -78,7 +78,14 @@ function logError(element) { var window = element.ownerDocument.defaultView; var console = window.wrappedJSObject.console; - console.error.apply(console, arguments); + if (console) + console.error.apply(console, arguments); + else { + var items = ["<" + element.nodeName.toLowerCase() + ">"]; + for (var i = 1; i < arguments.length; i++) + items.push(arguments[i].toString()); + Components.utils.reportError(items.join(" ")); + } } function absolutifyUrl(document, url) {