Bug 1483342 - [2.1] Initialize SafeBrowsing module by default to enable safe browsing. r=jchen
authorEugen Sawin <esawin@mozilla.com>
Tue, 14 Aug 2018 21:42:35 +0200
changeset 431971 fb971f169811504aaa15352ea46f0a2ba7bcc2a0
parent 431970 47e290808d8e401d70ef5fc4a8f523388de6dd96
child 431972 3594f4889a4316af5e979631a65d9c7a9bac00d6
push id34456
push usertoros@mozilla.com
push dateThu, 16 Aug 2018 21:33:21 +0000
treeherdermozilla-central@72442cf86f54 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen
bugs1483342
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1483342 - [2.1] Initialize SafeBrowsing module by default to enable safe browsing. r=jchen
mobile/android/modules/geckoview/GeckoViewSettings.jsm
--- a/mobile/android/modules/geckoview/GeckoViewSettings.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewSettings.jsm
@@ -2,29 +2,23 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var EXPORTED_SYMBOLS = ["GeckoViewSettings"];
 
 ChromeUtils.import("resource://gre/modules/GeckoViewModule.jsm");
-ChromeUtils.import("resource://gre/modules/GeckoViewUtils.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetters(this, {
+  SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
   Services: "resource://gre/modules/Services.jsm",
 });
 
-/* global SafeBrowsing:false */
-GeckoViewUtils.addLazyGetter(this, "SafeBrowsing", {
-  module: "resource://gre/modules/SafeBrowsing.jsm",
-  init: sb => sb.init(),
-});
-
 XPCOMUtils.defineLazyGetter(
   this, "DESKTOP_USER_AGENT",
   function() {
     return Cc["@mozilla.org/network/protocol;1?name=http"]
            .getService(Ci.nsIHttpProtocolHandler).userAgent
            .replace(/Android \d.+?; [a-zA-Z]+/, "X11; Linux x86_64")
            .replace(/Gecko\/[0-9\.]+/, "Gecko/20100101");
   });
@@ -37,40 +31,32 @@ class GeckoViewSettings extends GeckoVie
     if (this.settings.useMultiprocess) {
       this.browser.setAttribute("remote", "true");
     }
   }
 
   onInit() {
     this._useTrackingProtection = false;
     this._useDesktopMode = false;
+    // Required for safe browsing and tracking protection.
+    SafeBrowsing.init();
   }
 
   onSettingsUpdate() {
     const settings = this.settings;
     debug `onSettingsUpdate: ${settings}`;
 
     this.displayMode = settings.displayMode;
-    this.useTrackingProtection = !!settings.useTrackingProtection;
     this.useDesktopMode = !!settings.useDesktopMode;
   }
 
   get useMultiprocess() {
     return this.browser.isRemoteBrowser;
   }
 
-  get useTrackingProtection() {
-    return this._useTrackingProtection;
-  }
-
-  set useTrackingProtection(aUse) {
-    aUse && SafeBrowsing;
-    this._useTrackingProtection = aUse;
-  }
-
   onUserAgentRequest(aSubject, aTopic, aData) {
     debug `onUserAgentRequest`;
 
     let channel = aSubject.QueryInterface(Ci.nsIHttpChannel);
 
     if (this.browser.outerWindowID !== channel.topLevelOuterContentWindowId) {
       return;
     }