浏览代码

fix: old FF defines head in HTMLDocument

tophf 5 年之前
父节点
当前提交
2ea6e96c2f
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/injected/content/inject.js

+ 2 - 1
src/injected/content/inject.js

@@ -22,7 +22,8 @@ defineProperty(window, process.env.INIT_FUNC_NAME, { value: 1 });
 
 const { document, setTimeout } = global;
 // Userscripts in content mode may redefine head and documentElement
-const { get: getHead } = describeProperty(Document.prototype, 'head');
+const { get: getHead } = describeProperty(Document.prototype, 'head')
+  || describeProperty(HTMLDocument.prototype, 'head'); // old FF before 61;
 const { get: getDocElem } = describeProperty(Document.prototype, 'documentElement');
 const { appendChild } = Document.prototype; // same as Node.appendChild