troubleshooter.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. (function() {
  2. function reapply(arr) {
  3. for (let i = 0, len = arr.length; i < len; i++) {
  4. switch (arr[i].type) {
  5. case 32: // string
  6. Services.prefs.setCharPref(arr[i].name, arr[i].value);
  7. break;
  8. case 64: // int
  9. Services.prefs.setIntPref(arr[i].name, arr[i].value);
  10. break;
  11. case 128: // boolean
  12. Services.prefs.setBoolPref(arr[i].name, arr[i].value);
  13. break;
  14. default:
  15. console.log("error re-appyling value for '"+arr[i].name+"' !"); // should never happen
  16. }
  17. }
  18. }
  19. function myreset(arr) {
  20. for (let i = 0, len = arr.length; i < len; i++) {
  21. Services.prefs.clearUserPref(arr[i].name);
  22. }
  23. }
  24. let ops = [
  25. 'accessibility.force_disabled',
  26. 'browser.cache.offline.enable',
  27. 'browser.display.use_document_fonts',
  28. 'browser.formfill.enable',
  29. 'browser.link.open_newwindow.restriction',
  30. 'browser.search.suggest.enabled',
  31. 'browser.storageManager.enabled',
  32. 'browser.tabs.remote.allowLinkedWebInFileUriProcess',
  33. 'browser.urlbar.autoFill',
  34. 'browser.urlbar.autoFill.typed',
  35. 'browser.urlbar.oneOffSearches',
  36. 'browser.urlbar.suggest.searches',
  37. 'camera.control.face_detection.enabled',
  38. 'canvas.capturestream.enabled',
  39. 'dom.caches.enabled',
  40. 'dom.event.clipboardevents.enabled',
  41. 'dom.idle-observers-api.enabled',
  42. 'dom.IntersectionObserver.enabled',
  43. 'dom.popup_allowed_events',
  44. 'dom.popup_maximum',
  45. 'dom.push.connection.enabled',
  46. 'dom.push.enabled',
  47. 'dom.push.serverURL',
  48. 'dom.serviceWorkers.enabled',
  49. 'dom.storageManager.enabled',
  50. 'dom.vibrator.enabled',
  51. 'dom.webaudio.enabled',
  52. 'dom.webnotifications.enabled',
  53. 'dom.webnotifications.serviceworker.enabled',
  54. 'font.blacklist.underline_offset',
  55. 'full-screen-api.enabled',
  56. 'geo.wifi.uri',
  57. 'gfx.downloadable_fonts.woff2.enabled',
  58. 'gfx.font_rendering.graphite.enabled',
  59. 'gfx.font_rendering.opentype_svg.enabled',
  60. 'intl.accept_languages',
  61. 'javascript.options.asmjs',
  62. 'javascript.options.wasm',
  63. 'keyword.enabled',
  64. 'layout.css.font-loading-api.enabled',
  65. 'layout.css.visited_links_enabled',
  66. 'mathml.disabled',
  67. 'media.autoplay.enabled',
  68. 'media.getusermedia.screensharing.allowed_domains',
  69. 'media.getusermedia.screensharing.enabled',
  70. 'media.ondevicechange.enabled',
  71. 'network.auth.subresource-img-cross-origin-http-auth-allow',
  72. 'network.cookie.thirdparty.sessionOnly',
  73. 'network.http.altsvc.enabled',
  74. 'network.http.altsvc.oe',
  75. 'network.http.redirection-limit',
  76. 'network.http.referer.XOriginPolicy',
  77. 'network.protocol-handler.external.ms-windows-store',
  78. 'permissions.manager.defaultsUrl',
  79. 'plugin.default.state',
  80. 'plugin.defaultXpi.state',
  81. 'plugin.scan.plid.all',
  82. 'plugin.sessionPermissionNow.intervalInMinutes',
  83. 'privacy.trackingprotection.enabled',
  84. 'security.cert_pinning.enforcement_level',
  85. 'security.csp.experimentalEnabled',
  86. 'security.data_uri.block_toplevel_data_uri_navigations',
  87. 'security.family_safety.mode',
  88. 'security.mixed_content.block_display_content',
  89. 'security.mixed_content.use_hsts',
  90. 'security.OCSP.require',
  91. 'security.pki.sha1_enforcement_level',
  92. 'security.ssl.treat_unsafe_negotiation_as_broken',
  93. 'security.tls.enable_0rtt_data',
  94. 'security.tls.version.max',
  95. 'security.tls.version.min',
  96. 'security.xpconnect.plugin.unrestricted',
  97. 'signon.autofillForms',
  98. 'signon.formlessCapture.enabled',
  99. 'webchannel.allowObject.urlWhitelist',
  100. /* known culprits */
  101. 'dom.workers.enabled',
  102. 'network.cookie.cookieBehavior',
  103. 'privacy.firstparty.isolate',
  104. 'privacy.resistFingerprinting',
  105. 'last.one.without.comma'
  106. ]
  107. if("undefined" === typeof(Services)) {
  108. alert("about:config needs to be the active tab!");
  109. return;
  110. }
  111. let aBACKUP = [];
  112. let dummy = 0;
  113. for (let i = 0, len = ops.length; i < len; i++) {
  114. if (Services.prefs.prefHasUserValue(ops[i])) {
  115. dummy = Services.prefs.getPrefType(ops[i]);
  116. switch (dummy) {
  117. case 32: // string (see https://dxr.mozilla.org/mozilla-central/source/modules/libpref/nsIPrefBranch.idl#31)
  118. dummy = Services.prefs.getCharPref(ops[i]);
  119. aBACKUP.push({'name':ops[i],'value': dummy,'type':32});
  120. break;
  121. case 64: // int
  122. dummy = Services.prefs.getIntPref(ops[i]);
  123. aBACKUP.push({'name':ops[i],'value': dummy,'type':64});
  124. break;
  125. case 128: // boolean
  126. dummy = Services.prefs.getBoolPref(ops[i]);
  127. aBACKUP.push({'name':ops[i],'value': dummy,'type':128});
  128. break;
  129. default:
  130. console.log("error detecting pref-type for '"+ops[i]+"' !");
  131. }
  132. }
  133. }
  134. // console.log(aBACKUP.length, "user-set prefs from our list detected and value stored.");
  135. myreset(aBACKUP); // resetting all detected prefs
  136. let myArr = aBACKUP
  137. focus();
  138. if (confirm("all detected prefs reset.\n\n!! KEEP THIS PROMPT OPEN AND TEST THE SITE IN ANOTHER TAB !!\n\nIF the problem still exists, this script can't help you - click cancel to re-apply your values and exit.\n\nClick OK if your problem is fixed.")) {
  139. reapply(aBACKUP);
  140. myreset(myArr.slice(0, parseInt(myArr.length/2)));
  141. while (myArr.length >= 2) {
  142. alert("NOW TEST AGAIN !");
  143. if (confirm("if the problem still exists click OK, otherwise click cancel.")) {
  144. myArr = myArr.slice(parseInt(myArr.length/2));
  145. } else {
  146. myArr = myArr.slice(0, parseInt(myArr.length/2));
  147. }
  148. reapply(aBACKUP);
  149. myreset(myArr.slice(0, parseInt(myArr.length/2))); // reset half of the remaining prefs
  150. }
  151. }
  152. reapply(aBACKUP); // re-apply all values
  153. let output = "";
  154. for (let i = 0, len = myArr.length; i < len; i++) {
  155. output = output + myArr[i].name + "\n";
  156. }
  157. alert("narrowed it down to:\n\n"+output);
  158. myreset(myArr); // reset the culprit
  159. })();