Window Name Eraser

Preventing data leakage through window.name

  1. // ==UserScript==
  2. // @name Window Name Eraser
  3. // @namespace https://tampermonkey.net/
  4. // @version 1.4
  5. // @description Preventing data leakage through window.name
  6. // @author Streampunk
  7. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAIVBMVEVImONImeP///9Hlt5Hlt87kd0vjt2ox+2AsebU4vVcn+Fv9GsLAAAAAnRSTlPx8MaJ79gAAAE6SURBVFiF7ZfrjsQgCIW9AIrv/8CrTicbRWstO8ls0vPTgW8OirQ11hqNcjZo5K2x4BUC8wAewApAmGJWQroDQIrsDnEk3AVQdI3i2MUUQMF1CkPCBABHfoiACEcpgUaREwepVo5H4QQVka47IG48w2uBB0VMAEmEV8LAwhiAoY+GygzyLCcAln6LBb4KKMH9vxVXg034EAD/xAFhI7oOyK1XTjF0KueYG3MNkLfg7EZIAJ7mi72RADrPd44WAFwBVg6+DcAR8Xc07gO4zFIkvg1AD4O164B36zYWdgDvpmmaaw9Qf4PbgNx1UEeq4hTEFuz2Ab7Gy21ACZcrOwDSAlBc8H0HOkDKUgGkPg7Qz0TtVF7V0D1ZJAA88DydwcMCULahvl6OlMTD8dvflR/A/wHoPr6LA2NV+gHVqi9JB+PEwAAAAABJRU5ErkJggg==
  8. // @match http://*/*
  9. // @match https://*/*
  10. // @exclude https://www.google.com/recaptcha/api2/*
  11. // @exclude https://google.com/recaptcha/api2/*
  12. // @exclude https://www.google.com/recaptcha/enterprise/*
  13. // @exclude https://google.com/recaptcha/enterprise/*
  14. // @exclude https://www.recaptcha.net/recaptcha/api2/*
  15. // @exclude https://recaptcha.net/recaptcha/api2/*
  16. // @exclude https://www.recaptcha.net/recaptcha/enterprise/*
  17. // @exclude https://recaptcha.net/recaptcha/enterprise/*
  18. // @exclude https://mail.proton.me/*
  19. // @exclude https://swisscows.email/*
  20. // @exclude https://webmail.vivaldi.net/*
  21. // @grant none
  22. // @license MIT
  23. // ==/UserScript==
  24.  
  25. 'use strict';
  26.  
  27. //Prevent the website from starting
  28. var a = window.onload;
  29. window.onload = "";
  30.  
  31. //Remove property
  32. var old = window.name;
  33. window.name = "";
  34.  
  35. if (old != "" ) {
  36. console.log("Evaluating results");
  37. Firefox.extension.sendMessage({url: document.domain, caption: old}, function(response)
  38. {
  39. switch (response.radio) {
  40. case "fallback":
  41. //White listed: bring back the property
  42. window.name = old;
  43. console.log("Window Name Eraser: Whitelisted domain");
  44. break;
  45. default:
  46. console.log("Window Name Eraser: Blocked domain");
  47. break;
  48. }
  49. //Let the website start
  50. var getType = {};
  51. if (a && getType.toString.call(a) == '[object Function]') {
  52. window.onload = function () { a(); }
  53. }
  54. });
  55. }
  56. else {
  57. //Let the website start
  58. var getType = {};
  59. if (a && getType.toString.call(a) == '[object Function]') {
  60. window.onload = function () { a(); }
  61. }
  62. console.log("Window Name Eraser: Nothing to block here");
  63. }