Bug 1164310, part 1 - Make the code for bypassing mobile security checks more general so that it can be used on non-mobile. r=baku

This commit is contained in:
Jonathan Watt 2015-07-10 18:54:26 +01:00
parent 12621f5d41
commit 8e3f9b97ee
5 changed files with 8 additions and 8 deletions

View File

@ -36,8 +36,8 @@ DeviceStorageFileSystem::DeviceStorageFileSystem(
mString.Append('-');
mString.Append(mStorageName);
mIsTesting =
mozilla::Preferences::GetBool("device.storage.prompt.testing", false);
mRequiresPermissionChecks =
!mozilla::Preferences::GetBool("device.storage.prompt.testing", false);
// Get the permission name required to access the file system.
nsresult rv =

View File

@ -42,7 +42,7 @@ FileSystemBase::FromString(const nsAString& aString)
FileSystemBase::FileSystemBase()
: mShutdown(false)
, mIsTesting(false)
, mRequiresPermissionChecks(true)
{
}

View File

@ -85,9 +85,9 @@ public:
}
bool
IsTesting() const
RequiresPermissionChecks() const
{
return mIsTesting;
return mRequiresPermissionChecks;
}
protected:
virtual ~FileSystemBase();
@ -100,7 +100,7 @@ protected:
// The permission name required to access the file system.
nsCString mPermission;
bool mIsTesting;
bool mRequiresPermissionChecks;
};
} // namespace dom

View File

@ -122,7 +122,7 @@ FileSystemPermissionRequest::Run()
return NS_OK;
}
if (filesystem->IsTesting()) {
if (!filesystem->RequiresPermissionChecks()) {
Allow(JS::UndefinedHandleValue);
return NS_OK;
}

View File

@ -58,7 +58,7 @@ FileSystemRequestParent::Dispatch(ContentParent* aParent,
return false;
}
if (!mFileSystem->IsTesting()) {
if (mFileSystem->RequiresPermissionChecks()) {
// Check the content process permission.
nsCString access;