troubleshooter.js 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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. 'beacon.enabled',
  27. 'browser.cache.disk.capacity',
  28. 'browser.cache.disk.enable',
  29. 'browser.cache.disk.smart_size.enabled',
  30. 'browser.cache.disk.smart_size.first_run',
  31. 'browser.cache.disk_cache_ssl',
  32. 'browser.cache.offline.enable',
  33. 'browser.display.use_document_fonts',
  34. 'browser.download.hide_plugins_without_extensions',
  35. 'browser.download.manager.addToRecentDocs',
  36. 'browser.download.useDownloadDir',
  37. 'browser.fixup.alternate.enabled',
  38. 'browser.formfill.enable',
  39. 'browser.link.open_newwindow.restriction',
  40. 'browser.search.geoip.url',
  41. 'browser.search.geoSpecificDefaults',
  42. 'browser.search.geoSpecificDefaults.url',
  43. 'browser.search.suggest.enabled',
  44. 'browser.send_pings.require_same_host',
  45. 'browser.sessionhistory.max_entries',
  46. 'browser.sessionstore.interval',
  47. 'browser.sessionstore.max_tabs_undo',
  48. 'browser.sessionstore.max_windows_undo',
  49. 'browser.sessionstore.privacy_level',
  50. 'browser.sessionstore.resume_from_crash',
  51. 'browser.shell.shortcutFavicons',
  52. 'browser.storageManager.enabled',
  53. 'browser.tabs.remote.allowLinkedWebInFileUriProcess',
  54. 'browser.taskbar.lists.enabled',
  55. 'browser.taskbar.lists.frequent.enabled',
  56. 'browser.taskbar.lists.tasks.enabled',
  57. 'browser.urlbar.autocomplete.enabled',
  58. 'browser.urlbar.autoFill',
  59. 'browser.urlbar.autoFill.typed',
  60. 'browser.urlbar.decodeURLsOnCopy',
  61. 'browser.urlbar.oneOffSearches',
  62. 'browser.urlbar.speculativeConnect.enabled',
  63. 'browser.urlbar.suggest.searches',
  64. 'browser.urlbar.trimURLs',
  65. 'camera.control.face_detection.enabled',
  66. 'canvas.capturestream.enabled',
  67. 'captivedetect.canonicalURL',
  68. 'dom.caches.enabled',
  69. 'dom.disable_beforeunload',
  70. 'dom.disable_window_move_resize',
  71. 'dom.disable_window_open_feature.close',
  72. 'dom.disable_window_open_feature.menubar',
  73. 'dom.disable_window_open_feature.minimizable',
  74. 'dom.disable_window_open_feature.personalbar',
  75. 'dom.disable_window_open_feature.titlebar',
  76. 'dom.disable_window_open_feature.toolbar',
  77. 'dom.event.clipboardevents.enabled',
  78. 'dom.idle-observers-api.enabled',
  79. 'dom.IntersectionObserver.enabled',
  80. 'dom.popup_allowed_events',
  81. 'dom.popup_maximum',
  82. 'dom.push.connection.enabled',
  83. 'dom.push.enabled',
  84. 'dom.push.serverURL',
  85. 'dom.serviceWorkers.enabled',
  86. 'dom.storageManager.enabled',
  87. 'dom.vibrator.enabled',
  88. 'dom.webaudio.enabled',
  89. 'dom.webnotifications.enabled',
  90. 'dom.webnotifications.serviceworker.enabled',
  91. 'font.blacklist.underline_offset',
  92. 'full-screen-api.enabled',
  93. 'geo.wifi.uri',
  94. 'gfx.downloadable_fonts.woff2.enabled',
  95. 'gfx.font_rendering.graphite.enabled',
  96. 'gfx.font_rendering.opentype_svg.enabled',
  97. 'intl.accept_languages',
  98. 'javascript.options.asmjs',
  99. 'javascript.options.wasm',
  100. 'keyword.enabled',
  101. 'layout.css.font-loading-api.enabled',
  102. 'layout.css.visited_links_enabled',
  103. 'mathml.disabled',
  104. 'media.autoplay.enabled',
  105. 'media.eme.enabled',
  106. 'media.getusermedia.screensharing.allowed_domains',
  107. 'media.getusermedia.screensharing.enabled',
  108. 'media.gmp.trial-create.enabled',
  109. 'media.gmp-manager.url',
  110. 'media.gmp-provider.enabled',
  111. 'media.gmp-widevinecdm.enabled',
  112. 'media.gmp-widevinecdm.visible',
  113. 'media.navigator.enabled',
  114. 'media.navigator.video.enabled',
  115. 'media.ondevicechange.enabled',
  116. 'media.peerconnection.enabled',
  117. 'media.peerconnection.ice.default_address_only',
  118. 'media.peerconnection.ice.no_host',
  119. 'media.peerconnection.ice.tcp',
  120. 'media.peerconnection.identity.enabled',
  121. 'media.peerconnection.identity.timeout',
  122. 'media.peerconnection.turn.disable',
  123. 'media.peerconnection.use_document_iceservers',
  124. 'media.peerconnection.video.enabled',
  125. 'network.auth.subresource-img-cross-origin-http-auth-allow',
  126. 'network.captive-portal-service.enabled',
  127. 'network.cookie.thirdparty.sessionOnly',
  128. 'network.dns.disablePrefetch',
  129. 'network.http.altsvc.enabled',
  130. 'network.http.altsvc.oe',
  131. 'network.http.redirection-limit',
  132. 'network.http.referer.hideOnionSource',
  133. 'network.http.referer.XOriginPolicy',
  134. 'network.http.spdy.enabled',
  135. 'network.http.spdy.enabled.deps',
  136. 'network.http.spdy.enabled.http2',
  137. 'network.http.speculative-parallel-limit',
  138. 'network.IDN_show_punycode',
  139. 'network.predictor.enabled',
  140. 'network.prefetch-next',
  141. 'network.protocol-handler.external.ms-windows-store',
  142. 'network.proxy.socks_remote_dns',
  143. 'offline-apps.allow_by_default',
  144. 'permissions.manager.defaultsUrl',
  145. 'plugin.default.state',
  146. 'plugin.defaultXpi.state',
  147. 'plugin.scan.plid.all',
  148. 'plugin.sessionPermissionNow.intervalInMinutes',
  149. 'security.ask_for_password',
  150. 'security.cert_pinning.enforcement_level',
  151. 'security.csp.experimentalEnabled',
  152. 'security.data_uri.block_toplevel_data_uri_navigations',
  153. 'security.dialog_enable_delay',
  154. 'security.family_safety.mode',
  155. 'security.mixed_content.block_display_content',
  156. 'security.mixed_content.use_hsts',
  157. 'security.OCSP.require',
  158. 'security.pki.sha1_enforcement_level',
  159. 'security.ssl.treat_unsafe_negotiation_as_broken',
  160. 'security.tls.enable_0rtt_data',
  161. 'security.tls.version.max',
  162. 'security.tls.version.min',
  163. 'security.xpconnect.plugin.unrestricted',
  164. 'signon.autofillForms',
  165. 'signon.formlessCapture.enabled',
  166. 'webchannel.allowObject.urlWhitelist',
  167. /* known culprits */
  168. 'dom.workers.enabled',
  169. 'network.cookie.cookieBehavior',
  170. 'privacy.firstparty.isolate',
  171. 'privacy.resistFingerprinting',
  172. 'last.one.without.comma'
  173. ]
  174. if("undefined" === typeof(Services)) {
  175. alert("about:config needs to be the active tab!");
  176. return;
  177. }
  178. let aBACKUP = [];
  179. let dummy = 0;
  180. for (let i = 0, len = ops.length; i < len; i++) {
  181. if (Services.prefs.prefHasUserValue(ops[i])) {
  182. dummy = Services.prefs.getPrefType(ops[i]);
  183. switch (dummy) {
  184. case 32: // string (see https://dxr.mozilla.org/mozilla-central/source/modules/libpref/nsIPrefBranch.idl#31)
  185. dummy = Services.prefs.getCharPref(ops[i]);
  186. aBACKUP.push({'name':ops[i],'value': dummy,'type':32});
  187. break;
  188. case 64: // int
  189. dummy = Services.prefs.getIntPref(ops[i]);
  190. aBACKUP.push({'name':ops[i],'value': dummy,'type':64});
  191. break;
  192. case 128: // boolean
  193. dummy = Services.prefs.getBoolPref(ops[i]);
  194. aBACKUP.push({'name':ops[i],'value': dummy,'type':128});
  195. break;
  196. default:
  197. console.log("error detecting pref-type for '"+ops[i]+"' !");
  198. }
  199. }
  200. }
  201. // console.log(aBACKUP.length, "user-set prefs from our list detected and value stored.");
  202. myreset(aBACKUP); // resetting all detected prefs
  203. let myArr = aBACKUP
  204. focus();
  205. 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.")) {
  206. reapply(aBACKUP);
  207. myreset(myArr.slice(0, parseInt(myArr.length/2)));
  208. while (myArr.length >= 2) {
  209. alert("NOW TEST AGAIN !");
  210. if (confirm("if the problem still exists click OK, otherwise click cancel.")) {
  211. myArr = myArr.slice(parseInt(myArr.length/2));
  212. } else {
  213. myArr = myArr.slice(0, parseInt(myArr.length/2));
  214. }
  215. reapply(aBACKUP);
  216. myreset(myArr.slice(0, parseInt(myArr.length/2))); // reset half of the remaining prefs
  217. }
  218. }
  219. reapply(aBACKUP); // re-apply all values
  220. let output = "";
  221. for (let i = 0, len = myArr.length; i < len; i++) {
  222. output = output + myArr[i].name + "\n";
  223. }
  224. alert("narrowed it down to:\n\n"+output);
  225. myreset(myArr); // reset the culprit
  226. })();