Bug 1585297- Use Principal->SchemeIs in nsGeolocation.cpp r=ckerschb
authorSebastian Streich <sstreich@mozilla.com>
Tue, 01 Oct 2019 12:54:56 +0000
changeset 495998 76668583a71f94ebe8ce3b86d71b6edd76ffdc2c
parent 495997 8e8087547a22f8a3daf9f2d6f5fb7f3a9300cfd8
child 495999 7bede01766e0fdd0520a2c318b6859a2aae3145f
push id114140
push userdvarga@mozilla.com
push dateWed, 02 Oct 2019 18:04:51 +0000
treeherdermozilla-inbound@32eb0ea893f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckerschb
bugs1585297
milestone71.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 1585297- Use Principal->SchemeIs in nsGeolocation.cpp r=ckerschb Differential Revision: https://phabricator.services.mozilla.com/D47750
dom/geolocation/nsGeolocation.cpp
--- a/dom/geolocation/nsGeolocation.cpp
+++ b/dom/geolocation/nsGeolocation.cpp
@@ -821,28 +821,21 @@ nsresult Geolocation::Init(nsPIDOMWindow
 
     // Grab the principal of the document
     nsCOMPtr<Document> doc = aContentDom->GetDoc();
     if (!doc) {
       return NS_ERROR_FAILURE;
     }
 
     mPrincipal = doc->NodePrincipal();
-
-    nsCOMPtr<nsIURI> uri;
-    nsresult rv = mPrincipal->GetURI(getter_AddRefs(uri));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    if (uri) {
-      // Store the protocol to send via telemetry later.
-      if (uri->SchemeIs("http")) {
-        mProtocolType = ProtocolType::HTTP;
-      } else if (uri->SchemeIs("https")) {
-        mProtocolType = ProtocolType::HTTPS;
-      }
+    // Store the protocol to send via telemetry later.
+    if (mPrincipal->SchemeIs("http")) {
+      mProtocolType = ProtocolType::HTTP;
+    } else if (mPrincipal->SchemeIs("https")) {
+      mProtocolType = ProtocolType::HTTPS;
     }
   }
 
   // If no aContentDom was passed into us, we are being used
   // by chrome/c++ and have no mOwner, no mPrincipal, and no need
   // to prompt.
   mService = nsGeolocationService::GetGeolocationService();
   if (mService) {