Last Comment Bug 725397 - Some mozApps helper should be accessible from C++ trough a XPCOM component
: Some mozApps helper should be accessible from C++ trough a XPCOM component
Status: RESOLVED FIXED
[fixed by bug 754141]
:
Product: Core
Classification: Components
Component: DOM: Apps (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on: 720415
Blocks: 740192 746465
  Show dependency treegraph
 
Reported: 2012-02-08 10:32 PST by Mounir Lamouri (:mounir)
Modified: 2012-07-28 09:25 PDT (History)
7 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Mounir Lamouri (:mounir) 2012-02-08 10:32:38 PST
It's currently not possible to read mozApps information from C++ which means stuff like Screen Orientation API that want to have a specific behavior for installed app can't do what we want.

We need a way to access these information from C++. At least, knowing if we are currently running in an installed application context or not.
Comment 1 Jason Smith [:jsmith] 2012-04-18 07:53:08 PDT
Fabrice or Ian - Any ideas?
Comment 2 Ian Bicking (:ianb) 2012-04-18 10:36:36 PDT
I can't be much help here
Comment 3 Benjamin Smedberg [:bsmedberg] 2012-04-18 10:53:13 PDT
I definitely don't think that "mozApps" in general needs or ought to be available to C++. We ought to expose specific queries like "am I running in app mode" more directly. Note that the implementation may be vastly different in different contexts, e.g. on Android we may end up using a single Firefox process to run all the webapps, so the question needs to be per-docshell or per-window or something like that.
Comment 4 Mounir Lamouri (:mounir) 2012-04-19 02:03:13 PDT
What should be accessible from C++ is the API. There is no reason to hide it in JS...
Comment 5 Benjamin Smedberg [:bsmedberg] 2012-04-19 05:47:51 PDT
Other than it is implemented in JS, and doing extra work to make it available via C++ without a compelling usecase seems silly? We're implementing a lot of new APIs directly in JS. So let's solve the actual use case that we need to solve for C++ code, and not attempt to mirror the entire mozapps API into C++ in a generic way.
Comment 6 Mounir Lamouri (:mounir) 2012-04-19 05:53:07 PDT
(In reply to Benjamin Smedberg  [:bsmedberg] from comment #5)
> Other than it is implemented in JS, and doing extra work to make it
> available via C++ without a compelling usecase seems silly? We're
> implementing a lot of new APIs directly in JS. So let's solve the actual use
> case that we need to solve for C++ code, and not attempt to mirror the
> entire mozapps API into C++ in a generic way.

AFAIK, making the API available from C++ should be done trough a XPCOM service. Then, adding only one method or a few doesn't seem like a lot of work. If it is for some of them, I agree we shouldn't bother too much.
Comment 7 Ian Bicking (:ianb) 2012-04-19 08:40:10 PDT
DOMApplicationRegistry's API will, I think, need to change quite a bit if the storage is changed (right now it's just a set of JSON files read somewhat synchronously), and I suspect other changes will also occur – which is okay at the moment because there are very few consumers of DOMApplicationRegistry.  I don't think it should be exposed any further in its current form as I don't think that API will show itself to be stable enough.  Exposing specific (and probably new) routines more publicly, including through C++, would seem to be a better route.
Comment 8 [:fabrice] Fabrice Desré 2012-04-19 08:57:28 PDT
DOMApplicationRegistry is not a public API (also, it does no synchronous IO currently, even if I'd like to move the storage to indexedDB for other reasons), but I'm not sure that's what is needed here. Moreover, it should only be used in the parent process.

The mozApps API itself is implemented as an XPCOM component, so there's nothing preventing its use from c++, and using it is e10s compliant.
Comment 9 Jason Smith [:jsmith] 2012-04-19 11:09:44 PDT
(In reply to Fabrice Desré [:fabrice] from comment #8)
> The mozApps API itself is implemented as an XPCOM component, so there's
> nothing preventing its use from c++, and using it is e10s compliant.

Mounir - Could you verify that you can access the mozapps API from C++ off of Fabrice's instructions? If you are able to do this, could you then resolve this bug as "WORKSFORME." If not, please provide more information on why you cannot access the mozapps API in C++.
Comment 10 Gregor Wagner [:gwagner] 2012-04-27 16:16:14 PDT
(In reply to Jason Smith [:jsmith] from comment #9)
> (In reply to Fabrice Desré [:fabrice] from comment #8)
> > The mozApps API itself is implemented as an XPCOM component, so there's
> > nothing preventing its use from c++, and using it is e10s compliant.
> 
> Mounir - Could you verify that you can access the mozapps API from C++ off
> of Fabrice's instructions? If you are able to do this, could you then
> resolve this bug as "WORKSFORME." If not, please provide more information on
> why you cannot access the mozapps API in C++.

The API uses DOMRequests so you always need a window to access it. Is this the case?
Comment 11 Mounir Lamouri (:mounir) 2012-05-10 14:57:20 PDT
We would need something like:
  mozIDOMApplication getAppFromManifestURL(DOMString manifestURL);
Comment 12 Mounir Lamouri (:mounir) 2012-05-23 11:30:46 PDT
I wrote a service for that in bug 754141.

Note You need to log in before you can comment on or make changes to this bug.