Bug 1175860 - Add some documentation to UploadLastDir to make its workings clearer. r=baku

This commit is contained in:
Jonathan Watt 2015-06-08 14:01:01 +01:00
Родитель 76297166d8
Коммит a62bfe14df
2 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -805,6 +805,9 @@ UploadLastDir::StoreLastUsedDirectory(nsIDocument* aDoc, nsIFile* aDir)
return NS_ERROR_OUT_OF_MEMORY;
prefValue->SetAsAString(unicodePath);
// Use the document's current load context to ensure that the content pref
// service doesn't persistently store this directory for this domain if the
// user is using private browsing:
nsCOMPtr<nsILoadContext> loadContext = aDoc->GetLoadContext();
return contentPrefService->Set(spec, CPS_PREF_NAME, prefValue, loadContext, nullptr);
}

Просмотреть файл

@ -39,8 +39,17 @@ class Date;
class File;
class FileList;
class UploadLastDir final : public nsIObserver, public nsSupportsWeakReference {
/**
* A class we use to create a singleton object that is used to keep track of
* the last directory from which the user has picked files (via
* <input type=file>) on a per-domain basis. The implementation uses
* nsIContentPrefService2/NS_CONTENT_PREF_SERVICE_CONTRACTID to store the last
* directory per-domain, and to ensure that whether the directories are
* persistently saved (saved across sessions) or not honors whether or not the
* page is being viewed in private browsing.
*/
class UploadLastDir final : public nsIObserver, public nsSupportsWeakReference
{
~UploadLastDir() {}
public: