Bug 1279186 - Blob URLs in multi-e10s - part 2 - Contentparent unregistes BlobURLs if the child crashes, r=gabor

This commit is contained in:
Andrea Marchesini 2016-07-18 11:12:18 +02:00
parent 0c1a08fce6
commit e2f70c803b
2 changed files with 20 additions and 1 deletions

View File

@ -2060,6 +2060,13 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
if (mDriverCrashGuard) {
mDriverCrashGuard->NotifyCrashed();
}
// Unregister all the BlobURLs registered by the ContentChild.
for (uint32_t i = 0; i < mBlobURLs.Length(); ++i) {
nsHostObjectProtocolHandler::RemoveDataEntry(mBlobURLs[i]);
}
mBlobURLs.Clear();
}
void
@ -5746,7 +5753,15 @@ ContentParent::RecvStoreAndBroadcastBlobURLRegistration(const nsCString& aURI,
return false;
}
nsHostObjectProtocolHandler::AddDataEntry(aURI, blobImpl, aPrincipal);
if (NS_SUCCEEDED(nsHostObjectProtocolHandler::AddDataEntry(aURI, blobImpl,
aPrincipal))) {
BroadcastBlobURLRegistration(aURI, blobImpl, aPrincipal, this);
// We want to store this blobURL, so we can unregister it if the child
// crashes.
mBlobURLs.AppendElement(aURI);
}
BroadcastBlobURLRegistration(aURI, blobImpl, aPrincipal, this);
return true;
}
@ -5757,6 +5772,8 @@ ContentParent::RecvUnstoreAndBroadcastBlobURLUnregistration(const nsCString& aUR
nsHostObjectProtocolHandler::RemoveDataEntry(aURI,
false /* Don't broadcast */);
BroadcastBlobURLUnregistration(aURI, this);
mBlobURLs.RemoveElement(aURI);
return true;
}

View File

@ -1294,6 +1294,8 @@ private:
// This hashtable is used to run GetFilesHelper objects in the parent process.
// GetFilesHelper can be aborted by receiving RecvDeleteGetFilesRequest.
nsRefPtrHashtable<nsIDHashKey, GetFilesHelper> mGetFilesPendingRequests;
nsTArray<nsCString> mBlobURLs;
};
} // namespace dom