[webkit-dev] JavaScriptCore Binding Problem
Alex Milowski
alex at milowski.org
Wed Jan 5 19:38:56 PST 2011
I've got a new IDL class I'm working of for some "experiments in XML"
and I've run into an interesting snag. I have a call to a "parse"
method from Javascript where the string argument seems to be getting
mangled. The IDL for the method looks like:
boolean parse(in DOMString str);
and the call from javascript looks like:
reader.parse("<doc><title>I am a document</title></doc>");
Everything else about this interface & implementation works fine.
Unfortunately, for the above method, the string of XML to parse comes
in as "empty". It looks to me like things are mangled in some way but
I can't determine why.
The generated code from the IDL is:
EncodedJSValue JSC_HOST_CALL jsXMLReaderPrototypeFunctionParse(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSXMLReader::s_info))
return throwVMTypeError(exec);
JSXMLReader* castedThis = static_cast<JSXMLReader*>(asObject(thisValue));
XMLReader* imp = static_cast<XMLReader*>(castedThis->impl());
const String& str = ustringToString(exec->argument(0).toString(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = jsBoolean(imp->parse(str));
return JSValue::encode(result);
}
The 'str' object in the debugger is empty and the argument from which
it is converted has a strange string of length 1 character.
Any ideas how this could get mangled? Something is obviously stepping
on some object but I can't see where. The other possibility is
something related to JIT compiling in the Javascript environment but
that is a pure guess at this point. The backtrace shows some JIT
compile code in the stack.
--
--Alex Milowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."
Bertrand Russell in a footnote of Principles of Mathematics
More information about the webkit-dev
mailing list