We have an XPCOM component that provides some custom 'download
manager' functionality. This component is targeting Windows OS only
and internally the component is using the BITS service to queue and
download media from a remote URL.
Media being downloaded could be protected using DRM so we have had to
implement some license registration functionality with Windows Media
Player when the downloads commence.
The component itself will be running from a remote server, e.g.
http://www.myserver.com/mypage.html.
The component is not visible within a page and does not render any
output, it lets us poll the download queue and the UI element is
updated via JavaScript and styled in standard CSS.
When a user wishes to subscribe to our service, they would be prompted
to download the software to install all required components. We will
be installing the Firefox XPCOM items at this point.
The component is working as expected but the methods need to be called
from JavaScript and we are running into privilege issues. While in
development, setting the codebase_principal_support flag in
about:config and then calling
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
allows us to use the component as expected. For production we would
not be using the principal_support option so need to allow the browser
to call XPConnect.
Q: What is the recommended way to allow an XPCOM component running on
a remote server to be called from client JavaScript without using a
codebase_principal_support flag?
I've read a number of articles on this, but there seem to be a number
of ways described...
1) Sign your page and script using the NSS tools to package all
required items into a jar file.
* Mozilla example at http://www.mozilla.org/projects/security/components/signed-script-example.html
* How to sign using the NSS tools http://oyoy.eu/huh/firefox-extension-code-signed-with-spc-pvk/
2) Implementing as a plugin and using the methods described in the
'scriptable plugin' example in the SDK source at
http://mxr.mozilla.org/seamonkey/source/modules/plugin/tools/sdk/samples/scriptable/windows/
* Scripting plugins in Mozilla (http://web.archive.org/web/
20040203123443/www.mozilla.org/projects/plugins/scripting-
plugins.html)
The process described in 1) would probably require the least amount of
development on our part but would require us to offer a number of
pages to the client depending on browser type since the jar! approach
will only work with Mozilla browsers.
Process 2) sound like a more solid approach (e.g I can script the
Windows Media Player plugin for Firefox without any privilege issues
and can offer the same HTML page for both IE \ Firefox and just render
out the appropriate plugin code) but would require us to re-dev our
extensions.
Any advice or further reading appreciated....
Thanks
Dylan
A useful bit of information might also be that the XPCOM object is
currently written in C++ using the Gecko SDK and compiles to .DLL
and .XPT files.
>A useful bit of information might also be that the XPCOM object is currently written in C++ using the Gecko SDK and compiles to .DLL and .XPT files.
>
>
Perhaps you could register your component with the global object
category, and implement the security checked component interface.
--
Warning: May contain traces of nuts.
http://weblogs.mozillazine.org/weirdal/archives/017188.html
http://weblogs.mozillazine.org/weirdal/archives/017202.html
http://weblogs.mozillazine.org/weirdal/archives/017211.html
Cheers,
Lance
So nsISecurityCheckedComponent sounds like the best way to go....do
you know of any example source for this?
In this thread, Boris suggests looking at nsXMLHttpRequest.cpp from
Gecko 1.8.0.x? Is there a link for this specific version?
Thanks again
On Sep 16, 12:00 am, Lance Duivenbode <lduivenbode.mozi...@gmail.com>
wrote:
> > category, and implement the security checked component interface.- Hide quoted text -
>
> - Show quoted text -
I am trying to build universal GeckoSDK,
The build script was throwing the following errors
checking for glib-config... no
checking for GLIB - version >= 1.2.0... no
*** The glib-config script installed by GLIB could not be found
*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the GLIB_CONFIG environment variable to the
*** full path to glib-config.
checking for libIDL-config... no
checking for libIDL - version >= 0.6.3... no
*** The libIDL-config script installed by libIDL could not be found
*** If libIDL was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the LIBIDL_CONFIG environment variable to the
*** full path to libIDL-config.
checking for pkg-config... no
*** The pkg-config script could not be found. Make sure it is
*** in your path, or set the PKG_CONFIG environment variable
*** to the full path to pkg-config.
*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config.
configure: error: Library requirements (libIDL-2.0 >= 0.8.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.
*** Fix above errors and then restart with "make -f client.mk build"
make[2]: *** [configure] Error 1
make[1]: *** [/Users/labuser/Desktop/1.9.0.1/source/mozilla/xr-opt/i386/Makefile] Error 2
make: *** [build] Error 2
Has anyone already built universal GeckoSDK, could you please throw some pointers?
Thanks
Assuming you're talking about mac univeral, we don't have a universal gecko
SDK, and you don't need one. Instead, you should create separate PPC and
intel SDKs, build your code against those seperately, and unify them using lipo.
The XULrunner section of the FTP site has prepackaged PPC and x86 SDKs
avialable for download.
> checking for glib-config... no
> checking for GLIB - version >= 1.2.0... no
> *** The glib-config script installed by GLIB could not be found
> *** If GLIB was installed in PREFIX, make sure PREFIX/bin is in
> *** your path, or set the GLIB_CONFIG environment variable to the
> *** full path to glib-config.
You haven't provided much information: what mozconfig are you using? Are you
encountering this error during the straight-compile phase or the
cross-compile phase? Do you have CROSS_COMPILE set correctly?
--BDS
Many thanks for your help, have managed to implement your example
source into our component and everything is working as expected.
Cheers!