Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Calling function from nsIContentSecurityPolicy.idl

17 views
Skip to first unread message

jeremy...@gmx.ch

unread,
Apr 5, 2013, 9:52:55 PM4/5/13
to
Hi,

I've declared a new function in nsIContentSecurityPolicy.idl:

AString getMyString();


I call this function from nsScriptLoader::ProcessScriptElement:

nsresult myRV = NS_OK;
nsCOMPtr<nsIContentSecurityPolicy> myCSP;
myRV = mDocument->NodePrincipal()->GetCsp(getter_AddRefs(myCSP));
NS_ENSURE_SUCCESS(myRV, false);

if (myCSP) {
nsAutoString myString = myCSP->GetMyString();


When I try to compile this I get an error c2660 function does not take 0 arguments. This seems weird to me as my declaration doesn't expect an argument?

Regards,
Jeremy

Boris Zbarsky

unread,
Apr 5, 2013, 11:53:38 PM4/5/13
to mozilla-de...@lists.mozilla.org
On 4/5/13 9:52 PM, jeremy...@gmx.ch wrote:
> AString getMyString();
....
> When I try to compile this I get an error c2660 function does not take 0 arguments. This seems weird to me as my declaration doesn't expect an argument?

The XPIDL C++ binding for AString return values turns them into a
"nsAString&" our param appended to the list of arguments.

Actually, that happens for _all_ return types in XPIDL, since the C++
versions of the methods all return nsresult.

See https://developer.mozilla.org/en-US/docs/XPIDL for more information.

-Boris

jeremy...@gmx.ch

unread,
Apr 8, 2013, 8:25:56 PM4/8/13
to
Thanks you, that helped.

Jeremy
0 new messages