Bug 1370087 - GenerateOriginKey cannot assert the existence of nsIPrincipal. r=smaug, a=ritu
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 12 Jun 2017 12:26:08 +0200
changeset 413936 72a0956cd5c116eeaa30a859792f8212c6fa5c75
parent 413935 ddde9a8077529ebeacc1f3abb0f8bc6096b05b3e
child 413937 4281d28ef7acd790d969e02f8215f1cba67ff0df
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, ritu
bugs1370087
milestone55.0
Bug 1370087 - GenerateOriginKey cannot assert the existence of nsIPrincipal. r=smaug, a=ritu
dom/storage/StorageUtils.cpp
--- a/dom/storage/StorageUtils.cpp
+++ b/dom/storage/StorageUtils.cpp
@@ -9,17 +9,19 @@
 namespace mozilla {
 namespace dom {
 namespace StorageUtils {
 
 nsresult
 GenerateOriginKey(nsIPrincipal* aPrincipal, nsACString& aOriginAttrSuffix,
                   nsACString& aOriginKey)
 {
-  MOZ_ASSERT(aPrincipal);
+  if (NS_WARN_IF(!aPrincipal)) {
+    return NS_ERROR_UNEXPECTED;
+  }
 
   aPrincipal->OriginAttributesRef().CreateSuffix(aOriginAttrSuffix);
 
   nsCOMPtr<nsIURI> uri;
   nsresult rv = aPrincipal->GetURI(getter_AddRefs(uri));
   NS_ENSURE_SUCCESS(rv, rv);
   if (!uri) {
     return NS_ERROR_UNEXPECTED;