Skip to content

Commit 39b5591

Browse files
JuanKamranAsif
Juan
authored andcommitted
Revert logic for checking for duplicate installations of DevTools (facebook#22638)
* Revert "Only show DevTools warning about unrecognized build in Chrome (facebook#22571)" This reverts commit b72dc8e. * Revert "Show warning in UI when duplicate installations of DevTools extension are detected (facebook#22563)" This reverts commit 930c9e7. * Revert "Prevent errors/crashing when multiple installs of DevTools are present (facebook#22517)" This reverts commit 545d4c2. * Remove all references to passing extensionId in postMessage * Keep build changes * lint
1 parent 24e0936 commit 39b5591

File tree

8 files changed

+352
-688
lines changed

8 files changed

+352
-688
lines changed

packages/react-devtools-extensions/src/background.js

+2-20
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
1-
// @flow strict-local
1+
/* global chrome */
22

33
'use strict';
44

5-
declare var chrome: any;
6-
7-
const ports: {
8-
[tab: string]: {|devtools: any, 'content-script': any|},
9-
} = {};
5+
const ports = {};
106

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

13-
import {
14-
EXTENSION_INSTALL_CHECK,
15-
SHOW_DUPLICATE_EXTENSION_WARNING,
16-
} from './constants';
17-
189
chrome.runtime.onConnect.addListener(function(port) {
1910
let tab = null;
2011
let name = null;
@@ -125,15 +116,6 @@ chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
125116
}
126117
});
127118

128-
chrome.runtime.onMessageExternal.addListener(
129-
(request, sender, sendResponse) => {
130-
if (request === EXTENSION_INSTALL_CHECK) {
131-
sendResponse(true);
132-
chrome.runtime.sendMessage(SHOW_DUPLICATE_EXTENSION_WARNING);
133-
}
134-
},
135-
);
136-
137119
chrome.runtime.onMessage.addListener((request, sender) => {
138120
const tab = sender.tab;
139121
if (tab) {

packages/react-devtools-extensions/src/checkForDuplicateInstallations.js

-137
This file was deleted.

packages/react-devtools-extensions/src/constants.js

-35
This file was deleted.

packages/react-devtools-extensions/src/contentScript.js

-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
'use strict';
44

5-
import {CURRENT_EXTENSION_ID} from './constants';
6-
75
let backendDisconnected: boolean = false;
86
let backendInitialized: boolean = false;
97

@@ -12,7 +10,6 @@ function sayHelloToBackend() {
1210
{
1311
source: 'react-devtools-content-script',
1412
hello: true,
15-
extensionId: CURRENT_EXTENSION_ID,
1613
},
1714
'*',
1815
);
@@ -23,7 +20,6 @@ function handleMessageFromDevtools(message) {
2320
{
2421
source: 'react-devtools-content-script',
2522
payload: message,
26-
extensionId: CURRENT_EXTENSION_ID,
2723
},
2824
'*',
2925
);
@@ -53,7 +49,6 @@ function handleDisconnect() {
5349
type: 'event',
5450
event: 'shutdown',
5551
},
56-
extensionId: CURRENT_EXTENSION_ID,
5752
},
5853
'*',
5954
);

packages/react-devtools-extensions/src/injectGlobalHook.js

+1-19
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22

33
import nullthrows from 'nullthrows';
44
import {installHook} from 'react-devtools-shared/src/hook';
5-
import {
6-
__DEBUG__,
7-
SESSION_STORAGE_RELOAD_AND_PROFILE_KEY,
8-
} from 'react-devtools-shared/src/constants';
9-
import {CURRENT_EXTENSION_ID, EXTENSION_INSTALLATION_TYPE} from './constants';
5+
import {SESSION_STORAGE_RELOAD_AND_PROFILE_KEY} from 'react-devtools-shared/src/constants';
106
import {sessionStorageGetItem} from 'react-devtools-shared/src/storage';
117

128
function injectCode(code) {
@@ -31,19 +27,6 @@ window.addEventListener('message', function onMessage({data, source}) {
3127
if (source !== window || !data) {
3228
return;
3329
}
34-
if (data.extensionId != null && data.extensionId !== CURRENT_EXTENSION_ID) {
35-
if (__DEBUG__) {
36-
console.log(
37-
`[injectGlobalHook] Received message '${data.source}' from different extension instance. Skipping message.`,
38-
{
39-
currentExtension: EXTENSION_INSTALLATION_TYPE,
40-
currentExtensionId: CURRENT_EXTENSION_ID,
41-
providedExtensionId: data.extensionId,
42-
},
43-
);
44-
}
45-
return;
46-
}
4730
switch (data.source) {
4831
case 'react-devtools-detector':
4932
lastDetectionResult = {
@@ -118,7 +101,6 @@ window.__REACT_DEVTOOLS_GLOBAL_HOOK__.on('renderer', function({reactBuildType})
118101
window.postMessage({
119102
source: 'react-devtools-detector',
120103
reactBuildType,
121-
extensionId: "${CURRENT_EXTENSION_ID}",
122104
}, '*');
123105
});
124106
`;

0 commit comments

Comments
 (0)