Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
11 changes: 0 additions & 11 deletions packages/react-devtools-extensions/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,6 @@ const build = async (tempPath, manifestPath) => {
}
manifest.description += `\n\nCreated from revision ${commit} on ${dateString}.`;

if (process.env.NODE_ENV === 'development') {
// When building the local development version of the
// extension we want to be able to have a stable extension ID
// for the local build (in order to be able to reliably detect
// duplicate installations of DevTools).
// By specifying a key in the built manifest.json file,
// we can make it so the generated extension ID is stable.
// For more details see the docs here: https://developer.chrome.com/docs/extensions/mv2/manifest/key/
manifest.key = 'reactdevtoolslocalbuilduniquekey';
}

writeFileSync(copiedManifestPath, JSON.stringify(manifest, null, 2));

// Pack the extension
Expand Down
8 changes: 4 additions & 4 deletions packages/react-devtools-extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"private": true,
"scripts": {
"build": "cross-env NODE_ENV=production yarn run build:chrome && yarn run build:firefox && yarn run build:edge",
"build:local": "cross-env NODE_ENV=development yarn run build:chrome:local && yarn run build:firefox:local && yarn run build:edge:local",
"build:dev": "cross-env NODE_ENV=development yarn run build:chrome:dev && yarn run build:firefox:dev && yarn run build:edge:dev",
"build:chrome": "cross-env NODE_ENV=production node ./chrome/build",
"build:chrome:fb": "cross-env NODE_ENV=production FEATURE_FLAG_TARGET=extension-fb node ./chrome/build --crx",
"build:chrome:local": "cross-env NODE_ENV=development node ./chrome/build",
"build:chrome:dev": "cross-env NODE_ENV=development node ./chrome/build",
"build:firefox": "cross-env NODE_ENV=production node ./firefox/build",
"build:firefox:local": "cross-env NODE_ENV=development node ./firefox/build",
"build:firefox:dev": "cross-env NODE_ENV=development node ./firefox/build",
"build:edge": "cross-env NODE_ENV=production node ./edge/build",
"build:edge:fb": "cross-env NODE_ENV=production FEATURE_FLAG_TARGET=extension-fb node ./edge/build --crx",
"build:edge:local": "cross-env NODE_ENV=development node ./edge/build",
"build:edge:dev": "cross-env NODE_ENV=development node ./edge/build",
"test:chrome": "node ./chrome/test",
"test:firefox": "node ./firefox/test",
"test:edge": "node ./edge/test",
Expand Down
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