Don't test for stack traces in Safari 5

This commit is contained in:
JR Boyens
2013-07-26 17:49:52 -07:00
parent edd7e3932b
commit 9e886b3972
2 changed files with 10 additions and 1 deletions

View File

@@ -41,7 +41,7 @@ describe("ExceptionFormatter", function() {
describe("#stack", function() {
it("formats stack traces from Webkit, Firefox, node.js or IE10+", function() {
if (jasmine.getEnv().ieVersion < 10) { return; }
if (jasmine.getEnv().ieVersion < 10 || jasmine.getEnv().safariVersion < 6) { return; }
var error;
try { throw new Error("an error") } catch(e) { error = e; }

View File

@@ -7,4 +7,13 @@
return match ? parseFloat(match[1]) : Number.MAX_VALUE;
})();
env.safariVersion = (function() {
var userAgent = jasmine.getGlobal().navigator.userAgent;
if (!userAgent) { return Number.MAX_VALUE; }
var match = /Safari/.exec(userAgent) && /Version\/([0-9]{0,})/.exec(userAgent);
return match ? parseFloat(match[1]) : Number.MAX_VALUE;
})();
})(jasmine.getEnv());