diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index d5068882..8c16214c 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -1323,7 +1323,7 @@ getJasmineRequireObj().pp = function(j$) { this.emitScalar('Date(' + value + ')'); } else if (value.__Jasmine_been_here_before__) { this.emitScalar(''); - } else if (j$.isArray_(value) || typeof value == 'object') { + } else if (j$.isArray_(value) || j$.isA_('Object', value)) { value.__Jasmine_been_here_before__ = true; if (j$.isArray_(value)) { this.emitArray(value); diff --git a/spec/html/PrettyPrintHtmlSpec.js b/spec/html/PrettyPrintHtmlSpec.js index 371fe76f..8fd40548 100644 --- a/spec/html/PrettyPrintHtmlSpec.js +++ b/spec/html/PrettyPrintHtmlSpec.js @@ -5,4 +5,11 @@ describe("j$.pp (HTML Dependent)", function () { expect(j$.pp(sampleNode)).toEqual("HTMLNode"); expect(j$.pp({foo: sampleNode})).toEqual("{ foo : HTMLNode }"); }); + + it("should print Firefox's wrapped native objects correctly", function() { + if(jasmine.getEnv().firefoxVersion) { + try { new CustomEvent(); } catch(e) { var err = e; }; + expect(j$.pp(err)).toMatch(/Exception.*Not enough arguments/); + } + }); }); diff --git a/src/core/PrettyPrinter.js b/src/core/PrettyPrinter.js index 08d2f41c..31e953f5 100644 --- a/src/core/PrettyPrinter.js +++ b/src/core/PrettyPrinter.js @@ -29,7 +29,7 @@ getJasmineRequireObj().pp = function(j$) { this.emitScalar('Date(' + value + ')'); } else if (value.__Jasmine_been_here_before__) { this.emitScalar(''); - } else if (j$.isArray_(value) || typeof value == 'object') { + } else if (j$.isArray_(value) || j$.isA_('Object', value)) { value.__Jasmine_been_here_before__ = true; if (j$.isArray_(value)) { this.emitArray(value);