Closed Bug 1046258 Opened 10 years ago Closed 9 years ago

enable device storage API on desktop

Categories

(Firefox Graveyard :: Webapp Runtime, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: myk, Unassigned)

References

Details

(Whiteboard: dependency:platform)

Attachments

(1 file)

We should enable the device storage API <https://wiki.mozilla.org/WebAPI/DeviceStorageAPI> on desktop.

(See bug 886627 for the Android equivalent.)
Attached patch PatchSplinter Review
I remember I wanted to do it last year, but IIRC there were some concerns about the API being temporary.
I think it's still worth to do it and disable it when b2g also does.

The attached test only tests if the API is enabled in the webapp runtime. I think it isn't needed to actually test the device storage functions because they're already tested in a cross-platform way in dom/.
Attachment #8465990 - Flags: review?(myk)
But does this really make the device storage work? At the moment, when enabling the "device.storage.enabled" option manually on desktop, getDeviceStorage only gives a "pending" state that never finishes.

By the way, what is getDeviceStorage("sdcard") supposed to point to on desktop?
Comment on attachment 8465990 [details] [diff] [review]
Patch

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

(In reply to Marco Castelluccio [:marco] from comment #1)
> The attached test only tests if the API is enabled in the webapp runtime. I
> think it isn't needed to actually test the device storage functions because
> they're already tested in a cross-platform way in dom/.

Yes, and we should get those tests in the runtime too once we start running content tests there (although there's no ETA on that, and it may take a lot of work).

I would also test that the API works with the appropriate permissions set in the webapp manifest (and doesn't work if they aren't), since presumably the dom/ tests don't do that.
Attachment #8465990 - Flags: review?(myk) → feedback+
(In reply to tuxor from comment #2)
> But does this really make the device storage work? At the moment, when
> enabling the "device.storage.enabled" option manually on desktop,
> getDeviceStorage only gives a "pending" state that never finishes.

If you're testing in a browser tab, then presumably it doesn't work because your content also needs permission to use the API, which is granted to privileged apps on installation if they've requested it in their manifest and are signed by a trusted authority.  I'm not sure how to test this API on desktop manually.


> By the way, what is getDeviceStorage("sdcard") supposed to point to on
> desktop?

According to this code, it points to a fake-sdcard subdirectory of the profile directory:

http://mxr.mozilla.org/mozilla-central/source/dom/devicestorage/nsDeviceStorage.cpp?rev=9bf776569074#803
cc:ing a couple folks so they're aware of this work.

Andrew: let me know if others should be made aware.  And note the Android equivalent over in bug 886627.
Thanks, I CC'd some others who are probably interested in this.
(In reply to Myk Melez [:myk] [@mykmelez] from comment #4)
> If you're testing in a browser tab, then presumably it doesn't work because
> your content also needs permission to use the API, which is granted to
> privileged apps on installation if they've requested it in their manifest
> and are signed by a trusted authority.  I'm not sure how to test this API on
> desktop manually.

I have a privileged app for Firefox OS on the marketplace that has the permission "device-storage:sdcard" (and it's working fine on Firefox OS). When installing this app from the marketplace on Firefox for desktop, setting device-storage-enabled in about:config has the same effect as reported above: The request never leaves the "pending" state.
Hm, what I wrote in my last comment is actually based on tests I did a week ago. I'm sure about the fact that navigator.getDeviceStorage didn't work, even with device.storage.enabled set to "true". But now as I'm thinking about it again, I'm not sure, whether navigator.getDeviceStorage was at all defined inside the runtime. I'm going to repeat the tests tomorrow and report back after that.

By the way: Is this bug supposed to affect the WebRT at all or does it refer exclusively to native Firefox for desktop? If the latter, what's the point of the device storage api on firefox for desktop if it will work with privileged apps only anyway?
tuxor, this bug will only affect the Webapp Runtime and not Firefox. Have you changed the pref in your Firefox profile or in the profile of your app?
Okay, this is what I do:

1. Install a privileged app with device-storage permissions from the marketplace on Firefox for desktop (version 31.0).
2. Start app with "$HOME/.appname-someweirdhash/webrt-stub -debug" and connect with Firefox. Note that "navigator" does not have the property "getDeviceStorage". Close the app.
2. Modify file in "$HOME/.appname-someweirdhash/something.default/prefs.js" and append the line `user_pref("device.storage.enabled", true);`.
3. Start app again in debug mode. Now there is "navigator.getDeviceStorage" but the request stays "pending" forever.
(In reply to tuxor from comment #10)
> Okay, this is what I do:
> 
> 1. Install a privileged app with device-storage permissions from the
> marketplace on Firefox for desktop (version 31.0).
> 2. Start app with "$HOME/.appname-someweirdhash/webrt-stub -debug" and
> connect with Firefox. Note that "navigator" does not have the property
> "getDeviceStorage". Close the app.
> 2. Modify file in "$HOME/.appname-someweirdhash/something.default/prefs.js"
> and append the line `user_pref("device.storage.enabled", true);`.
> 3. Start app again in debug mode. Now there is "navigator.getDeviceStorage"
> but the request stays "pending" forever.

There's actually another thing that I need to do in the patch, I'll let you test the newer version soon :)

(the permission requires a prompt)
Priority: -- → P1
Blocks: 1111077
Whiteboard: dependency:platform
Is this being worked on? Have the plans for enabling the DeviceStorageAPI on desktop been discarded?
DeviceStorageAPI isn't going to be supported on the web at large.
Flags: needinfo?(jonas)
This is presumably only for signed apps?

Note that we are working on getting rid of apps entirely from FirefoxOS and will instead rely on signed content. Not sure how this will affect what the desktop team is doing?

https://wiki.mozilla.org/FirefoxOS/New_security_model
Flags: needinfo?(jonas)
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: