GeezerVison is showing github.com — Moved backend injection logic to content script · react/react@788036c
File tree
Expand file treeCollapse file tree
Open diff view settings
packages/react-devtools-extensions/src
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/react-devtools-extensions/src/inject.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
3 | 3 | export default function inject(scriptName: string, done: ? Function) { |
4 | 4 | const source = ` |
5 | 5 | (function () { |
6 | | - window.postMessage({ source: 'react-devtools-inject-backend', type: "FROM_PAGE", text: "Hello from the webpage!" }, "*"); |
| 6 | + window.postMessage({ source: 'react-devtools-inject-script', scriptName: "${scriptName}" }, "*"); |
7 | 7 | })() |
8 | 8 | `; |
9 | 9 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: packages/react-devtools-extensions/src/injectGlobalHook.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -37,10 +37,10 @@ window.addEventListener('message', function(evt) { |
37 | 37 | reactBuildType: evt.data.reactBuildType, |
38 | 38 | }; |
39 | 39 | chrome.runtime.sendMessage(lastDetectionResult); |
40 | | - } else if (evt.data.source === 'react-devtools-inject-backend') { |
| 40 | + } else if (evt.data.source === 'react-devtools-inject-backend' && evt.data.scriptName) { |
41 | 41 | //Inject backend |
42 | 42 | var script = document.constructor.prototype.createElement.call(document, 'script'); |
43 | | - script.src = chrome.runtime.getURL('build/backend.js'); |
| 43 | + script.src = evt.data.scriptName; |
44 | 44 | script.charset = "utf-8"; |
45 | 45 | document.documentElement.appendChild(script); |
46 | 46 | script.parentNode.removeChild(script); |
@@ -97,4 +97,4 @@ if (sessionStorageGetItem(SESSION_STORAGE_RELOAD_AND_PROFILE_KEY) === 'true') { |
97 | 97 | // devtools are installed (and skip its suggestion to install the devtools). |
98 | 98 | injectCode( |
99 | 99 | ';(' + installHook.toString() + '(window))' + saveNativeValues + detectReact, |
100 | | -); |
| 100 | +); |