From 7f1473ccbf63321ef8851bea9a7fb59b2176a9e0 Mon Sep 17 00:00:00 2001 From: antisnatchor Date: Mon, 1 Jul 2013 17:32:00 +0100 Subject: [PATCH] Added detection for Firefox 22 (and improved detection of FF 21/22 with a new DOM object). --- core/main/client/browser.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/core/main/client/browser.js b/core/main/client/browser.js index 5b427ffb3..912c2783c 100644 --- a/core/main/client/browser.js +++ b/core/main/client/browser.js @@ -257,7 +257,15 @@ beef.browser = { * @example: beef.browser.isFF21() */ isFF21:function () { - return !!window.devicePixelRatio && !!window.history.replaceState && typeof navigator.mozGetUserMedia != "undefined" && window.navigator.userAgent.match(/Firefox\/21\./) != null; + return !!window.devicePixelRatio && !!window.history.replaceState && typeof navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof window.crypto.getRandomValues != "undefined") && window.navigator.userAgent.match(/Firefox\/21\./) != null; + }, + + /** + * Returns true if FF22 + * @example: beef.browser.isFF21() + */ + isFF22:function () { + return !!window.devicePixelRatio && !!window.history.replaceState && typeof navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof window.crypto.getRandomValues != "undefined") && window.navigator.userAgent.match(/Firefox\/22\./) != null; }, /** @@ -265,7 +273,7 @@ beef.browser = { * @example: beef.browser.isFF() */ isFF:function () { - return this.isFF2() || this.isFF3() || this.isFF3_5() || this.isFF3_6() || this.isFF4() || this.isFF5() || this.isFF6() || this.isFF7() || this.isFF8() || this.isFF9() || this.isFF10() || this.isFF11() || this.isFF12() || this.isFF13() || this.isFF14() || this.isFF15() || this.isFF16() || this.isFF17() || this.isFF18() || this.isFF19() || this.isFF20() || this.isFF21(); + return this.isFF2() || this.isFF3() || this.isFF3_5() || this.isFF3_6() || this.isFF4() || this.isFF5() || this.isFF6() || this.isFF7() || this.isFF8() || this.isFF9() || this.isFF10() || this.isFF11() || this.isFF12() || this.isFF13() || this.isFF14() || this.isFF15() || this.isFF16() || this.isFF17() || this.isFF18() || this.isFF19() || this.isFF20() || this.isFF21() || this.isFF22(); }, /** @@ -695,6 +703,7 @@ beef.browser = { FF19:this.isFF19(), // Firefox 19 FF20:this.isFF20(), // Firefox 20 FF21:this.isFF21(), // Firefox 21 + FF22:this.isFF22(), // Firefox 22 FF:this.isFF(), // Firefox any version IE6:this.isIE6(), // Internet Explorer 6 @@ -949,8 +958,10 @@ beef.browser = { if (this.isFF21()) { return '21' } - ; // Firefox 21 - + ; // Firefox 22 + if (this.isFF22()) { + return '22' + }; if (this.isIE6()) { return '6' }