Re: Registering components under XULRunner 24

2014-02-18 Thread mrmagoo4207
! wow all the for ONE little bit of of detail huh? pretty special I can't 
wait to get better at this myself.
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Registering components under XULRunner 24

2014-02-17 Thread Benjamin Smedberg

On 2/17/2014 11:07 AM, Christian Sell wrote:

3. steal a copy of the missing XPCOMUtils.jsm file and put it into the 
xulrunner/modules directory
This should not be necessary. The correct location for this file is 
within omni.ja, and it seems to be present in the XR27 release.



3. when building the path for the ComponentRegistrar, dont use 
AppendRelativePath but rather use one Append call for each path segment
AppendRelativePath is supposed to work, but it's possible you ran into 
issues with Windows path separators: you must use backslashes on Windows 
and forward slashes on unixy OSes. Lesson learned, though, always check 
result codes ;-)


--BDS

___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Registering components under XULRunner 24

2014-02-17 Thread Christian Sell
ok, I finally got it registered, there was one change that I had applied to the 
wrong copy of one file. So, in summary, heres the steps I had to go through:

1. create a manifest file with the described entries
2. change the component javascript file and add the generateNSGetFactory thingy
3. steal a copy of the missing XPCOMUtils.jsm file and put it into the 
xulrunner/modules directory
3. when building the path for the ComponentRegistrar, dont use 
AppendRelativePath but rather use one Append call for each path segment

3 days of headbanging are over..
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Registering components under XULRunner 24

2014-02-17 Thread Christian Sell
added another line to components.manifest, as mentioned in the referenced 
document:

category profile-after-change RegionCapture @mozilla.org/regioncapture;1

still getting NS_ERROR_FACTORY_NOT_REGISTERED. There are no error messages in 
nsIConsoleService (at least none my listener gets). This is easily the worst 
ordeal I have encountered in a decade. Is there ANYBODY out there who can help??
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Registering components under XULRunner 24

2014-02-17 Thread Christian Sell
heres the code that fails to load the component:

 nsCOMPtr regionPrinter;
 retval = servMan->GetServiceByContractID("@mozilla.org/regioncapture;1", 
NS_GET_IID(nsIRegionCapture), getter_AddRefs(regionPrinter));
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Registering components under XULRunner 24

2014-02-17 Thread Christian Sell
replaced the
  
file->AppendRelativePath(NS_LITERAL_STRING("components/components.manifest")); 

with 2 calls:
  retval = file->Append(NS_LITERAL_STRING("components"));
  retval = file->Append(NS_LITERAL_STRING("components.manifest"));

now the manifest file is detected and parsed, resulting in a Javascript warning

[JavaScript Warning: "Trying to re-register CID 
'{e96f8106-a919-4a31-8b44-74bf3e5283ed}' already registered by ...

No additional error messages. When trying to load the component later on, still 
NS_ERROR_FACTORY_NOT_REGISTERED.
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Registering components under XULRunner 24

2014-02-17 Thread Christian Sell
the AppendRelativePath actually returns an NS_ERROR_UNRECOGNIZED_PATH (never 
checked the return code before)! The file does exist on the filesystem! How in 
the world am I to create the nsIFile object? What is going wrong??
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Registering components under XULRunner 24

2014-02-17 Thread Christian Sell
I have copied the XPCOMUtils.jsm from a recent firefox install. Still doesn't 
work. I have then registered a console listener. The error message I see is:

Could not read chrome manifest 'file:///G:/mozilla24/xulrunner'.

as already mentioned above, I am creating the file like this

nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1", 
&retval));
nsILocalFile *greDir;
retval = directory->Get(NS_GRE_DIR, NS_GET_IID(nsILocalFile), (void **)&greDir);
file->InitWithFile(greDir);
file->AppendRelativePath(NS_LITERAL_STRING("components/components.manifest"));

//later: registrar->AutoRegister(file); 

It seems the file I pass to the AutoRegister method is not valid. In 
particular, the part I add via AppendRelativePath seems to get lost, but why?? 
I've tried all permutations I can come up with, still the same...
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Registering components under XULRunner 24

