diff --git a/content/apply.js b/content/apply.js index f2fe75ee..92cc007b 100644 --- a/content/apply.js +++ b/content/apply.js @@ -58,12 +58,15 @@ define(require => { if (STYLE_VIA_API) { await API.styleViaAPI({method: 'styleApply'}); } else { - const SYM = Symbol.for('styles'); + const SYM_ID = 'styles'; + const SYM = Symbol.for(SYM_ID); const styles = window[SYM] || - chrome.app && !chrome.tabs && getStylesViaXhr() || + (IS_FRAME && location.href === 'about:blank' + ? getParentStyles(SYM_ID) + : chrome.app && !chrome.tabs && getStylesViaXhr()) || await API.styles.getSectionsByUrl(getMatchUrl(), null, true); - delete window[SYM]; + window[SYM] = styles; if (styles.disableAll) { delete styles.disableAll; styleInjector.toggle(false); @@ -72,6 +75,12 @@ define(require => { } } + function getParentStyles(id) { + try { + return parent[parent.Symbol.for(id)]; + } catch (e) {} + } + function getStylesViaXhr() { try { const blobId = document.cookie.split(chrome.runtime.id + '=')[1].split(';')[0];