Bug 1314568 - Silence warning from nsEffectiveTLDService::GetBaseDomain(). r=mystor
authorJork K <jorgk@jorgk.com>
Wed, 02 Nov 2016 08:24:00 +0100
changeset 320778 b5156607f03166a035374dcd2306d98855af4191
parent 320777 8a072e37f540af376598ef27ef4a3dc81e093f44
child 320779 2cae9cfcf54dbe7ac217bf7cb03568b92ac17ea2
push id83449
push usercbook@mozilla.com
push dateThu, 03 Nov 2016 07:56:46 +0000
treeherdermozilla-inbound@dc36f70ecd19 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmystor
bugs1314568
milestone52.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 1314568 - Silence warning from nsEffectiveTLDService::GetBaseDomain(). r=mystor
dom/base/DocGroup.cpp
--- a/dom/base/DocGroup.cpp
+++ b/dom/base/DocGroup.cpp
@@ -11,17 +11,19 @@ namespace mozilla {
 namespace dom {
 
 /* static */ void
 DocGroup::GetKey(nsIPrincipal* aPrincipal, nsACString& aKey)
 {
   aKey.Truncate();
   nsCOMPtr<nsIURI> uri;
   nsresult rv = aPrincipal->GetURI(getter_AddRefs(uri));
-  if (NS_SUCCEEDED(rv)) {
+  // GetBaseDomain works fine if |uri| is null, but it outputs a warning
+  // which ends up cluttering the logs.
+  if (NS_SUCCEEDED(rv) && uri) {
     nsCOMPtr<nsIEffectiveTLDService> tldService =
       do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID);
     if (tldService) {
       rv = tldService->GetBaseDomain(uri, 0, aKey);
       if (NS_FAILED(rv)) {
         aKey.Truncate();
       }
     }