Skip to content

Commit

Permalink
Removed done(), added some comments explaining the change
Browse files Browse the repository at this point in the history
  • Loading branch information
onionymous committed Sep 11, 2019
1 parent 8a6cd3c commit 2e75000
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 5 additions & 1 deletion packages/react-devtools-extensions/src/injectGlobalHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ window.addEventListener('message', function(evt) {
reactBuildType: evt.data.reactBuildType,
};
chrome.runtime.sendMessage(lastDetectionResult);

// Inject the backend. This is done in the content script to avoid CSP
// and Trusted Types violations, since content scripts can modify the DOM
// and are not subject to the page's policies
} else if (evt.data.source === 'react-devtools-inject-backend') {
//Inject the specified script
// the prototype stuff is in case document.createElement has been modified
var script = document.constructor.prototype.createElement.call(document, 'script');
script.src = chrome.runtime.getURL('build/backend.js');
script.charset = "utf-8";
Expand Down
10 changes: 3 additions & 7 deletions packages/react-devtools-extensions/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,10 @@ function createPanelIfReactLoaded() {
chrome.devtools.inspectedWindow.eval(
`window.postMessage({ source: 'react-devtools-inject-backend' });`,
function(response, error) {
if (error) {
console.log(error);
}

if (typeof done === 'function') {
done();
if (error) {
console.log(error);
}
}
}
);

const viewElementSourceFunction = createViewElementSource(
Expand Down

0 comments on commit 2e75000

Please sign in to comment.