Device Storage - Separate out different permissions based on storage type

RESOLVED FIXED

Status

()

defect
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: dougt, Assigned: dougt)

Tracking

unspecified
Points:
---

Firefox Tracking Flags

(firefox18 fixed)

Details

Attachments

(1 attachment)

Separate out different permissions for different storage types.  For example, if an application wants to access pictures, it should be able to just request pictures and not see videos.

I am planning to make the permissions look like:

device-storage:pictures
device-storage:music
device-storage:videos
Assignee: nobody → doug.turner
Posted patch patch v.1Splinter Review
Attachment #661108 - Flags: review?(bent.mozilla)
I also issued a pull request to fix up gaia.
Comment on attachment 661108 [details] [diff] [review]
patch v.1

Review of attachment 661108 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/devicestorage/nsDeviceStorage.cpp
@@ +173,5 @@
> +      !aType.EqualsLiteral(DEVICESTORAGE_MUSIC)) {
> +    // unknown type
> +    return NS_ERROR_FAILURE;
> +  }
> +  

Nit: trailing whitespace

@@ +175,5 @@
> +    return NS_ERROR_FAILURE;
> +  }
> +  
> +  aPermissionResult.AssignLiteral("device-storage:");
> +  aPermissionResult.Append(NS_ConvertUTF16toUTF8(aType));

You could use NS_LossyConvertUTF16toASCII here since you know it's actually ASCII.

@@ +975,5 @@
>  
>  NS_IMETHODIMP
>  nsDOMDeviceStorageCursor::GetType(nsACString & aType)
>  {
> +  DeviceStorageTypeChecker* typeChecker = DeviceStorageTypeChecker::CreateOrGet();

No need for an instance here if the method is static. In the other 3 places too.

::: dom/devicestorage/nsDeviceStorage.h
@@ +54,5 @@
>  
>    bool Check(const nsAString& aType, nsIDOMBlob* aBlob);
>    bool Check(const nsAString& aType, nsIFile* aFile);
>  
> +  nsresult GetPermissionForType(const nsAString& aType, nsACString& aPermissionResult);

This can be static
Attachment #661108 - Flags: review?(bent.mozilla) → review+
fixed up.  I left the Convert function as the string can come from content.

https://hg.mozilla.org/mozilla-central/rev/e5af3d785252
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Push backed out for introducing new M2 orange in test_diskSpace.html & backout of the cset that landed it having conflicts. 

Also, please do not push to mozilla-central unless you are going to watch/star your push (sheriffs are going to be getting more strict about tree rule violations; ie backout).

https://hg.mozilla.org/mozilla-central/rev/5faccd0b7618
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
https://hg.mozilla.org/mozilla-central/rev/5dd0d8da452e
Status: REOPENED → RESOLVED
Closed: 7 years ago7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.