Closed Bug 791084 Opened 13 years ago Closed 13 years ago

Device Storage - Separate out different permissions based on storage type

Categories

(Core :: DOM: Device Interfaces, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
firefox18 --- fixed

People

(Reporter: dougt, Assigned: dougt)

Details

Attachments

(1 file)

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
Attached 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: 13 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 → ---
Status: REOPENED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: