GeezerVison is showing github.com — Removed done(), added some comments explaining the change · react/react@2e75000
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/injectGlobalHook.js +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -31,8 +31,12 @@ window.addEventListener('message', function(evt) { |
31 | 31 | reactBuildType: evt.data.reactBuildType, |
32 | 32 | }; |
33 | 33 | chrome.runtime.sendMessage(lastDetectionResult); |
| 34 | + |
| 35 | + // Inject the backend. This is done in the content script to avoid CSP |
| 36 | + // and Trusted Types violations, since content scripts can modify the DOM |
| 37 | + // and are not subject to the page's policies |
34 | 38 | } else if (evt.data.source === 'react-devtools-inject-backend') { |
35 | | - //Inject the specified script |
| 39 | + // the prototype stuff is in case document.createElement has been modified |
36 | 40 | var script = document.constructor.prototype.createElement.call(document, 'script'); |
37 | 41 | script.src = chrome.runtime.getURL('build/backend.js'); |
38 | 42 | script.charset = "utf-8"; |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/react-devtools-extensions/src/main.js +3-7Lines changed: 3 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -138,14 +138,10 @@ function createPanelIfReactLoaded() { |
138 | 138 | chrome.devtools.inspectedWindow.eval( |
139 | 139 | `window.postMessage({ source: 'react-devtools-inject-backend' });`, |
140 | 140 | function(response, error) { |
141 | | - if (error) { |
142 | | - console.log(error); |
143 | | - } |
144 | | - |
145 | | - if (typeof done === 'function') { |
146 | | - done(); |
| 141 | + if (error) { |
| 142 | + console.log(error); |
| 143 | + } |
147 | 144 | } |
148 | | - } |
149 | 145 | ); |
150 | 146 |
|
151 | 147 | const viewElementSourceFunction = createViewElementSource( |
|