Re: debugging XSLT in Firefox

"John J. Barton" <[email protected]> Tue, 22 May 2007 22:30:01 -0700
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Message-ID <[email protected]>
More XSLT-not-playing nice. Firebug uses event pagehide to reset its
logic in preparation for a possible new page. XSLT pages do not signal
this event. So Firebug is broken after XSLT.  I was able to fix this,
so maybe this means I know more now.

John J. Barton wrote:
> Unfortunately the only thing I learned is that after an xslt page,
> Firebug is broken for other pages as well. So after the testXSLT.xml
> page is viewed, subsequent use of Firebug on HTML pages has empty HTML 
> and DOM panels. Somehow an event handler is not being called to connect
> Firebug to the page's window.
> 
> John.
> 
> 
> Lucky wrote:
>> Sure, as it seems the test i did used those files:
>> Here, i piggy-back off the "load" event attempting to dispatch the 
>> DOMContentLoaded.
>>
>> You can also dupe out the transform, by simply renaming your .xml -> 
>> .xhtml, but that no longer works for IE browser, etc.
>>
>> Here, the contentType is being set via extension, and never listens to 
>> the content @media stuff from XSLT processing-instruction it seems.
>>
>> It's really a much bigger problem though, seeing how the Document 
>> never gets initialized as being HTMLDocument will all collections, 
>> cookies, blah, blah.
>>
>>
>>
>> John J. Barton wrote:
>>> I'd have to trace the window logic to tell you why. Do you have
>>> a simple test case (or can you modify the one in
>>> http://code.google.com/p/fbug/issues/detail?id=130
>>> ?
>>> John.
>>>
>>> Lucky wrote:
>>>> I noticed that even dispatching the DOMContentLoaded event from the 
>>>> xml+xsl transformed content would still not allow firebug to 
>>>> initialize?
>>>>
>>>>
>>>> John J. Barton wrote:
>>>>> Firebug is a Firefox Javascript debugger. I looked into why it fails
>>>>> for XSLT.  Seems like the problem is that XSLT does not signal 
>>>>> DOMContentLoaded, a known bug.  (See 
>>>>> http://code.google.com/p/fbug/issues/detail?id=130)
>>>>>
>>>>> Does XSLT signal other events, similar to nsIWebProgressListener?
>>>>>
>>>>> Are there interfaces to probe the state of the transformation?
>>>>>
>>>>> Is there someone interested in XSLT who would like help extending 
>>>>> Firebug to support it better?
>>>>>
>>>>> John.
>>>>>
>>>>> Mike wrote:
>>>>>> How do people debug their XSLT under Firefox.  I got something 
>>>>>> working
>>>>>> under xsltproc, but it fails occasionally on Firefox with the
>>>>>> following error message:
>>>>>>
>>>>>> [Exception... "Component returned failure code: 0x80600004
>>>>>> [nsIXSLTProcessor.transformToFragment]" nsresult: "0x80600004
>>>>>> (<unknown>)" location: "JS frame :: <elided> :: anonymous :: line 
>>>>>> 155"
>>>>>> data: no]
>>>>>>
>>>>>> which gives me no clue what happened.  Web searches on that error 
>>>>>> code
>>>>>> don't turn up much either.
>>>>>>
>>>>>> Is there any way to get more useful error messages, or is there a 
>>>>>> more
>>>>>> verbose version of the same XSLT engine that Firefox uses that I can
>>>>>> run my stuff against?
>>>>>>
>>>>>> thanks,
>>>>>> mike
>>>>>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> <?xml version="1.0"?>
>> <xsl:stylesheet version="1.0" 
>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>> <xsl:template match="/">
>> <html>
>> <body>
>> <script type="text/javascript">
>>   function handler(e) {
>>     var evt = document.createEvent("MutationEvents");
>>     evt.initMutationEvent("DOMContentLoaded", true, true, document, 
>> "", "", "", 0);
>>     document.dispatchEvent(evt);
>>   }
>>   window.addEventListener("load", handler, false);
>>   document.addEventListener("DOMContentLoaded", function(e) {
>>     //alert(e.type)
>>   }, false);
>> </script>
>> </body>
>> </html>
>> </xsl:template>
>> </xsl:stylesheet>