зеркало из https://github.com/mozilla/gecko-dev.git
Bug 722868 - Part 5: Use the channel's private browsing flag to determine how to handle the temporary file in nsExternalAppHandler::OpenWithApplication; r=bzbarsky
This commit is contained in:
Родитель
2d1d49791d
Коммит
bbda19a62f
|
@ -108,6 +108,7 @@
|
|||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "ExternalHelperAppChild.h"
|
||||
#include "nsILoadContext.h"
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
#include "AndroidBridge.h"
|
||||
|
@ -2192,9 +2193,21 @@ nsresult nsExternalAppHandler::OpenWithApplication()
|
|||
false);
|
||||
#endif
|
||||
|
||||
// See whether the channel has been opened in private browsing mode
|
||||
bool inPrivateBrowsing = false;
|
||||
NS_ASSERTION(mRequest, "This should never be called with a null request");
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(mRequest);
|
||||
if (channel) {
|
||||
nsCOMPtr<nsILoadContext> ctx;
|
||||
NS_QueryNotificationCallbacks(channel, ctx);
|
||||
if (ctx) {
|
||||
inPrivateBrowsing = ctx->UsePrivateBrowsing();
|
||||
}
|
||||
}
|
||||
|
||||
// make the tmp file readonly so users won't edit it and lose the changes
|
||||
// only if we're going to delete the file
|
||||
if (deleteTempFileOnExit || mExtProtSvc->InPrivateBrowsing())
|
||||
if (deleteTempFileOnExit || inPrivateBrowsing)
|
||||
mFinalFileDestination->SetPermissions(0400);
|
||||
|
||||
rv = mMimeInfo->LaunchWithFile(mFinalFileDestination);
|
||||
|
@ -2211,7 +2224,7 @@ nsresult nsExternalAppHandler::OpenWithApplication()
|
|||
else if (deleteTempFileOnExit) {
|
||||
mExtProtSvc->DeleteTemporaryFileOnExit(mFinalFileDestination);
|
||||
}
|
||||
else if (mExtProtSvc->InPrivateBrowsing()) {
|
||||
else if (inPrivateBrowsing) {
|
||||
mExtProtSvc->DeleteTemporaryPrivateFileWhenPossible(mFinalFileDestination);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,12 +111,6 @@ public:
|
|||
virtual NS_HIDDEN_(nsresult) OSProtocolHandlerExists(const char *aScheme,
|
||||
bool *aExists) = 0;
|
||||
|
||||
/**
|
||||
* Simple accessor to let nsExternalAppHandler know if we are currently
|
||||
* inside the private browsing mode.
|
||||
*/
|
||||
bool InPrivateBrowsing() const { return mInPrivateBrowsing; }
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Searches the "extra" array of MIMEInfo objects for an object
|
||||
|
|
Загрузка…
Ссылка в новой задаче