Bug 1308160 - Correct ::deserialize for nsHostObjectURI, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 06 Oct 2016 16:36:07 +0200
changeset 316834 428876d40e6be43618726dc7bd8b903584238b04
parent 316833 c6752015a180432ee6e6697557d86a6f6e419594
child 316835 9fbc16390ef792d1b4eb14a5755f21cdd42526de
push id32932
push userphilringnalda@gmail.com
push dateFri, 07 Oct 2016 03:24:25 +0000
treeherderautoland@7affb66131bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1308160
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 1308160 - Correct ::deserialize for nsHostObjectURI, r=smaug
dom/base/nsHostObjectProtocolHandler.cpp
dom/base/nsHostObjectURI.cpp
--- a/dom/base/nsHostObjectProtocolHandler.cpp
+++ b/dom/base/nsHostObjectProtocolHandler.cpp
@@ -97,16 +97,17 @@ GetDataInfo(const nsACString& aUri)
   if (pos < 0) {
     gDataTable->Get(aUri, &res);
   } else {
     gDataTable->Get(StringHead(aUri, pos), &res);
   }
 
   return res;
 }
+
 static DataInfo*
 GetDataInfoFromURI(nsIURI* aURI)
 {
   if (!aURI) {
     return nullptr;
   }
 
   nsCString spec;
--- a/dom/base/nsHostObjectURI.cpp
+++ b/dom/base/nsHostObjectURI.cpp
@@ -133,25 +133,30 @@ nsHostObjectURI::Deserialize(const mozil
   }
 
   const HostObjectURIParams& hostParams = aParams.get_HostObjectURIParams();
 
   if (!mozilla::net::nsSimpleURI::Deserialize(hostParams.simpleParams())) {
     return false;
   }
 
-  // XXXbaku: when we will have shared blobURL maps, we can populate mBlobImpl
-  // here asll well.
-
   if (hostParams.principal().type() == OptionalPrincipalInfo::Tvoid_t) {
     return true;
   }
 
   mPrincipal = PrincipalInfoToPrincipal(hostParams.principal().get_PrincipalInfo());
-  return mPrincipal != nullptr;
+  if (!mPrincipal) {
+    return false;
+  }
+
+  // If this fails, we still want to complete the operation. Probably this
+  // blobURL has been revoked in the meantime.
+  NS_GetBlobForBlobURI(this, getter_AddRefs(mBlobImpl));
+
+  return true;
 }
 
 NS_IMETHODIMP
 nsHostObjectURI::SetScheme(const nsACString& aScheme)
 {
   // Disallow setting the scheme, since that could cause us to be associated
   // with a different protocol handler that doesn't expect us to be carrying
   // around a principal with nsIURIWithPrincipal.