Skip to content

Fixes privacy measures issue in Chrome 101+ #26984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions packages/react-devtools-extensions/src/utils.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
/* global chrome */

import type {BrowserTheme} from 'react-devtools-shared/src/devtools/views/DevTools';
export let IS_EDGE;
export let IS_FIREFOX;
export let IS_CHROME;
function getBrowserData() {
if (navigator.userAgentData) {
const brandItems = navigator.userAgentData.brands;
IS_EDGE = brandItems.some(item => item.brand === 'Microsoft Edge');
IS_FIREFOX = brandItems.some(item => item.brand === 'Mozilla Firefox');
IS_CHROME = brandItems.some(item => item.brand === 'Google Chrome');
} else {
IS_EDGE = navigator.userAgent.indexOf('Edg') >= 0;
IS_FIREFOX = navigator.userAgent.indexOf('Firefox') >= 0;
IS_CHROME = IS_EDGE === false && IS_FIREFOX === false;
}
}

export const IS_EDGE = navigator.userAgent.indexOf('Edg') >= 0;
export const IS_FIREFOX = navigator.userAgent.indexOf('Firefox') >= 0;
export const IS_CHROME = IS_EDGE === false && IS_FIREFOX === false;

getBrowserData();
export type BrowserName = 'Chrome' | 'Firefox' | 'Edge';

export function getBrowserName(): BrowserName {
if (IS_EDGE) {
return 'Edge';
Expand Down Expand Up @@ -41,6 +51,5 @@ export function getBrowserTheme(): BrowserTheme {
}
}
}

export const COMPACT_VERSION_NAME = 'compact';
export const EXTENSION_CONTAINED_VERSIONS = [COMPACT_VERSION_NAME];