Breaking: drop getStylesFallback
This commit is contained in:
parent
ad06551440
commit
8e75871b9b
|
@ -59,33 +59,6 @@ var browserCommands, contextMenus;
|
|||
// register all listeners
|
||||
msg.on(onRuntimeMessage);
|
||||
|
||||
// if (FIREFOX) {
|
||||
// see notes in apply.js for getStylesFallback
|
||||
// const MSG_GET_STYLES = 'getStyles:';
|
||||
// const MSG_GET_STYLES_LEN = MSG_GET_STYLES.length;
|
||||
// chrome.runtime.onConnect.addListener(port => {
|
||||
// if (!port.name.startsWith(MSG_GET_STYLES)) return;
|
||||
// const tabId = port.sender.tab.id;
|
||||
// const frameId = port.sender.frameId;
|
||||
// const options = tryJSONparse(port.name.slice(MSG_GET_STYLES_LEN));
|
||||
// port.disconnect();
|
||||
// FIXME: getStylesFallback?
|
||||
// getStyles(options).then(styles => {
|
||||
// if (!styles.length) return;
|
||||
// chrome.tabs.executeScript(tabId, {
|
||||
// code: `
|
||||
// applyOnMessage({
|
||||
// method: 'styleApply',
|
||||
// styles: ${JSON.stringify(styles)},
|
||||
// })
|
||||
// `,
|
||||
// runAt: 'document_start',
|
||||
// frameId,
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
|
||||
navigatorUtil.onUrlChange(({tabId, frameId}, type) => {
|
||||
if (type === 'committed') {
|
||||
// styles would be updated when content script is injected.
|
||||
|
|
|
@ -36,7 +36,6 @@ const APPLY = (() => {
|
|||
}
|
||||
|
||||
function init() {
|
||||
// FIXME: getStylesFallback?
|
||||
if (STYLE_VIA_API) {
|
||||
return API.styleViaAPI({method: 'styleApply'});
|
||||
}
|
||||
|
@ -137,28 +136,6 @@ const APPLY = (() => {
|
|||
return matchUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: remove when FF fixes the bug.
|
||||
* Firefox borks sendMessage in same-origin iframes that have 'src' with a real path on the site.
|
||||
* We implement a workaround for the initial styleApply case only.
|
||||
* Everything else (like toggling of styles) is still buggy.
|
||||
* @param {Object} msg
|
||||
* @param {Function} callback
|
||||
* @returns {Boolean|undefined}
|
||||
*/
|
||||
// function getStylesFallback(msg) {
|
||||
// if (window !== parent &&
|
||||
// location.href !== 'about:blank') {
|
||||
// try {
|
||||
// if (parent.location.origin === location.origin &&
|
||||
// parent.location.href !== location.href) {
|
||||
// chrome.runtime.connect({name: 'getStyles:' + JSON.stringify(msg)});
|
||||
// return true;
|
||||
// }
|
||||
// } catch (e) {}
|
||||
// }
|
||||
// }
|
||||
|
||||
function applyOnMessage(request) {
|
||||
if (request.method === 'ping') {
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue
Block a user