2014-02-17 Thread Christian Sell
so I've tried to follow the guide under the URL in my previous mail, but still 
no success.

However, looking at the source code of my component, and the sample code under 
the mentioned URL, I found an import reference to an external file:

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

so I decided to check whether that file existed. It turns out that it DOES 
exist in XULRunner 10, but IT DOESN'T EXIST in the XULRunner 24 distro I 
downloaded from the Mozilla site.

I am a little wary about just copying the file over from V10 to V24. Can you 
tell me how to proceed?

thanks,
Chris
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Registering components under XULRunner 24

2014-02-14 Thread Christian Sell
I tried that, too, but it didn't do the job either. However, today I found this 
article: 
https://developer.mozilla.org/en-US/docs/Mozilla/XPCOM/XPCOM_changes_in_Gecko_2.0,
 which seems to indicate that I also have to update the javascript component 
code. I'll do that on monday.

thanks for your help so far,
Chris
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Registering components under XULRunner 24

2014-02-14 Thread Benjamin Smedberg

On 2/13/2014 1:12 PM, Christian Sell wrote:

doesnt work. I am creating the file like this:

retval = directory->Get(NS_GRE_DIR, NS_GET_IID(nsILocalFile), (void **)&greDir);
file->InitWithFile(greDir);
file->AppendRelativePath(NS_LITERAL_STRING("components/components.manifest"));

the contents of the components.manifest file are just one line:

interfaces RegionCapture.xpt

I still get NS_ERROR_FACTORY_NOT_REGISTERED when trying to access the component.


That's because the "interfaces" line only registers the interfaces, not 
the component. To register the component you use something like


http://mxr.mozilla.org/mozilla-central/source/toolkit/components/downloads/nsDownloadManagerUI.manifest

to register the "component" and "contract" entries

--BDS

___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Registering components under XULRunner 24

2014-02-13 Thread Christian Sell
added component and contract entries to the manifest file, still no hope. BTW, 
file->Exists() returns true.

I am out till next week. This was a fruitless day..
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Registering components under XULRunner 24

2014-02-13 Thread Christian Sell
doesnt work. I am creating the file like this:

retval = directory->Get(NS_GRE_DIR, NS_GET_IID(nsILocalFile), (void **)&greDir);
file->InitWithFile(greDir);
file->AppendRelativePath(NS_LITERAL_STRING("components/components.manifest"));

the contents of the components.manifest file are just one line:

interfaces RegionCapture.xpt

I still get NS_ERROR_FACTORY_NOT_REGISTERED when trying to access the component.

Chris
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Registering components under XULRunner 24

2014-02-13 Thread Christian Sell
no, "file" points to the directory where the component resides. I dont know 
where the output from nsIConsoleService goes, as that is maintained by the 
Eclipse/SWT integration. I'll try pointing to the manifest file. Thanks
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Registering components under XULRunner 24

2014-02-13 Thread Benjamin Smedberg

On 2/13/2014 12:31 PM, Christian Sell wrote:

Hello,

me again ;). We are embedding XULRunner in our Java application, using a thin 
integration layer written in C++ that provides extended functionality. We also 
have a XPCOM component written in Javascript, which we previously called though 
JavaXPCOM, and now need to call from C++. However, no matter what I do, I keep 
getting a NS_ERROR_FACTORY_NOT_REGISTERED when issuing the following call:

nsCOMPtr regionPrinter;
retval = servMan->GetServiceByContractID("@mozilla.org/regioncapture;1", 
NS_GET_IID(nsIRegionCapture), getter_AddRefs(regionPrinter));

I have tried adding the .js and .xpt files to the xulrunner components 
subdirectory (which I had to create), added chrome.manifest files pointing to 
the component, and even tried programmatic registration through

nsIComponentRegistrar> registrar;
retval = NS_GetComponentRegistrar(getter_AddRefs(registrar));
retval = registrar->AutoRegister(file);


If `file` points to the .manifest file you created, then AutoRegister 
should work. Are you seeing any errors from nsIConsoleService? When we 
adopted manifests I tried to make sure that any parsing errors would 
show up in the Firefox console.


--BDS

___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding