Closed Bug 673267 Opened 13 years ago Closed 13 years ago

Compile error using an inout jsval with an ArrayBufferView

Categories

(Core :: XPConnect, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: ddahl, Unassigned)

Details

(Not sure if this bug is filed in the right place)

In bug 440046, I should be using an inout param in /dom/interfaces/base/nsIDOMCrypto.idl

When i switch it to inout, I cannot compile: 

/home/ddahl/code/moz/mozilla-central/security/manager/ssl/src/nsCrypto.cpp:2473:1: error: prototype for ‘nsresult nsCrypto::GetRandomValues(const jsval&, JSContext*)’ does not match any in class ‘nsCrypto’
/home/ddahl/code/moz/mozilla-central/security/manager/ssl/src/nsCrypto.h:90:3: error: candidate is: virtual nsresult nsCrypto::GetRandomValues(jsval*, JSContext*)

Of course, this may be due to my ignorance of the types in this case...

I also have to have the function argument as a 'const jsval&' or this does not work at all.

the patch is here: https://bugzilla.mozilla.org/attachment.cgi?id=547264
>I also have to have the function argument as a 'const jsval&' or this does not work at all.

And why is that, precisely?
(In reply to comment #1)
> >I also have to have the function argument as a 'const jsval&' or this does not work at all.
> 
> And why is that, precisely?

I wish I knew. If I change it there are similar compile errors. I was following a similar component, and I assume const is not needed or desired here.
Once you do inout, your C++ function signature has |jsval*| not |const jsval&|.  That's more or less expected.  You need to fix your function definition to match the declaration.
Yeah based on the IRC conversation everything is working as expected.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.