fixup! use executeScript for early data injection
This commit is contained in:
parent
fd8e0cca7f
commit
b037713c7d
|
@ -66,12 +66,13 @@ define(async require => {
|
||||||
}
|
}
|
||||||
|
|
||||||
function injectData(req) {
|
function injectData(req) {
|
||||||
const {str} = stylesToPass[req2key(req)] || {};
|
const data = stylesToPass[req2key(req)];
|
||||||
if (str) {
|
if (data && !data.injected) {
|
||||||
|
data.injected = true;
|
||||||
chrome.tabs.executeScript(req.tabId, {
|
chrome.tabs.executeScript(req.tabId, {
|
||||||
frameId: req.frameId,
|
frameId: req.frameId,
|
||||||
runAt: 'document_start',
|
runAt: 'document_start',
|
||||||
code: `(${injectedCode})(${str})`,
|
code: `(${injectedCode})(${data.str})`,
|
||||||
});
|
});
|
||||||
if (!state.xhr) cleanUp(req);
|
if (!state.xhr) cleanUp(req);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user