Bug 614561 - pprint() does not take string arguments any more; r=gavin.sharp approval2.0=gavin.sharp
authorRob Campbell <rcampbell@mozilla.com>
Thu, 02 Dec 2010 06:50:28 -0400
changeset 58462 1429940f0fd25e75734cfda1fb407f927a49a156
parent 58461 f257e2a6cdcfdc97d81f87637492ae8057967d34
child 58463 b92216d0aea951e89dc0f92bebb649fe0e8a5e75
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersgavin
bugs614561
milestone2.0b8pre
Bug 614561 - pprint() does not take string arguments any more; r=gavin.sharp approval2.0=gavin.sharp
toolkit/components/console/hudservice/HUDService.jsm
toolkit/components/console/hudservice/tests/browser/browser_webconsole_jsterm.js
--- a/toolkit/components/console/hudservice/HUDService.jsm
+++ b/toolkit/components/console/hudservice/HUDService.jsm
@@ -702,17 +702,21 @@ function createAndAppendElement(aParent,
 /**
  * Convenience function to unwrap a wrapped object.
  *
  * @param aObject the object to unwrap
  */
 
 function unwrap(aObject)
 {
-  return XPCNativeWrapper.unwrap(aObject);
+  try {
+    return XPCNativeWrapper.unwrap(aObject);
+  } catch(e) {
+    return aObject;
+  }
 }
 
 ///////////////////////////////////////////////////////////////////////////
 //// NetworkPanel
 
 /**
  * Creates a new NetworkPanel.
  *
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_jsterm.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_jsterm.js
@@ -132,10 +132,16 @@ function testJSTerm()
   let labels = jsterm.outputNode.querySelectorAll(".jsterm-output-line");
   ok(labels.length > 1, "more than one line of output for pprint(window)");
 
   jsterm.clearOutput();
   jsterm.execute("keys(window)");
   let labels = jsterm.outputNode.querySelectorAll(".jsterm-output-line");
   ok(labels.length, "more than 0 lines of output for keys(window)");
 
+  jsterm.clearOutput();
+  jsterm.execute("pprint('hi')");
+  // Doesn't conform to checkResult format, bug 614561
+  let label = jsterm.outputNode.querySelector(".jsterm-output-line");
+  is(label.textContent.trim(), '0: "h"\n  1: "i"', 'pprint("hi") worked');
+
   finishTest();
 }