FF: ensure styles are applied to about:blank iframes

fixes #215
This commit is contained in:
tophf 2018-03-08 19:19:23 +03:00
parent 2eb0a309b5
commit 28ef5572ba

View File

@ -64,6 +64,12 @@ chrome.runtime.onMessage.addListener(onRuntimeMessage);
{hostSuffix: '.githubusercontent.com', urlSuffix: '.user.styl'},
]
});
// FF misses some about:blank iframes so we inject our content script explicitly
chrome.webNavigation.onDOMContentLoaded.addListener(webNavIframeHelperFF, {
url: [
{urlEquals: 'about:blank'},
]
});
}
}
@ -330,6 +336,20 @@ function webNavUsercssInstallerFF(data) {
}
function webNavIframeHelperFF({tabId, frameId}) {
if (!frameId) return;
sendMessage({method: 'ping', tabId, frameId}, pong => {
ignoreChromeError();
if (pong) return;
chrome.tabs.executeScript(tabId, {
frameId,
file: '/content/apply.js',
matchAboutBlank: true,
}, ignoreChromeError);
});
}
function updateIcon({tab, styles}) {
if (tab.id < 0) {
return;