Closed
Bug 898448
Opened 12 years ago
Closed 12 years ago
Installation of packaged apps fail due to assuming existence of getDeviceStorage
Categories
(Core Graveyard :: DOM: Apps, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla25
People
(Reporter: jsmith, Assigned: jsmith)
References
Details
Attachments
(1 file, 4 obsolete files)
2.60 KB,
patch
|
fabrice
:
review+
|
Details | Diff | Splinter Review |
See discussion on bug 896059.
Assignee | ||
Updated•12 years ago
|
OS: All → Android
Hardware: All → ARM
Assignee | ||
Comment 1•12 years ago
|
||
Assignee | ||
Updated•12 years ago
|
Attachment #781721 -
Flags: review?(fabrice)
Comment 2•12 years ago
|
||
Could we wait bug 777402 for the fix in Webapps.jsm? (the patches there already contain that fix, I would prefer not to rebase them again)
Assignee | ||
Comment 3•12 years ago
|
||
(In reply to Marco Castelluccio [:marco] from comment #2)
> Could we wait bug 777402 for the fix in Webapps.jsm? (the patches there
> already contain that fix, I would prefer not to rebase them again)
hmm..I'd rather split out the specific fix actually for the getDeviceStorage piece mainly because the FxAndroid guys are blocked right now with this not working. But let's see what fabrice thinks.
Assignee | ||
Updated•12 years ago
|
Assignee: nobody → jsmith
Comment 4•12 years ago
|
||
Comment on attachment 781721 [details] [diff] [review]
Check for getDeviceStorage Existence in Webapps.jsm before calling getDeviceStorage
Review of attachment 781721 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/apps/src/FreeSpaceWatcher.jsm
@@ +52,5 @@
> callback.currentStatus = newStatus;
> }
> };
>
> + if (navigator.getDeviceStorage) {
There's no navigator object in the global scope in chrome code, so this will fail in interesting ways. You need to get it from the getMostRecentWindow() call.
::: dom/apps/src/Webapps.jsm
@@ +2694,5 @@
> }
> download();
> };
>
> + if (navigator.getDeviceStorage) {
Same here.
Attachment #781721 -
Flags: review?(fabrice) → review-
Assignee | ||
Updated•12 years ago
|
Attachment #781721 -
Attachment is obsolete: true
Assignee | ||
Comment 5•12 years ago
|
||
Fixed to use getMostRecentWindow.
Assignee | ||
Comment 6•12 years ago
|
||
Assignee | ||
Comment 7•12 years ago
|
||
Comment on attachment 782045 [details] [diff] [review]
Patch v2
Got an okay from fabrice on this on approach in IRC, so I'll ask for review.
Attachment #782045 -
Flags: review?(fabrice)
Comment 8•12 years ago
|
||
Comment on attachment 782045 [details] [diff] [review]
Patch v2
Review of attachment 782045 [details] [diff] [review]:
-----------------------------------------------------------------
Sorry I didn't look closely the first time.
::: dom/apps/src/FreeSpaceWatcher.jsm
@@ +57,5 @@
> + .getMostRecentWindow("navigator:browser")
> + .navigator.getDeviceStorage;
> +
> + if (getDeviceStorage) {
> + let deviceStorage = getDeviceStorage("apps");
That can return null, so we must take care of that case.
::: dom/apps/src/Webapps.jsm
@@ +2704,5 @@
> + let getDeviceStorage = Services.wm.getMostRecentWindow("navigator:browser")
> + .navigator.getDeviceStorage;
> +
> + if (getDeviceStorage) {
> + let deviceStorage = getDeviceStorage("apps");
Ditto.
Attachment #782045 -
Flags: review?(fabrice) → review-
Assignee | ||
Updated•12 years ago
|
Attachment #782045 -
Attachment is obsolete: true
Assignee | ||
Comment 9•12 years ago
|
||
Assignee | ||
Comment 10•12 years ago
|
||
Comment on attachment 782056 [details] [diff] [review]
Patch v3
Fixed to handle null case.
Attachment #782056 -
Flags: review?(fabrice)
Updated•12 years ago
|
Attachment #782056 -
Flags: review?(fabrice) → review+
Assignee | ||
Updated•12 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 11•12 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=312f81126928
Doesn't look like everything passed, so let me look into this.
Keywords: checkin-needed
Assignee | ||
Comment 12•12 years ago
|
||
Only the packaged app install mochitest is relevant in terms of failures. I'm seeing the following:
22:42:58 WARNING - E/GeckoConsole( 646): [JavaScript Error: "'getDeviceStorage' called on an object that does not implement interface Navigator." {file: "resource://gre/modules/Webapps.jsm" line: 2698}]
Comment 13•12 years ago
|
||
Same problem with my patch.
Anyway I've noticed that getDeviceStorage is defined in Firefox 22, but not in Firefox Nightly. If you execute this code in the Browser Console (or Error Console):
> Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser").navigator.getDeviceStorage
In Firefox 22 you get a function, in Firefox Nightly you get an undefined value.
If you execute:
> Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser").navigator.getDeviceStorage("apps")
In Firefox 22 you get null, in Firefox Nightly an exception.
Assignee | ||
Comment 14•12 years ago
|
||
Right, that's cause in Nightly, we landed support for the navigator object being converted to WebIDL (bug 838146).
However, one thing not explained here yet is why in chrome code Services.wm.getMostRecentWindow("navigator:browser").navigator.getDeviceStorage is firing the error cited in comment 12.
Boris - Shouldn't the navigator object present there be able to call getDeviceStorage?
Flags: needinfo?(bzbarsky)
Assignee | ||
Comment 15•12 years ago
|
||
(In reply to Jason Smith [:jsmith] from comment #14)
> Right, that's cause in Nightly, we landed support for the navigator object
> being converted to WebIDL (bug 838146).
>
> However, one thing not explained here yet is why in chrome code
> Services.wm.getMostRecentWindow("navigator:browser").navigator.
> getDeviceStorage is firing the error cited in comment 12.
>
> Boris - Shouldn't the navigator object present there be able to call
> getDeviceStorage?
Let me reword that - Shouldn't the navigator object present there be able to allow me to access the function getDeviceStorage to get an undefined value? See the attached patch for clarification.
![]() |
||
Comment 16•12 years ago
|
||
In the old setup, navigator.getDeviceStorage was always defined. When called it would return null based on various things like preferences and what you were requesting and whatnot.
In the new setup, it's defined only if the device.storage.enabled preference is set, because if that's not set then it can't possibly ever do anything useful. This was a purposeful change from the current behavior made in bug 838146.
Now obviously we could change back to the old behavior: define the property unconditionally and return null in various cases. But note that Jonas actually wants to move in the opposite direction and not define the property at all in contexts that don't have permissions for it, no matter what the pref is set to.
Flags: needinfo?(bzbarsky)
![]() |
||
Comment 17•12 years ago
|
||
Oh, and the attached patch looks wrong to me, because the method is being invoked with the window as "this", which ought to throw.
Assignee | ||
Comment 18•12 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #17)
> Oh, and the attached patch looks wrong to me, because the method is being
> invoked with the window as "this", which ought to throw.
Yup, just realized that. I know what to do now. Thanks for the help.
Assignee | ||
Updated•12 years ago
|
Attachment #782056 -
Attachment is obsolete: true
Assignee | ||
Comment 19•12 years ago
|
||
Assignee | ||
Comment 20•12 years ago
|
||
I think the updated patch is what we want, but I'm waiting for the try run to confirm.
https://tbpl.mozilla.org/?tree=Try&rev=f3ed5c9b16af
Assignee | ||
Comment 21•12 years ago
|
||
Comment on attachment 782377 [details] [diff] [review]
Patch v4
Green on try.
Attachment #782377 -
Flags: review?(fabrice)
Updated•12 years ago
|
Attachment #782377 -
Flags: review?(fabrice) → review+
Assignee | ||
Comment 22•12 years ago
|
||
Apparently this patch works on B2G, but fails on Android since bind won't work on a non-existent function.
Assignee | ||
Updated•12 years ago
|
Attachment #782377 -
Attachment is obsolete: true
Assignee | ||
Comment 23•12 years ago
|
||
This time I was actually a bit more careful. Try run is green and manually tested on FxAndroid.
https://tbpl.mozilla.org/?tree=Try&rev=71386fae55ba
On FxAndroid, this code works, but the packaged app installation doesn't appear to completely finish installing during the oninstall event handler:
07-29 12:40:16.287: E/GeckoConsole(22012): [JavaScript Error: "this._manifest is undefined" {file: "resource://gre/modules/AppsUtils.jsm" line: 497}]
07-29 12:40:16.287: E/GeckoConsole(22012): [JavaScript Error: "NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS: '[JavaScript Error: "this._manifest is undefined" {file: "resource://gre/modules/AppsUtils.jsm" line: 497}]' when calling method: [nsIDOMEventListener::handleEvent]" {file: "jar:jar:file:///data/app/org.mozilla.fennec-1.apk!/assets/omni.ja!/components/Webapps.js" line: 760}]
Assignee | ||
Comment 24•12 years ago
|
||
Comment on attachment 782719 [details] [diff] [review]
Patch v5
Talked with marco about this. Code-wise we know this works based on try run and manual testing, but packaged app install still won't fully work with this patch alone. There's a followup issue I'll file for the bug I just found.
Attachment #782719 -
Flags: review?(fabrice)
Updated•12 years ago
|
Attachment #782719 -
Flags: review?(fabrice) → review+
Assignee | ||
Updated•12 years ago
|
Keywords: checkin-needed
Comment 25•12 years ago
|
||
Keywords: checkin-needed
Comment 26•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Updated•7 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•