From 28dd799516e4373ddcf83e4c80d2bd18b0239306 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Sat, 1 Oct 2016 21:08:53 -0700 Subject: [PATCH] wombat: auto-disable notifications and geolocation queries --- pywb/static/wombat.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pywb/static/wombat.js b/pywb/static/wombat.js index e97ffeaf..03ea9732 100644 --- a/pywb/static/wombat.js +++ b/pywb/static/wombat.js @@ -2264,6 +2264,30 @@ var wombat_internal = function($wbwindow) { } } + //============================================ + function init_disable_notifications() { + if (window.Notification) { + window.Notification.requestPermission = function(callback) { + if (callback) { + callback("denied"); + } + + return Promise.resolve("denied"); + } + } + + if (window.geolocation) { + var disabled = function(success, error, options) { + if (error) { + error({"code": 2, "message": "not available"}); + } + } + + window.geolocation.getCurrentPosition = disabled; + window.geolocation.watchPosition = disabled; + } + } + //============================================ function get_final_url(prefix, mod, url) { if (mod == undefined) { @@ -2426,6 +2450,9 @@ var wombat_internal = function($wbwindow) { // open init_open_override(); + // disable notifications + init_disable_notifications(); + // expose functions this.extract_orig = extract_orig; this.rewrite_url = rewrite_url;