소스 검색

ignore errors when trying to override document.cookie

Gildas 6 년 전
부모
커밋
0ee9e110bc
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      lib/hooks/hooks-frame.js

+ 4 - 0
lib/hooks/hooks-frame.js

@@ -82,7 +82,11 @@ this.hooksFrame = this.hooksFrame || (() => {
 			document.documentElement.__defineGetter__("clientWidth", () => scrollWidth);
 			screen.__defineGetter__("height", () => scrollHeight);
 			screen.__defineGetter__("width", () => scrollWidth);
+			try {
 			document.__defineGetter__("cookie", () => { throw new Error("document.cookie temporary blocked by SingleFile"); });
+			} catch (error) {
+				// ignored
+			}
 			if (!window._singleFile_getBoundingClientRect) {
 				window._singleFile_getBoundingClientRect = Element.prototype.getBoundingClientRect;
 				Element.prototype.getBoundingClientRect = function () {