Bug 1307467 - Remove code that preopens and sends application.zip fd (bug 835698) r=bagder,baku
MozReview-Commit-ID: 5nER54Dq3eI
This commit is contained in:
@@ -17,10 +17,7 @@
|
||||
#include "nsNetCID.h"
|
||||
#include "nsIMIMEService.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsIHashable.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
static NS_DEFINE_CID(kZipReaderCacheCID, NS_ZIPREADERCACHE_CID);
|
||||
|
||||
@@ -31,7 +28,6 @@ static NS_DEFINE_CID(kZipReaderCacheCID, NS_ZIPREADERCACHE_CID);
|
||||
nsJARProtocolHandler *gJarHandler = nullptr;
|
||||
|
||||
nsJARProtocolHandler::nsJARProtocolHandler()
|
||||
: mIsMainProcess(XRE_IsParentProcess())
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
}
|
||||
@@ -63,65 +59,6 @@ nsJARProtocolHandler::MimeService()
|
||||
return mMimeService.get();
|
||||
}
|
||||
|
||||
bool
|
||||
nsJARProtocolHandler::RemoteOpenFileInProgress(
|
||||
nsIHashable *aRemoteFile,
|
||||
nsIRemoteOpenFileListener *aListener)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aRemoteFile);
|
||||
MOZ_ASSERT(aListener);
|
||||
|
||||
if (IsMainProcess()) {
|
||||
MOZ_CRASH("Shouldn't be called in the main process!");
|
||||
}
|
||||
|
||||
RemoteFileListenerArray *listeners;
|
||||
if (mRemoteFileListeners.Get(aRemoteFile, &listeners)) {
|
||||
listeners->AppendElement(aListener);
|
||||
return true;
|
||||
}
|
||||
|
||||
// We deliberately don't put the listener in the new array since the first
|
||||
// load is handled differently.
|
||||
mRemoteFileListeners.Put(aRemoteFile, new RemoteFileListenerArray());
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
nsJARProtocolHandler::RemoteOpenFileComplete(nsIHashable *aRemoteFile,
|
||||
nsresult aStatus)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aRemoteFile);
|
||||
|
||||
if (IsMainProcess()) {
|
||||
MOZ_CRASH("Shouldn't be called in the main process!");
|
||||
}
|
||||
|
||||
RemoteFileListenerArray *tempListeners;
|
||||
if (!mRemoteFileListeners.Get(aRemoteFile, &tempListeners)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Save the listeners in a stack array. The call to Remove() below will
|
||||
// delete the tempListeners array.
|
||||
RemoteFileListenerArray listeners;
|
||||
tempListeners->SwapElements(listeners);
|
||||
|
||||
mRemoteFileListeners.Remove(aRemoteFile);
|
||||
|
||||
// Technically we must fail OnRemoteFileComplete() since OpenNSPRFileDesc()
|
||||
// won't succeed here. We've trained nsJARChannel to recognize
|
||||
// NS_ERROR_ALREADY_OPENED in this case as "proceed to JAR cache hit."
|
||||
nsresult status = NS_SUCCEEDED(aStatus) ? NS_ERROR_ALREADY_OPENED : aStatus;
|
||||
|
||||
uint32_t count = listeners.Length();
|
||||
for (uint32_t index = 0; index < count; index++) {
|
||||
listeners[index]->OnRemoteFileOpenComplete(status);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsJARProtocolHandler,
|
||||
nsIJARProtocolHandler,
|
||||
nsIProtocolHandler,
|
||||
|
||||
Reference in New Issue
Block a user