mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
stronger device type checks
This commit is contained in:
parent
fda077cccd
commit
b7e97178b1
@ -994,7 +994,8 @@
|
||||
End 1Password Extension
|
||||
*/
|
||||
|
||||
if ((typeof safari !== 'undefined')) {
|
||||
if ((typeof safari !== 'undefined') && navigator.userAgent.indexOf(' Safari/') !== -1 &&
|
||||
navigator.userAgent.indexOf('Chrome') === -1) {
|
||||
safari.self.addEventListener('message', function (msgEvent) {
|
||||
var msg = msgEvent.message;
|
||||
if (msg.command === 'collectPageDetails') {
|
||||
|
@ -1,7 +1,8 @@
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
let pageHref = null;
|
||||
|
||||
if ((typeof safari !== 'undefined')) {
|
||||
if ((typeof safari !== 'undefined') && navigator.userAgent.indexOf(' Safari/') !== -1 &&
|
||||
navigator.userAgent.indexOf('Chrome') === -1) {
|
||||
const responseCommand = 'autofillerAutofillOnPageLoadEnabledResponse';
|
||||
safari.self.tab.dispatchMessage('bitwarden', {
|
||||
command: 'bgGetDataForTab',
|
||||
|
@ -14,9 +14,10 @@ document.addEventListener('DOMContentLoaded', function (event) {
|
||||
iframed = isIframed(),
|
||||
submitButtonNames = ['log in', 'sign in', 'login', 'go', 'submit', 'continue', 'next'],
|
||||
notificationBarData = null,
|
||||
isSafariApi = (typeof safari !== 'undefined');
|
||||
isSafari = (typeof safari !== 'undefined') && navigator.userAgent.indexOf(' Safari/') !== -1 &&
|
||||
navigator.userAgent.indexOf('Chrome') === -1;
|
||||
|
||||
if (isSafariApi) {
|
||||
if (isSafari) {
|
||||
const responseCommand = 'notificationBarDataResponse';
|
||||
safari.self.tab.dispatchMessage('bitwarden', {
|
||||
command: 'bgGetDataForTab',
|
||||
@ -385,7 +386,7 @@ document.addEventListener('DOMContentLoaded', function (event) {
|
||||
return;
|
||||
}
|
||||
|
||||
var barPageUrl = isSafariApi ? (safari.extension.baseURI + barPage) : chrome.extension.getURL(barPage);
|
||||
var barPageUrl = isSafari ? (safari.extension.baseURI + barPage) : chrome.extension.getURL(barPage);
|
||||
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.src = barPageUrl;
|
||||
@ -447,7 +448,7 @@ document.addEventListener('DOMContentLoaded', function (event) {
|
||||
}
|
||||
|
||||
function sendPlatformMessage(msg) {
|
||||
if (isSafariApi) {
|
||||
if (isSafari) {
|
||||
safari.self.tab.dispatchMessage('bitwarden', msg);
|
||||
}
|
||||
else {
|
||||
|
@ -61,7 +61,7 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
|
||||
return this.deviceCache;
|
||||
}
|
||||
|
||||
if (navigator.userAgent.indexOf('Firefox') !== -1 || navigator.userAgent.indexOf('Gecko/') !== -1) {
|
||||
if (navigator.userAgent.indexOf(' Firefox/') !== -1 || navigator.userAgent.indexOf(' Gecko/') !== -1) {
|
||||
this.deviceCache = DeviceType.Firefox;
|
||||
} else if ((!!(window as any).opr && !!opr.addons) || !!(window as any).opera ||
|
||||
navigator.userAgent.indexOf(' OPR/') >= 0) {
|
||||
@ -70,9 +70,10 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
|
||||
this.deviceCache = DeviceType.Edge;
|
||||
} else if (navigator.userAgent.indexOf(' Vivaldi/') !== -1) {
|
||||
this.deviceCache = DeviceType.Vivaldi;
|
||||
} else if (navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1) {
|
||||
} else if ((window as any).safari && navigator.userAgent.indexOf(' Safari/') !== -1 &&
|
||||
navigator.userAgent.indexOf('Chrome') === -1) {
|
||||
this.deviceCache = DeviceType.Safari;
|
||||
} else if ((window as any).chrome) {
|
||||
} else if ((window as any).chrome && navigator.userAgent.indexOf(' Chrome/') !== -1) {
|
||||
this.deviceCache = DeviceType.Chrome;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user