Jelajahi Sumber

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

Gildas 6 tahun lalu
induk
melakukan
2e5f54eb24

+ 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) {