From f92aed46c25330f5d74ad5bcb1003d5a001804cd Mon Sep 17 00:00:00 2001 From: Bucky Wilson Date: Mon, 8 Jan 2018 09:44:59 +1000 Subject: [PATCH] Restore webkit checking. Additional comments. Added `isWebKitBased` function. Due to who knows what version is being used -- this primarily checks for Safari. Eliminating code duplication and bugs. Corrected getBrowserVersion comment. modified: core/main/client/browser.js --- 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 6f5200f7f..4193fa6eb 100644 --- a/core/main/client/browser.js +++ b/core/main/client/browser.js @@ -646,13 +646,24 @@ beef.browser = { return this.isS4() || this.isS5() || this.isS6() || this.isS7() || this.isS8(); }, + /** + * Returns true if Webkit based + */ + isWebKitBased: function () { + // Currently, [2018-01-08], safari checks isS* provide evidence of webkit + // to avoid duplicating code and hence bugs, use the existing checks for Safari. + return this.isS4() || this.isS5() || this.isS6() || this.isS7() || this.isS8(); + }, + /** * Return true if Epiphany * @example: beef.browser.isEpi() */ isEpi: function () { - // based on webkit -- therefore should look a bit like Safari - return window.navigator.userAgent.match(/Epiphany\//) != null; + // Epiphany is based on webkit + // due to the uncertainty of webkit version vs Epiphany versions tracking. + // -- do webkit based checking (i.e. do safari checks) + return this.isWebKitBased() && window.navigator.userAgent.match(/Epiphany\//) != null; }, @@ -1669,8 +1680,8 @@ beef.browser = { }, /** - * Returns the type of browser being used. - * @return: {String} User agent software and version. + * Returns the major version of the browser being used. + * @return: {String} version number || 'UNKNOWN'. * * @example: beef.browser.getBrowserVersion() */