Skip to content

Revert logic for checking for duplicate installations of DevTools #22638

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

Merged
merged 6 commits into from
Oct 27, 2021
Merged
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
22 changes: 2 additions & 20 deletions packages/react-devtools-extensions/src/background.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
// @flow strict-local
/* global chrome */

'use strict';

declare var chrome: any;

const ports: {
[tab: string]: {|devtools: any, 'content-script': any|},
} = {};
const ports = {};

const IS_FIREFOX = navigator.userAgent.indexOf('Firefox') >= 0;

import {
EXTENSION_INSTALL_CHECK,
SHOW_DUPLICATE_EXTENSION_WARNING,
} from './constants';

chrome.runtime.onConnect.addListener(function(port) {
let tab = null;
let name = null;
@@ -125,15 +116,6 @@ chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
}
});

chrome.runtime.onMessageExternal.addListener(
(request, sender, sendResponse) => {
if (request === EXTENSION_INSTALL_CHECK) {
sendResponse(true);
chrome.runtime.sendMessage(SHOW_DUPLICATE_EXTENSION_WARNING);
}
},
);

chrome.runtime.onMessage.addListener((request, sender) => {
const tab = sender.tab;
if (tab) {

This file was deleted.

35 changes: 0 additions & 35 deletions packages/react-devtools-extensions/src/constants.js

This file was deleted.

5 changes: 0 additions & 5 deletions packages/react-devtools-extensions/src/contentScript.js
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@

'use strict';

import {CURRENT_EXTENSION_ID} from './constants';

let backendDisconnected: boolean = false;
let backendInitialized: boolean = false;

@@ -12,7 +10,6 @@ function sayHelloToBackend() {
{
source: 'react-devtools-content-script',
hello: true,
extensionId: CURRENT_EXTENSION_ID,
},
'*',
);
@@ -23,7 +20,6 @@ function handleMessageFromDevtools(message) {
{
source: 'react-devtools-content-script',
payload: message,
extensionId: CURRENT_EXTENSION_ID,
},
'*',
);
@@ -53,7 +49,6 @@ function handleDisconnect() {
type: 'event',
event: 'shutdown',
},
extensionId: CURRENT_EXTENSION_ID,
},
'*',
);
20 changes: 1 addition & 19 deletions packages/react-devtools-extensions/src/injectGlobalHook.js
Original file line number Diff line number Diff line change
@@ -2,11 +2,7 @@

import nullthrows from 'nullthrows';
import {installHook} from 'react-devtools-shared/src/hook';
import {
__DEBUG__,
SESSION_STORAGE_RELOAD_AND_PROFILE_KEY,
} from 'react-devtools-shared/src/constants';
import {CURRENT_EXTENSION_ID, EXTENSION_INSTALLATION_TYPE} from './constants';
import {SESSION_STORAGE_RELOAD_AND_PROFILE_KEY} from 'react-devtools-shared/src/constants';
import {sessionStorageGetItem} from 'react-devtools-shared/src/storage';

function injectCode(code) {
@@ -31,19 +27,6 @@ window.addEventListener('message', function onMessage({data, source}) {
if (source !== window || !data) {
return;
}
if (data.extensionId != null && data.extensionId !== CURRENT_EXTENSION_ID) {
if (__DEBUG__) {
console.log(
`[injectGlobalHook] Received message '${data.source}' from different extension instance. Skipping message.`,
{
currentExtension: EXTENSION_INSTALLATION_TYPE,
currentExtensionId: CURRENT_EXTENSION_ID,
providedExtensionId: data.extensionId,
},
);
}
return;
}
switch (data.source) {
case 'react-devtools-detector':
lastDetectionResult = {
@@ -118,7 +101,6 @@ window.__REACT_DEVTOOLS_GLOBAL_HOOK__.on('renderer', function({reactBuildType})
window.postMessage({
source: 'react-devtools-detector',
reactBuildType,
extensionId: "${CURRENT_EXTENSION_ID}",
}, '*');
});
`;
762 changes: 349 additions & 413 deletions packages/react-devtools-extensions/src/main.js

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions packages/react-devtools-shared/src/devtools/views/DevTools.js
Original file line number Diff line number Diff line change
@@ -34,7 +34,6 @@ import {SchedulingProfilerContextController} from 'react-devtools-scheduling-pro
import {ModalDialogContextController} from './ModalDialog';
import ReactLogo from './ReactLogo';
import UnsupportedBridgeProtocolDialog from './UnsupportedBridgeProtocolDialog';
import DuplicateInstallationDialog from './DuplicateInstallationDialog';
import UnsupportedVersionDialog from './UnsupportedVersionDialog';
import WarnIfLegacyBackendDetected from './WarnIfLegacyBackendDetected';
import {useLocalStorage} from './hooks';
@@ -74,7 +73,6 @@ export type Props = {|
enabledInspectedElementContextMenu?: boolean,
showTabBar?: boolean,
store: Store,
warnIfDuplicateInstallation?: boolean,
warnIfLegacyBackendDetected?: boolean,
warnIfUnsupportedVersionDetected?: boolean,
viewAttributeSourceFunction?: ?ViewAttributeSource,
@@ -134,7 +132,6 @@ export default function DevTools({
profilerPortalContainer,
showTabBar = false,
store,
warnIfDuplicateInstallation = false,
warnIfLegacyBackendDetected = false,
warnIfUnsupportedVersionDetected = false,
viewAttributeSourceFunction,
@@ -322,7 +319,6 @@ export default function DevTools({
</ViewElementSourceContext.Provider>
</SettingsContextController>
<UnsupportedBridgeProtocolDialog />
{warnIfDuplicateInstallation && <DuplicateInstallationDialog />}
{warnIfLegacyBackendDetected && <WarnIfLegacyBackendDetected />}
{warnIfUnsupportedVersionDetected && <UnsupportedVersionDialog />}
</ModalDialogContextController>

This file was deleted.