-
Notifications
You must be signed in to change notification settings - Fork 47.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moved backend injection to the content script #16752
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change seems safe. At least based on my own testing, I don't see anything that has regressed. I'll land it internally and see if anyone else notices something!
@@ -4,7 +4,6 @@ import {createElement} from 'react'; | |||
import {unstable_createRoot as createRoot, flushSync} from 'react-dom'; | |||
import Bridge from 'react-devtools-shared/src/bridge'; | |||
import Store from 'react-devtools-shared/src/devtools/store'; | |||
import inject from './inject'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the only use of the inject.js
module, so we can delete that now.
* Moved backend injection logic to content script * Moved backend injection logic to content script * Moved injection logic to content script * Formatting changes * remove ability to inject arbitrary scripts * Removed done(), added some comments explaining the change * Lint fixes * Moved inline comment. * Deleted inject() script since it was no longer being used
Merged via 8f03109 |
PR facebook#16752 changed how we were injecting the backend script to be done by the content script in order to work around Trusted Type limitations with our previous approach. This may have caused a regression (see facebook#16840) so I'm backing it out to verify.
Moved the backend injection logic to the content script. Previously this was done by using
chrome.devtools.inspectedWindow.eval()
:Since this code runs in the context of the inspected page, it is subject to the page's CSP restrictions and will cause a Trusted Types violation. Content scripts, however, are not subject to the page's restrictions and can manipulate the DOM. This change will prevent a TrustedScriptURL violation on clients that have Trusted Types support.