Closed Bug 1197920 Opened 10 years ago Closed 10 years ago

TypeError: DOMApplicationRegistry.getAll is not a function on Fennec

Categories

(Firefox for Android Graveyard :: Web Apps (PWAs), defect)

defect
Not set
normal

Tracking

(firefox43 fixed)

RESOLVED FIXED
Firefox 43
Tracking Status
firefox43 --- fixed

People

(Reporter: nalexander, Assigned: myk)

References

Details

Attachments

(1 file)

I'm seeing the following error consistently in custom built Fennecs: 08-24 11:17:43.291 12238-12254/org.mozilla.fennec_nalexander E/GeckoConsole﹕ [JavaScript Error: "A promise chain failed to handle a rejection. Did you forget to '.catch', or did you forget to 'return'? See https://developer.mozilla.org/Mozilla/JavaScript_code_modules/Promise.jsm/Promise Date: Mon Aug 24 2015 11:16:37 GMT-0700 (PDT) Full Message: TypeError: DOMApplicationRegistry.getAll is not a function Full Stack: this.WebappManager._getInstalledApps@resource://gre/modules/WebappManager.jsm:466:5 this.WebappManager.checkForUpdates/<@resource://gre/modules/WebappManager.jsm:385:33 TaskImpl_run@resource://gre/modules/Task.jsm:314:40 TaskImpl@resource://gre/modules/Task.jsm:275:3 createAsyncFunction/asyncFunction@resource://gre/modules/Task.jsm:249:14 Task_spawn@resource://gre/modules/Task.jsm:164:12 this.WebappManager.checkForUpdates@resource://gre/modules/WebappManager.jsm:372:1 WebappsUpdateTimer.prototype.notify@jar:jar:file:///data/app/org.mozilla.fennec_nalexander-1.apk!/assets/omni.ja!/components/WebappsUpdateTimer.js:77:5 TM_notify/<@jar:jar:file:///data/app/org.mozilla.fennec
I did some digging and I can't tell what's changed recently. I /do/ see two implementations of DOMApplicationRegistry -- is it possible we're getting the wrong one due to build indeterminancy? I can't investigate further. myk, esawin: can you look into this and re-file as appropriate?
Flags: needinfo?(myk)
Flags: needinfo?(esawin)
(In reply to Nick Alexander :nalexander from comment #1) > I did some digging and I can't tell what's changed recently. I /do/ see two > implementations of DOMApplicationRegistry -- is it possible we're getting > the wrong one due to build indeterminancy? If y'all don't see this, it could be a strange issue with |mach artifact| builds. That would be interesting to know.
This is almost certainly a regression from bug 1191579. I'll need to investigate more to figure out what the fix should be.
Assignee: nobody → myk
Blocks: 1191579
Status: NEW → ASSIGNED
Flags: needinfo?(myk)
Flags: needinfo?(esawin)
Ha sorry guys. Myk, using AppsServiceChild.jsm should work.
(In reply to Eugen Sawin [:esawin] from comment #5) > Looks like bug 1191579 missed two more use cases ([1], [2]). > > [1] https://dxr.mozilla.org/mozilla-central/source/dom/apps/Webapps.js#937 This is fine, AppsServiceChild.jsm provides DOMApplicationRegistry.getAll() in https://dxr.mozilla.org/mozilla-central/source/dom/apps/AppsServiceChild.jsm?offset=300#339 > [2] > https://dxr.mozilla.org/mozilla-central/source/mobile/android/modules/ > WebappManager.jsm#466 AppsServiceChild.jsm should work for this one too.
(In reply to [:fabrice] Fabrice Desré from comment #6) > > [2] > > https://dxr.mozilla.org/mozilla-central/source/mobile/android/modules/ > > WebappManager.jsm#466 > > AppsServiceChild.jsm should work for this one too. This is actually the instance in question, per the stack in comment 0. And I'll look into importing AppsServiceChild for it. WebappManager is actually loaded into the parent process, but AppsServiceChild should work there too.
This does what I expect and is the minimal fix for the problem. Unsure if WebappManager should use AppsServiceChild for anything else, but that would be a separate issue in any case.
Attachment #8653175 - Flags: review?(esawin)
Attachment #8653175 - Flags: feedback?(fabrice)
Comment on attachment 8653175 [details] [diff] [review] patch v1: import AppsServiceChild.DOMApplicationRegistry for its getAll method Review of attachment 8653175 [details] [diff] [review]: ----------------------------------------------------------------- ::: mobile/android/modules/WebappManager.jsm @@ +28,5 @@ > > +// Import AppsServiceChild.DOMApplicationRegistry for its getAll method. > +var AppsServiceChild = {}; > +XPCOMUtils.defineLazyModuleGetter(AppsServiceChild, "DOMApplicationRegistry", > + "resource://gre/modules/AppsServiceChild.jsm"); You don't really need AppsServiceChild, but up to you.
Attachment #8653175 - Flags: feedback?(fabrice) → feedback+
(In reply to [:fabrice] Fabrice Desré from comment #9) > You don't really need AppsServiceChild, but up to you. WebappManager accesses a variety of DOMApplicationRegistry properties that don't exist on the AppsServiceChild implementation of DOMApplicationRegistry, like the doInstall method and registryReady. If it were to import AppsServiceChild.DOMApplicationRegistry into the global namespace, replacing the implementation of DOMApplicationRegistry that it imported from Webapps.jsm, then it would lose access to those properties. So it seems like it does need to import AppsServiceChild.DOMApplicationRegistry into AppsServiceChild (or some other namespace), unless there's something I'm missing.
You're right, and damn 8-line contexts :P
Comment on attachment 8653175 [details] [diff] [review] patch v1: import AppsServiceChild.DOMApplicationRegistry for its getAll method Review of attachment 8653175 [details] [diff] [review]: ----------------------------------------------------------------- More/earlier imports won't help us with startup performance, but we can deal with it later should this become an issue. Looks good!
Attachment #8653175 - Flags: review?(esawin) → review+
(In reply to Eugen Sawin [:esawin] from comment #12) > More/earlier imports won't help us with startup performance, but we can deal > with it later should this become an issue. This particular import is lazily loaded when WebappManager.checkForUpdates calls WebappManager._getInstalledApps, and WebappManager.checkForUpdates is called well after startup by WebappsUpdateTimer. So it shouldn't affect startup. > Looks good! I'll land it once fx-team reopens!
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 43
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: