nsIURI object creation failed from standard URL

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

nsIURI object creation failed from standard URL

neel5481
Hi,

While creating the nsIURI object from standard_url it is giving the NULL object.

nsProtocolHandler class and NewURI() method we are accessing the standard_url and nsIURI object as below.

ns_smartptr<nsIStandardURL> standard_url(nsCreateInstance("@mozilla.org/network/standard-url;1"));

standard_url->Init(nsIStandardURL::URLTYPE_STANDARD, 80, aSpec, aOriginCharset, aBaseURI);

ns_smartptr<nsIURI> result(standard_url);

*_retval = result;
NS_ADDREF(*_retval);

return NS_OK;


While creating the nsIURI object from standard_url ( ns_smartptr<nsIURI> result(standard_url); )  result is coming NULL (0x00000000).

Is there any reason ? why it is coming NULL ? we have use different contract ID ?

We have followed the below link

https://bugzilla.mozilla.org/show_bug.cgi?id=296798

Is it related to that ? Can anyone tell me what are the changes required to make it work ?

Thanks in Advance.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: nsIURI object creation failed from standard URL

neel5481
This is the nsIProtocolHandler custom NewURI method implemetation.

We have CustomnsIProtocolHandler which derived from nsIProtocolHandler.

class CustomnsIProtocolHandler : public nsIProtocolHandler

we have override the method NewURI() and above code is under NewURI() method


NS_IMETHODIMP CustomnsIProtocolHandler::NewURI(const nsACString &aSpec, const char *aOriginCharset, nsIURI *aBaseURI, nsIURI **_retval)
{
        ns_smartptr<nsIStandardURL> standard_url(nsCreateInstance("@mozilla.org/network/standard-url;1"));

        standard_url->Init(nsIStandardURL::URLTYPE_STANDARD, 80, aSpec, aOriginCharset, aBaseURI);

        ns_smartptr<nsIURI> result(standard_url);       <---------- This result is giving us NULL.

        if (result)
        {
                *_retval = result;
                NS_ADDREF(*_retval);
        }

        return NS_OK;
}

Please let me know for more information.

Thanks in Advance
Reply | Threaded
Open this post in threaded view
|

Re: nsIURI object creation failed from standard URL

Neil-4
In reply to this post by neel5481
[hidden email] wrote:

>While creating the nsIURI object from standard_url it is giving the NULL object.
>
>nsProtocolHandler class and NewURI() method we are accessing the standard_url and nsIURI object as below.
>
>ns_smartptr<nsIStandardURL> standard_url(nsCreateInstance("@mozilla.org/network/standard-url;1"));
>
>standard_url->Init(nsIStandardURL::URLTYPE_STANDARD, 80, aSpec, aOriginCharset, aBaseURI);
>
>ns_smartptr<nsIURI> result(standard_url);
>
>*_retval = result;
>NS_ADDREF(*_retval);
>
>return NS_OK;
>
Out of interest, can you try the following code instead:

ns_smartptr<nsIStandardURL> standard_url(nsCreateInstance("@mozilla.org/network/standard-url;1"));

standard_url->Init(nsIStandardURL::URLTYPE_STANDARD, 80, aSpec, aOriginCharset, aBaseURI);

return CallQueryInterface(standard_url, _retval);

--
Warning: May contain traces of nuts.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: nsIURI object creation failed from standard URL

Neil-4
In reply to this post by neel5481
[hidden email] wrote:

>While creating the nsIURI object from standard_url ( ns_smartptr<nsIURI> result(standard_url); )  result is coming NULL (0x00000000).
>  
>
One possibility that I've just thought of is that you're building using
a different SDK from the version of Gecko in which you want your
component to run, in which case the UUID of nsIURI might well be different.

--
Warning: May contain traces of nuts.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: nsIURI object creation failed from standard URL

neel.patel
In reply to this post by neel5481
Hi Neil,

Thanks for the reply.

I am using Gecko Version 9.0.1 (XulRunner) and same SDK version. (runtimes and SDK version is same)

Thanks,


On Wednesday, July 10, 2013 3:38:14 PM UTC+5:30, [hidden email] wrote:

> Hi,
>
>
>
> While creating the nsIURI object from standard_url it is giving the NULL object.
>
>
>
> nsProtocolHandler class and NewURI() method we are accessing the standard_url and nsIURI object as below.
>
>
>
> ns_smartptr<nsIStandardURL> standard_url(nsCreateInstance("@mozilla.org/network/standard-url;1"));
>
>
>
> standard_url->Init(nsIStandardURL::URLTYPE_STANDARD, 80, aSpec, aOriginCharset, aBaseURI);
>
>
>
> ns_smartptr<nsIURI> result(standard_url);
>
>
>
> *_retval = result;
>
> NS_ADDREF(*_retval);
>
>
>
> return NS_OK;
>
>
>
>
>
> While creating the nsIURI object from standard_url ( ns_smartptr<nsIURI> result(standard_url); )  result is coming NULL (0x00000000).
>
>
>
> Is there any reason ? why it is coming NULL ? we have use different contract ID ?
>
>
>
> We have followed the below link
>
>
>
> https://bugzilla.mozilla.org/show_bug.cgi?id=296798
>
>
>
> Is it related to that ? Can anyone tell me what are the changes required to make it work ?
>
>
>
> Thanks in Advance.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: nsIURI object creation failed from standard URL

neel5481
In reply to this post by neel5481
Hi Neil,

Thanks for the response.

I have tried below code as you mentioned.

standard_url->QueryInterface(NS_GET_IID(nsIStandardURL), (void **)_retval);

But it is the same issue

Thanks in Advance.

On Wednesday, July 10, 2013 3:38:14 PM UTC+5:30, [hidden email] wrote:

> Hi,
>
>
>
> While creating the nsIURI object from standard_url it is giving the NULL object.
>
>
>
> nsProtocolHandler class and NewURI() method we are accessing the standard_url and nsIURI object as below.
>
>
>
> ns_smartptr<nsIStandardURL> standard_url(nsCreateInstance("@mozilla.org/network/standard-url;1"));
>
>
>
> standard_url->Init(nsIStandardURL::URLTYPE_STANDARD, 80, aSpec, aOriginCharset, aBaseURI);
>
>
>
> ns_smartptr<nsIURI> result(standard_url);
>
>
>
> *_retval = result;
>
> NS_ADDREF(*_retval);
>
>
>
> return NS_OK;
>
>
>
>
>
> While creating the nsIURI object from standard_url ( ns_smartptr<nsIURI> result(standard_url); )  result is coming NULL (0x00000000).
>
>
>
> Is there any reason ? why it is coming NULL ? we have use different contract ID ?
>
>
>
> We have followed the below link
>
>
>
> https://bugzilla.mozilla.org/show_bug.cgi?id=296798
>
>
>
> Is it related to that ? Can anyone tell me what are the changes required to make it work ?
>
>
>
> Thanks in Advance.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: nsIURI object creation failed from standard URL

Neil-4
[hidden email] wrote:

>Hi Neil,
>
>Thanks for the response.
>
>I have tried below code as you mentioned.
>
>standard_url->QueryInterface(NS_GET_IID(nsIStandardURL), (void **)_retval);
>
>But it is the same issue
>
>Thanks in Advance.
>
Sorry, in that case I'm out of ideas.

--
Warning: May contain traces of nuts.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul