Skip to content
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

Revert logic for checking for duplicate installations of DevTools #22638

Merged
merged 6 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
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;
Expand Down Expand Up @@ -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) {
Expand Down

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
Expand Up @@ -2,8 +2,6 @@

'use strict';

import {CURRENT_EXTENSION_ID} from './constants';

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

Expand All @@ -12,7 +10,6 @@ function sayHelloToBackend() {
{
source: 'react-devtools-content-script',
hello: true,
extensionId: CURRENT_EXTENSION_ID,
},
'*',
);
Expand All @@ -23,7 +20,6 @@ function handleMessageFromDevtools(message) {
{
source: 'react-devtools-content-script',
payload: message,
extensionId: CURRENT_EXTENSION_ID,
},
'*',
);
Expand Down Expand Up @@ -53,7 +49,6 @@ function handleDisconnect() {
type: 'event',
event: 'shutdown',
},
extensionId: CURRENT_EXTENSION_ID,
},
'*',
);
Expand Down
20 changes: 1 addition & 19 deletions packages/react-devtools-extensions/src/injectGlobalHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 = {
Expand Down Expand Up @@ -118,7 +101,6 @@ window.__REACT_DEVTOOLS_GLOBAL_HOOK__.on('renderer', function({reactBuildType})
window.postMessage({
source: 'react-devtools-detector',
reactBuildType,
extensionId: "${CURRENT_EXTENSION_ID}",
}, '*');
});
`;
Expand Down
Loading