fixup 7f5a5fec: give iframe time to run our content script
This commit is contained in:
parent
41e2d43ecc
commit
fbd0b96f49
|
@ -788,10 +788,7 @@ window.addEventListener('showStyles:done', function _() {
|
||||||
const data = {url, resolve, reject, timeout};
|
const data = {url, resolve, reject, timeout};
|
||||||
usoFrameQueue.set(id, data);
|
usoFrameQueue.set(id, data);
|
||||||
usoFrame.contentWindow.postMessage({xhr: {id, url}}, '*');
|
usoFrame.contentWindow.postMessage({xhr: {id, url}}, '*');
|
||||||
}) :
|
}) : setupFrame().then(() => downloadInFrame(url));
|
||||||
setupFrame()
|
|
||||||
.then(() => new Promise(setTimeout))
|
|
||||||
.then(() => downloadInFrame(url));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupFrame() {
|
function setupFrame() {
|
||||||
|
@ -847,6 +844,9 @@ window.addEventListener('showStyles:done', function _() {
|
||||||
const done = event => {
|
const done = event => {
|
||||||
chrome.webRequest.onHeadersReceived.removeListener(stripHeaders);
|
chrome.webRequest.onHeadersReceived.removeListener(stripHeaders);
|
||||||
(event.type === 'load' ? resolve : reject)();
|
(event.type === 'load' ? resolve : reject)();
|
||||||
|
usoFrameQueue.forEach(({url}, id) => {
|
||||||
|
usoFrame.contentWindow.postMessage({xhr: {id, url}}, '*');
|
||||||
|
});
|
||||||
};
|
};
|
||||||
usoFrame.addEventListener('load', done, {once: true});
|
usoFrame.addEventListener('load', done, {once: true});
|
||||||
usoFrame.addEventListener('error', done, {once: true});
|
usoFrame.addEventListener('error', done, {once: true});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user