-
Notifications
You must be signed in to change notification settings - Fork 46.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
PR #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 #16840) so I'm backing it out to verify.
- Loading branch information
Brian Vaughn
authored
Sep 23, 2019
1 parent
9b3cde9
commit bce2ac6
Showing
3 changed files
with
37 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* global chrome */ | ||
|
||
export default function inject(scriptName: string, done: ?Function) { | ||
const source = ` | ||
// the prototype stuff is in case document.createElement has been modified | ||
(function () { | ||
var script = document.constructor.prototype.createElement.call(document, 'script'); | ||
script.src = "${scriptName}"; | ||
script.charset = "utf-8"; | ||
document.documentElement.appendChild(script); | ||
script.parentNode.removeChild(script); | ||
})() | ||
`; | ||
|
||
chrome.devtools.inspectedWindow.eval(source, function(response, error) { | ||
if (error) { | ||
console.log(error); | ||
} | ||
|
||
if (typeof done === 'function') { | ||
done(); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters