[webkit-dev] JavaScriptCore Binding Problem

Alex Milowski alex at milowski.org
Fri Jan 7 10:27:17 PST 2011


On Wed, Jan 5, 2011 at 7:38 PM, Alex Milowski <alex at 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("<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.

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


More information about the webkit-dev mailing list