On Wednesday, September 9, 2015 at 4:28:27 PM UTC-7, Fabrice Desré wrote: > Hi Sammy, > > On 09/09/2015 04:20 PM, Sammy Patenotte wrote: > > 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. > > 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
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. _______________________________________________ dev-b2g mailing list dev-b2g@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-b2g