Domanda

I start my app with firefox.exe --app application.ini -jsconsole and the first line of my script is:

Components.utils.import("resource://gre/modules/Services.jsm");

The second line is:

alert(typeof services);

And it alerts undefined. Nowhere in the documentation does it say how to get the services only that I need gecko 2.

My firefox version is 21.o for Windows but I think the xulrunner that comes with it might be lacking something.

È stato utile?

Soluzione

Any module you import will be named exactly as its filename (excluding extension), so in this case you would've to call it Services and not services. Do not forget that JavaScript variables are case-sensitive.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top