Ver código fonte

removed pushState call detection

Former-commit-id: d499bcedfe698f5b689cf2f3413a0e943ab7fadb
Gildas 5 anos atrás
pai
commit
4210e2e505

+ 0 - 19
lib/single-file/processors/hooks/content/content-hooks-web.js

@@ -28,29 +28,10 @@
 	const FETCH_REQUEST_EVENT = "single-file-request-fetch";
 	const FETCH_RESPONSE_EVENT = "single-file-response-fetch";
 
-	const history = window.history;
 	const dispatchEvent = window.dispatchEvent;
 	const CustomEvent = window.CustomEvent;
 	const fetch = window.fetch;
 	const addEventListener = window.addEventListener;
-	const pushState = history.pushState;
-	const console = window.console;
-	const warn = (console && console.warn) || (() => { });
-
-	let warningDisplayed;
-	history.pushState = function (state, title, url) {
-		if (!warningDisplayed) {
-			warningDisplayed = true;
-			warn.call(console, "SingleFile is hooking the history.pushState API to detect navigation."); // eslint-disable-line no-console		
-		}
-		try {
-			dispatchEvent.call(window, new CustomEvent("single-file-push-state", { detail: { state, title, url } }));
-		} catch (error) {
-			// ignored
-		}
-		pushState.call(history, state, title, url);
-	};
-	history.pushState.toString = function () { return "function pushState() { [native code] }"; };
 
 	addEventListener.call(window, FETCH_REQUEST_EVENT, async event => {
 		const url = event.detail;