Bug 696288 - Regression: Processing.js Performance Tests don't work; r=ddahl,smaug
authorPanos Astithas <past@mozilla.com>
Mon, 24 Oct 2011 11:12:24 +0300
changeset 79188 7ba9a146e1e8ac18b4711393db1dd5040f623486
parent 79187 5d7c2550a61e9e4c031dde19624fff8235e73db0
child 79189 bfb669703e33953aaad2b3a2ed427a1585e20ce5
push id252
push userrcampbell@mozilla.com
push dateWed, 26 Oct 2011 14:06:26 +0000
treeherderfx-team@332d8f5f5886 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersddahl, smaug
bugs696288
milestone10.0a1
Bug 696288 - Regression: Processing.js Performance Tests don't work; r=ddahl,smaug
dom/base/ConsoleAPI.js
dom/tests/browser/browser_ConsoleAPITests.js
--- a/dom/base/ConsoleAPI.js
+++ b/dom/base/ConsoleAPI.js
@@ -196,16 +196,19 @@ ConsoleAPI.prototype = {
    *        The arguments given to the console API call.
    **/
   processArguments: function CA_processArguments(aArguments) {
     if (aArguments.length < 2) {
       return aArguments;
     }
     let args = Array.prototype.slice.call(aArguments);
     let format = args.shift();
+    if (typeof format != "string") {
+      return aArguments;
+    }
     // Format specification regular expression.
     let pattern = /%(\d*).?(\d*)[a-zA-Z]/g;
     let processed = format.replace(pattern, function CA_PA_substitute(spec) {
       switch (spec[spec.length-1]) {
         case "o":
         case "s":
           return String(args.shift());
         case "d":
--- a/dom/tests/browser/browser_ConsoleAPITests.js
+++ b/dom/tests/browser/browser_ConsoleAPITests.js
@@ -215,20 +215,25 @@ function observeConsoleTest() {
   win.console.log("%d, %s, %l");
   expect("log", "%a %b %c");
   win.console.log("%a %b %c");
   expect("log", "%a %b %c", "a", "b");
   win.console.log("%a %b %c", "a", "b");
   expect("log", "2, a, %l", 3);
   win.console.log("%d, %s, %l", 2, "a", 3);
 
-  // bug #692550 handle null and undefined
+  // Bug #692550 handle null and undefined.
   expect("log", "null, undefined");
   win.console.log("%s, %s", null, undefined);
 
+  // Bug #696288 handle object as first argument.
+  let obj = { a: 1 };
+  expect("log", obj, "a");
+  win.console.log(obj, "a");
+
   expect("dir", win.toString());
   win.console.dir(win);
 
   expect("error", "arg");
   win.console.error("arg");
 }
 
 function consoleAPISanityTest() {