Parcourir la source

fixed refresh issue on firefox

Former-commit-id: 63feef7041052fc918ba33b9fad552588ad631f7
Gildas il y a 6 ans
Parent
commit
6387069bcd
1 fichiers modifiés avec 3 ajouts et 3 suppressions
  1. 3 3
      extension/core/bg/editor.js

+ 3 - 3
extension/core/bg/editor.js

@@ -26,6 +26,7 @@
 singlefile.extension.core.bg.editor = (() => {
 
 	const tabsData = new Map();
+	const EDITOR_URL = browser.runtime.getURL("/extension/ui/pages/editor.html");
 
 	return {
 		onMessage,
@@ -33,7 +34,7 @@ singlefile.extension.core.bg.editor = (() => {
 		onTabUpdated,
 		async open({ content, filename }, options) {
 			const tab = await browser.tabs.create({ active: true, url: "/extension/ui/pages/editor.html" });
-			tabsData.set(tab.id, { content, filename, options, url: tab.url });
+			tabsData.set(tab.id, { content, filename, options });
 		}
 	};
 
@@ -42,8 +43,7 @@ singlefile.extension.core.bg.editor = (() => {
 	}
 
 	async function onTabUpdated(tabId, changeInfo, tab) {
-		const tabData = tabsData.get(tab.id);
-		if (tabData && tabData.url != tab.url) {
+		if (tab.url != EDITOR_URL) {
 			tabsData.delete(tabId);
 		}
 	}