Explorar o código

fixed infobar conflict issue with some other extensions

Former-commit-id: 3704dbb5e87514abe44586ee16d06fd9692ca694
Gildas %!s(int64=5) %!d(string=hai) anos
pai
achega
7e76635d0c
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      common/ui/content/content-infobar-web.js

+ 3 - 2
common/ui/content/content-infobar-web.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global document, Node, window, top, getComputedStyle, setTimeout */
+/* global document, Node, window, top, getComputedStyle, setTimeout, XPathResult */
 
 (() => {
 
@@ -41,7 +41,8 @@
 	}
 
 	async function displayIcon() {
-		let singleFileComment = document.documentElement.childNodes[0];
+		const result = document.evaluate("//comment()", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
+		let singleFileComment = result && result.singleNodeValue;
 		if (singleFileComment && isSingleFileComment(singleFileComment)) {
 			const info = singleFileComment.textContent.split("\n");
 			const [, , url, saveDate, ...infoData] = info;