diff --git a/background/background.js b/background/background.js index 5b459a20..cbd672ce 100644 --- a/background/background.js +++ b/background/background.js @@ -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;