Hi, all!
How to integrate and start the new version of interface
nsIExtensionManager for xulrunner-1.9.2 with JavaXPCOM?!
Someone would had the snippet code for that or some idea for that
implementation?
What changed between xulrunner-1.9.0 and xulrunner-1.9.2?
I executing the code:
nsIWindowWatcher winWatcher = XPCOMUtils.getService("@mozilla.org/
embedcomp/window-watcher;1", nsIWindowWatcher.class); //$NON-NLS-1$
winWatcher.setWindowCreator(winCreator);
nsIPrefBranch pref =
XPCOMUtils.getService("@mozilla.org/preferences-service;1",
nsIPrefBranch.class); //$NON-NLS-1$
pref.setBoolPref("browser.download.useDownloadDir",
0); //$NON-NLS-1$
//when page loading fails, display an error page,
//similar as firefox does
pref.setBoolPref("browser.xul.error_pages.enabled",
1); //$NON-NLS-1$
//disable various security warning dialogs
//such as when entering/leaving https site or
//submitting form
pref.setBoolPref("security.warn_entering_secure",
0); //$NON-NLS-1$
pref.setBoolPref("security.warn_entering_weak",
0); //
$NON-NLS-1$
pref.setBoolPref("security.warn_leaving_secure",
0); //
$NON-NLS-1$
pref.setBoolPref("security.warn_submit_insecure",
0); //$NON-NLS-1$
pref.setBoolPref("security.warn_viewing_mixed",
0); //
$NON-NLS-1$
nsIExtensionManager em = getService("@mozilla.org/
extensions/manager;1", nsIExtensionManager.class); //$NON-NLS-1$
/**
* Returns XPCOM service with the given
contract ID. This method
* is an equivalent of the
<tt>do_GetService()</tt> macro in
mozilla
* source code. For example,
* <pre>
* getService("@mozilla.org/
cookiemanager;1",
nsICookieManager.class)
* </pre>
* returns the <tt>nsICookieManager</
tt> interface of the Mozilla's
* cookie service. Similarly,
* <pre>
* getService("@mozilla.org/
cookiemanager;1",
nsICookieService.class)
* </pre>
* returns the <tt>nsICookieService</
tt> interface of the cookie
service.
*
* @param <T> - an XPCOM interface
(org.mozilla.interfaces)
* @param contractID - identifier of
the XPCOM service
* @param c - interface of the XPCOM
service to be returned
* @return XPCOM service
*/
public static <T extends nsISupports>
T getService(String
contractID, Class<T> c) {
try {
Mozilla moz =
Mozilla.getInstance();
String iid = guessIID(c);
nsIServiceManager
serviceManager = moz.getServiceManager();
T t = (T)
serviceManager.getServiceByContractID(contractID,
iid);
return t;
} catch (Throwable e) {
log.error("failed to create
XPCOM service", e); //$NON-NLS-1$
return null;
}
}
and getting error:
GRAVE: failed to create XPCOM service
org.mozilla.xpcom.XPCOMException: The function
"getServiceByContractID" returned an error condition (0x80570016)
at
org.mozilla.xpcom.internal.XPCOMJavaProxy.callXPCOMMethod(Native
Method)
at
org.mozilla.xpcom.internal.XPCOMJavaProxy.invoke(XPCOMJavaProxy.java:
143)
at
$Proxy0.getServiceByContractID(Unknown Source)
Thanks,
henson
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding