瀏覽代碼

defined a fallback function for console.warn (#260)

Former-commit-id: 2e5f54eb2424f152cc578797532c4c409c0ebde5
Gildas 6 年之前
父節點
當前提交
06233134f9
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      lib/hooks/content/content-hooks-frames-web.js
  2. 1 1
      lib/hooks/content/content-hooks-web.js

+ 1 - 1
lib/hooks/content/content-hooks-frames-web.js

@@ -56,7 +56,7 @@
 	const requestAnimationFrame = window.requestAnimationFrame;
 	const cancelAnimationFrame = window.cancelAnimationFrame;
 	const console = window.console;
-	const warn = console.warn;
+	const warn = (console && console.warn) || (() => { });
 
 	const observers = new Map();
 	const observedElements = new Map();

+ 1 - 1
lib/hooks/content/content-hooks-web.js

@@ -35,7 +35,7 @@
 	const addEventListener = window.addEventListener;
 	const pushState = history.pushState;
 	const console = window.console;
-	const warn = console.warn;
+	const warn = (console && console.warn) || (() => { });
 
 	let warningDisplayed;
 	history.pushState = function (state, title, url) {