Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem writing new JS WebIDL

27 views
Skip to first unread message

Sammy Patenotte

unread,
Sep 9, 2015, 7:20:41 PM9/9/15
to mozilla...@lists.mozilla.org
Hi everyone,
I've been working on writing a new WebIDL for logging permission requests in Firefox OS, reading all the corresponding MDN pages. My code is pretty much written now, but I'm having some trouble accessing the WebIDL I've implemented. My first error code was as follows:

E/GeckoConsole( 206): [JavaScript Error: "NS_ERROR_XPC_BAD_IID: Component returned failure code: 0x80570018 (NS_ERROR_XPC_BAD_IID) [nsIJSCID.getService]" {file: "jar:file:///system/b2g/omni.ja!/components/ContentPermissionPrompt.js" line: 38}]

And the line in question was the following:

var privacyMonitor = Cc["@mozilla.org/privacy-monitor;1"].getService(Ci.PrivacyMonitor);

After changing the line to:

var privacyMonitor = Cc["@mozilla.org/privacy-monitor;1"].getService();

The error changed to:

E/GeckoConsole( 208): [JavaScript Error: "NS_ERROR_XPC_GS_RETURNED_FAILURE: Component returned failure code: 0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]" {file: "jar:file:///system/b2g/omni.ja!/components/ContentPermissionPrompt.js" line: 38}]

I tried to Google the problem, but didn't have any luck.

The complete WebIDL code is at https://gist.github.com/spatenotte/e5d31db4fc7c76240efe

I'd appreciate any help.

Thanks!

Fabrice Desré

unread,
Sep 9, 2015, 7:28:27 PM9/9/15
to dev...@lists.mozilla.org
Hi Sammy,
The issue is that Components.interfaces.PrivacyMonitor doesn't exist.
Components.interfaces are xpidl interfaces, not webidl interfaces. Are
you exposing this component to web pages? It doesn't look you do from
your gist, so you don't need .webidl here, only .idl

Fabrice
--
Fabrice Desré
b2g team
Mozilla Corporation

Sammy Patenotte

unread,
Sep 9, 2015, 7:40:06 PM9/9/15
to mozilla...@lists.mozilla.org
Hi Fabrice,
Thank you for your quick answer! I'm trying to use this component in /gecko/b2g/components/ContentPermissionPrompt.js where, I believe, all permission requests go through. Since it's not a WebIDL, where should I put my IDL file?
The MDN page I based my code on was this one: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Guide/Building_components_in_JavaScript
Best,
Sammy.

Fabrice Desré

unread,
Sep 9, 2015, 7:52:05 PM9/9/15
to dev...@lists.mozilla.org
On 09/09/2015 04:39 PM, Sammy Patenotte wrote:

> Hi Fabrice,
> Thank you for your quick answer! I'm trying to use this component in /gecko/b2g/components/ContentPermissionPrompt.js where, I believe, all permission requests go through. Since it's not a WebIDL, where should I put my IDL file?
> The MDN page I based my code on was this one: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Guide/Building_components_in_JavaScript

Since it's b2g specific, you can keep it in b2g/components/

Sammy Patenotte

unread,
Sep 9, 2015, 8:13:29 PM9/9/15
to mozilla...@lists.mozilla.org
Actually,
I plan to implement an app in Gaia to view the logs, so I do need my IDL to be accessible from Gaia (which is why I added the NavigatorProperty), so I guess this solution wouldn't work for me. Is there an alternative way to access my service, other than Cc["@mozilla.org/privacy-monitor;1"].getService(Ci.PrivacyMonitor)?

Thank you.
0 new messages