changeset 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 f90dcea4d6b8
files random-stuff/random-stuff.js random-stuff/sample-status-bar.html
diffstat 2 files changed, 9 insertions(+), 8 deletions(-) [+]
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) {
--- a/random-stuff/sample-status-bar.html	Thu May 07 15:26:40 2009 -0700
+++ b/random-stuff/sample-status-bar.html	Thu May 07 15:42:53 2009 -0700
@@ -1,10 +1,4 @@
 <feature>
   <widget location="status-bar" href="status-bar-widget.html"
-          width="200" id="panel"></widget>
-  <script src="resource://ubiquity/scripts/jquery.js"></script>
-  <script>
-    $(window).ready(
-      function() {
-      });
-  </script>
+          width="100"></widget>
 </feature>