Closed
Bug 843261
Opened 12 years ago
Closed 12 years ago
Methods with sequence<DOMString> arguments generate invalid code in callback interfaces
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla22
People
(Reporter: mccr8, Assigned: bzbarsky)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
callback interface Foo {
void passStringSequence(sequence<DOMString> arg);
};
The code produced by this does not compile:
/Users/amccreight/mz/cent/obj-dbg/dom/bindings/JSImplBinding.cpp:49:16: error: no matching function for call to 'NonVoidStringToJsval'
if (!xpc::NonVoidStringToJsval(cx, arg[i], &tmp)) {
^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/amccreight/mz/cent/js/xpconnect/src/xpcpublic.h:283:6: note: candidate function not viable: no known conversion from 'const elem_type' (aka 'const nsString') to 'nsAString_internal &' for 2nd argument;
bool NonVoidStringToJsval(JSContext *cx, nsAString &str, JS::Value *rval);
^
/Users/amccreight/mz/cent/js/xpconnect/src/xpcpublic.h:298:6: note: candidate function not viable: no known conversion from 'const elem_type' (aka 'const nsString') to 'mozilla::dom::DOMString &' for 2nd argument;
bool NonVoidStringToJsval(JSContext* cx, mozilla::dom::DOMString& str,
^
1 error generated.
On the other hand, the output from this method does compile:
void passCastableObjectSequence(sequence<Foo> arg);
Assignee | ||
Comment 1•12 years ago
|
||
From CallbackMember.getArgConversion:
if arg.type.isString():
# XPConnect string-to-JS conversion wants to mutate the string. So
# let's give it a string it can mutate
# XXXbz if we try to do a sequence of strings, this will kinda fail.
Assignee | ||
Comment 2•12 years ago
|
||
So one interesting option is to just add non-mutating version of NonVoidStringToJsval and whatnot that take a const string and make sure to deal accordingly...
Assignee | ||
Comment 3•12 years ago
|
||
of non-const strings, but I think that's OK now that we're mostly
autogenerating this stuff
Attachment #718855 -
Flags: review?(peterv)
Assignee | ||
Updated•12 years ago
|
Assignee: nobody → bzbarsky
Assignee | ||
Updated•12 years ago
|
Whiteboard: [need review]
Updated•12 years ago
|
Attachment #718855 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 4•12 years ago
|
||
Flags: in-testsuite+
Whiteboard: [need review]
Target Milestone: --- → mozilla22
Comment 5•12 years ago
|
||
Unfortunately, I had to backout because something in this push caused a spike in mochitest-a11y assertions.
https://hg.mozilla.org/integration/mozilla-inbound/rev/fb572a342efa
https://tbpl.mozilla.org/php/getParsedLog.php?id=20189591&tree=Mozilla-Inbound
A quick skim of the log shows them to be of the type:
###!!! ASSERTION: bad size recorded: 'aInstanceSize == 0 || entry->GetClassSize() == aInstanceSize', file ../../../xpcom/base/nsTraceRefcntImpl.cpp, line 441
Assignee | ||
Comment 6•12 years ago
|
||
That wasn't due to this patch. Repushed: https://hg.mozilla.org/integration/mozilla-inbound/rev/38578014b8a8
Comment 7•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•