Jelajahi Sumber

fixed issue if favicon is not present in the saved page

Former-commit-id: 2c3d76c291e3328d44b2061e303608e754a1d0f8
Gildas 6 tahun lalu
induk
melakukan
8ee4f05c21
1 mengubah file dengan 2 tambahan dan 1 penghapusan
  1. 2 1
      extension/ui/content/content-ui-editor-web.js

+ 2 - 1
extension/ui/content/content-ui-editor-web.js

@@ -77,7 +77,8 @@
 			});
 			document.replaceChild(contentDocument.documentElement, document.documentElement);
 			deserializeShadowRoots(document);
-			window.parent.postMessage(JSON.stringify({ "method": "setMetadata", title: document.title, icon: document.querySelector("link[rel*=icon]").href }), "*");
+			const iconElement = document.querySelector("link[rel*=icon]");
+			window.parent.postMessage(JSON.stringify({ "method": "setMetadata", title: document.title, icon: iconElement && iconElement.href }), "*");
 			document.querySelectorAll(NOTE_TAGNAME).forEach(containerElement => attachNoteListeners(containerElement, true));
 			document.documentElement.appendChild(getStyleElement(HIGHLIGHTS_WEB_STYLESHEET));
 			maskPageElement = getMaskElement(PAGE_MASK_CLASS, PAGE_MASK_CONTAINER_CLASS);