Skip to content

Commit

Permalink
Make sure to pass the extension ID to all postMessages handled by inj…
Browse files Browse the repository at this point in the history
…ectGlobalHook
  • Loading branch information
Juan Tejada committed Oct 12, 2021
1 parent bc3fff6 commit aec8557
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/react-devtools-extensions/src/injectGlobalHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ window.__REACT_DEVTOOLS_GLOBAL_HOOK__.on('renderer', function({reactBuildType})
window.postMessage({
source: 'react-devtools-detector',
reactBuildType,
extensionId: "${CURRENT_EXTENSION_ID}",
}, '*');
});
`;
Expand Down
6 changes: 5 additions & 1 deletion packages/react-devtools-extensions/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ function createPanelIfReactLoaded() {
// Initialize the backend only once the Store has been initialized.
// Otherwise the Store may miss important initial tree op codes.
chrome.devtools.inspectedWindow.eval(
`window.postMessage({ source: 'react-devtools-inject-backend', extensionId: "${CURRENT_EXTENSION_ID}" }, '*');`,
`window.postMessage({
source: 'react-devtools-inject-backend',
extensionId: "${CURRENT_EXTENSION_ID}"
}, '*');`,
function(response, evalError) {
if (evalError) {
console.error(evalError);
Expand Down Expand Up @@ -363,6 +366,7 @@ function createPanelIfReactLoaded() {
chrome.devtools.inspectedWindow.eval(`
window.postMessage({
source: 'react-devtools-extension',
extensionId: "${CURRENT_EXTENSION_ID}"
payload: {
type: 'fetch-file-with-cache',
url: "${url}",
Expand Down

0 comments on commit aec8557

Please sign in to comment.