fixup! use executeScript for early data injection

This commit is contained in:
tophf 2020-12-19 12:59:57 +03:00
parent fd8e0cca7f
commit b037713c7d

View File

@ -66,12 +66,13 @@ define(async require => {
}
function injectData(req) {
const {str} = stylesToPass[req2key(req)] || {};
if (str) {
const data = stylesToPass[req2key(req)];
if (data && !data.injected) {
data.injected = true;
chrome.tabs.executeScript(req.tabId, {
frameId: req.frameId,
runAt: 'document_start',
code: `(${injectedCode})(${str})`,
code: `(${injectedCode})(${data.str})`,
});
if (!state.xhr) cleanUp(req);
}