Project

Profile

Help

Support #1845

closed

LogConfiguration error in Firefox on asynchronous callback

Added by Martynas Jusevicius over 10 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Normal
Sprint/Milestone:
-
Start date:
2013-07-16
Due date:
% Done:

100%

Estimated time:
Platforms:

Description

I was trying to handle callback from jQuery.ajax() asynchronous HTTP request in Saxon-CE.

I used the technique described by Philip here: http://saxon-xslt-and-xquery-processor.13853.n7.nabble.com/Saxon-CE-and-callback-functions-tp741p742.html

The code:

<script type="text/javascript">	    
var baseUri = 'http://localhost:8080/semantic-reports/';
function loadTypeaheadXML(query)
{
    var searchUri = UriBuilder.fromUri(baseUri).
	segment('search').
	queryParam('query', query).
	build();
    $.ajax({url: searchUri,
	headers: { 'Accept': 'application/rdf+xml', 'Authorization': 'Basic XXXXXXXXXXXXXXXXXXXXXXXX=' }
    }).
    done(function(data, textStatus, jqXHR)
    {
	ontypeaheadCallback(); // expected to invoke "ixsl:ontypeaheadCallback" template
    } ).
    fail(function(jqXHR, textStatus, errorThrown)
    {
	alert(errorThrown);
    });
}
</script>
    <xsl:template match="input[contains(@class, 'resource-typeahead')]" mode="ixsl:onkeyup">
	<xsl:call-template name="load-typeahead-xml">
	    <xsl:with-param name="query" select="@prop:value"/>
	</xsl:call-template>
    </xsl:template>
  
    <xsl:template name="load-typeahead-xml">
	<xsl:param name="query" as="xs:string"/>
	<xsl:value-of select="ixsl:call(ixsl:window(), 'loadTypeaheadXML', $query)"/>
    </xsl:template>

    <xsl:template match="ixsl:window()" mode="ixsl:ontypeaheadCallback">
	<xsl:message>CALLBACK!</xsl:message>
    </xsl:template>

When typing into input with @class 'resource-typeahead', Chrome asynchronously logs "INFO: CALLBACK!", as expected.

Firefox 22.0 throws an error instead:

SaxonCE.com.google.gwt.logging.client.LogConfiguration 16:37:49.707
SEVERE: (TypeError) 
 fileName: http://localhost:8080/semantic-reports/static/js/saxon-ce/7FFD07C49946B3F4B1DE49E72F7E85FA.cache.html
 stack: Mr@http://localhost:8080/semantic-reports/static/js/saxon-ce/7FFD07C49946B3F4B1DE49E72F7E85FA.cache.html:1685
Jr@http://localhost:8080/semantic-reports/static/js/saxon-ce/7FFD07C49946B3F4B1DE49E72F7E85FA.cache.html:60
b[a]<@http://localhost:8080/semantic-reports/static/js/saxon-ce/7FFD07C49946B3F4B1DE49E72F7E85FA.cache.html:75
@http://localhost:8080/semantic-reports/static/js/saxon-ce/7FFD07C49946B3F4B1DE49E72F7E85FA.cache.html:1912
@http://localhost:8080/semantic-reports/persons?mode=http%3A%2F%2Fclient.graphity.org%2Fontology%23InputMode:50
jQuery.Callbacks/fire@http://code.jquery.com/jquery.js:3048
jQuery.Callbacks/self.fireWith@http://code.jquery.com/jquery.js:3160
done@http://code.jquery.com/jquery.js:8235
.send/callback@http://code.jquery.com/jquery.js:8778

 lineNumber: 1685
 columnNumber: 324: a is undefined
http://localhost:8080/semantic-reports/static/js/saxon-ce/7FFD07C49946B3F4B1DE49E72F7E85FA.cache.html
Line 876

Files

firefox.xsl (836 Bytes) firefox.xsl Martynas Jusevicius, 2013-07-23 16:00
saxonce.html (1 KB) saxonce.html Martynas Jusevicius, 2013-07-23 16:00
typeahead.xml (85 Bytes) typeahead.xml Martynas Jusevicius, 2013-07-23 16:00
Actions #1

Updated by O'Neil Delpratt over 10 years ago

Hi Martynas,

Thanks for reporting the problem you have found and sorry for delay in responding to this bug issue. We are looking at it now.

Actions #2

Updated by O'Neil Delpratt over 10 years ago

Hi Martynas,

Please may you send me your files. Either on this bug issue or privately.

Thanks

Actions #3

Updated by Martynas Jusevicius over 10 years ago

Sorry, my initial sample wasn't that great. I'm attaching files of what I think is a minimal example. Still works in Chrome but gives TypeError in Firefox 22.0.

Actions #4

Updated by O'Neil Delpratt over 10 years ago

Thanks. Shortly after sending you the request for code I managed to reproduce the error and I am now investigating it.

Actions #5

Updated by O'Neil Delpratt over 10 years ago

  • Status changed from New to Rejected
  • Assignee set to O'Neil Delpratt

Hi Martynas,

I managed to get the application to work in Firefox. There is an underlying incompatibility between the browsers when it comes to event accessing. The difference is in how the event object is supplied to the function. In Firefox the event is supplied as a function parameter, whereas in other browsers we access the object via the window object, i.e. window.event@. More information is available at http://www.quirksmode.org/js/events_access.html.

In Saxon-CE, we facilitate for this problem by providing the function ixsl:event() and others which can be used as an argument in the callback. The documentation gives details of functions available when handling client system functions (See http://www.saxonica.com/ce/user-doc/1.1/index.html#!coding/system-events)

The following change to the template load-typeahead-xml seems to work, here we get access to the event object and pass it to the JavaScript function:

    <xsl:template name="load-typeahead-xml">
    <xsl:param name="query" as="xs:string"/>
    <xsl:variable name="eventi" select="ixsl:event()" />
    <xsl:value-of select="ixsl:call(ixsl:window(), 'loadTypeaheadXML', $eventi, $query)"/>
    </xsl:template>

You also need to modify your JavaScript code to pass the event object in the ontypeaheadCallback call:

function loadTypeaheadXML(event, query)
{
   ...
    ontypeaheadCallback(event); // expected to invoke "ixsl:ontypeaheadCallback" template
   ...
}
Actions #6

Updated by O'Neil Delpratt over 10 years ago

  • Tracker changed from Bug to Support
  • Status changed from Rejected to Resolved
  • % Done changed from 0 to 100

Please register to edit this issue

Also available in: Atom PDF