createInstance fails if component not in Components folder

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

createInstance fails if component not in Components folder

Roy-23
Hello,

If I drag an xpi into Firefox that containins the install.js file shown
at the bottom of this post, the extension I wrote cannot instantiate an
instance of the component in mycomponent.dll.  The component and typelib
are placed in c:\program files\myapp\, as expected, but it seems like
the component doesn't get registered...after restarting Firefox, the
Components.classes[cid].createInstance() call made in the XUL throws
"Components.classes[cid] has no properties".

If I change install.js so that mycomponent.dll and IMyTypelib.xpt wind
up in the components folder (c:\program files\mozilla
firefox\components\), the call to createInstance in the XUL succeeds.

Any idea why the createInstance result is different depending on where
the component/typelib are located?

Thanks,
Roy

var err = initInstall("myextension", "myextension", 1.0);
var appFolder;
var putChromeHere;

if (err == SUCCESS) {
    appFolder = getFolder("file:///", "c|/program%20files/myapp");
    ///appFolder = getFolder("Components");
    putChromeHere = getFolder(appFolder, "myextension");
}
if (err == SUCCESS) {
    err = setPackageFolder(putChromeHere);
}
if (err == SUCCESS) {
    err = addDirectory("myextension", "myextension", putChromeHere, "");
}
if (err == SUCCESS) {
    err = addFile("mycomponent.dll", "1.0",
"components/mycomponent.dll", appFolder, "");
}
if (err == SUCCESS) {
    err = addFile("IMyTypelib.xpt", "1.0", "components/IMyTypelib.xpt",
appFolder, "");
}
if (err == SUCCESS) {
    err = performInstall();
}
if (err == SUCCESS) {
    err = refreshPlugins();
    alert("please restart");
}
if (err != SUCCESS) {
    cancelInstall(err);
}
_______________________________________________
dev-tech-xpinstall mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xpinstall
Reply | Threaded
Open this post in threaded view
|

Re: createInstance fails if component not in Components folder

Philip Chee
On Thu, 22 Jun 2006 22:06:07 -0400, Roy wrote:

> If I drag an xpi into Firefox that containins the install.js file shown

Any reason why you aren't using the install.rdf/chrome.manifest method
of XPInstall?

> at the bottom of this post, the extension I wrote cannot instantiate an
> instance of the component in mycomponent.dll.  The component and typelib
> are placed in c:\program files\myapp\, as expected, but it seems like
> the component doesn't get registered...after restarting Firefox, the
> Components.classes[cid].createInstance() call made in the XUL throws
> "Components.classes[cid] has no properties".

> If I change install.js so that mycomponent.dll and IMyTypelib.xpt wind
> up in the components folder (c:\program files\mozilla
> firefox\components\), the call to createInstance in the XUL succeeds.

As far as I know it's always been the case that you have to put the
components including the XPT files in the /app/components/ directory.

For a different implementation of install.js you might like to have a
look at:

<http://downloads.mozdev.org/xsidebar/mods/install-flat-template.js>
<http://downloads.mozdev.org/xsidebar/mods/install-template.js>

Phil
--
Philip Chee <[hidden email]>, <[hidden email]>
http://flashblock.mozdev.org/ http://xsidebar.mozdev.org
Guard us from the she-wolf and the wolf, and guard us from the thief,
oh Night, and so be good for us to pass.
[ ]I know so little, but I know it fluently...
* TagZilla 0.059
_______________________________________________
dev-tech-xpinstall mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xpinstall