Skip to content

Commit

Permalink
Moved injection logic to content script
Browse files Browse the repository at this point in the history
  • Loading branch information
onionymous committed Sep 11, 2019
1 parent 788036c commit 85c7211
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/react-devtools-extensions/src/inject.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global chrome */

export default function inject(scriptName: string, done: ? Function) {
export default function inject(scriptName: string, done: ?Function) {
const source = `
(function () {
window.postMessage({ source: 'react-devtools-inject-script', scriptName: "${scriptName}" }, "*");
Expand Down
4 changes: 2 additions & 2 deletions packages/react-devtools-extensions/src/injectGlobalHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ window.addEventListener('message', function(evt) {
reactBuildType: evt.data.reactBuildType,
};
chrome.runtime.sendMessage(lastDetectionResult);
} else if (evt.data.source === 'react-devtools-inject-backend' && evt.data.scriptName) {
//Inject backend
} else if (evt.data.source === 'react-devtools-inject-script' && evt.data.scriptName) {
//Inject the specified script
var script = document.constructor.prototype.createElement.call(document, 'script');
script.src = evt.data.scriptName;
script.charset = "utf-8";
Expand Down

0 comments on commit 85c7211

Please sign in to comment.