Re: [webkit-dev] JavaScriptCore Binding Problem

2011-01-07 Thread Alex Milowski
On Wed, Jan 5, 2011 at 7:38 PM, Alex Milowski a...@milowski.org wrote:
 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(doctitleI 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.

Just as an experiment, I set a breakpoint in the Javascript debugger
inside Safari and found another interesting data point.  The code in
the test case goes from the source:

   window.onload = function() {
   var xml = doc/;
   reader.parse(xml);
   }

to this displayed in the inspector when the breakpoint is hit:

   window.onload = function() {
   var xml = ;
   reader.parse(xml);
   }

That's very strange.  Any ideas of what to look at here?  Could the
JIT compiler for JavascriptCore be dropping/mangling the string
constant somehow?

-- 
--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
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] JavaScriptCore Binding Problem

2011-01-07 Thread Alex Milowski
Completely embarrassing ... but it is an XHTML file and so the markup
in the string gets parsed unless I escape it ...

*sigh*  Too many hours wasted in the debugger on this one. :(

So, it is a non-issue.   Thanks to Evan Martin for pointed that out.

-- 
--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
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


[webkit-dev] JavaScriptCore Binding Problem

2011-01-05 Thread Alex Milowski
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(doctitleI 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_castJSXMLReader*(asObject(thisValue));
XMLReader* imp = static_castXMLReader*(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
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev