[webkit-qt] jsMath behavior different on win vs. linux

Kent Hansen kent.hansen at nokia.com
Mon Apr 12 09:23:25 PDT 2010


Hi Nathan,
Prepending file:// to JSMATH_PATH makes the script load for me at least.
evaluateJavaScript() doesn't know how to return JS object references; 
you get an invalid variant. evaluating "jsMath.toString()" proves that 
the object is loaded (returns "[object Object]").

Regards,
Kent


ext Carter, Nathan wrote:
> Hello again.
>
> Following up on last night's exchange, I'm having trouble even getting a simple webkit instance to run jsMath.  I'm not sure why this is the case, because
>
> 1) I have it working in a more complex arrangement in my actual application (which makes several different timed calls to JavaScript routines in the webview), and
>
> 2) the same HTML I use here works fine in Safari, for example.  However, it does not work in Chrome.  It's very basic, and follows the jsMath documentation.
>
> Source code (single main.cpp file) appears at the end of this message.  To build, run qmake -project, edit project to add CONFIG += console if you want (and CONFIG -= app_bundle on Mac), qmake, make.
>
> Other difficulties include that different versions of jsMath yield different results on this same HTML content:
> 	jsMath	Safari	Chrome	Firefox	(all on Mac OS X, latest versions)
> 	3.6c	works	fails*	works
> 	3.6d	works	fails*	fails*
> 	3.6e	fails*	fails*	fails*
> *fails == does not process the mathematics.  In each browser, the error is different, but since this is not a jsMath email list, I'll spare you the details.
>
> Any idea what's going wrong here, or with these inconsistencies?  Specifically, why doesn't jsMath even load?  I've tried adding these lines, to make it easier to tinker with what's going wrong in the web view's JavaScript environment, but it brings up a completely blank, gray window (no inspector to be seen).
>     QWebInspector wi;
>     wi.setPage( wv.page() );
>     wi.show();
>     wi.raise();
>
> Nathan
>
>
>
> #include <QApplication>
> #include <QWebView>
> #include <QWebFrame>
> #include <QDebug>
>
>
> #define JSMATH_PATH "/Users/nathan/download/jsMath-3.6c"
> #define HTML_CONTENT "<HTML>\n" \
>                      "    <HEAD>\n" \
>                      "        <SCRIPT SRC='%1/easy/load.js'></SCRIPT>\n" \
>                      "    </HEAD>\n" \
>                      "    <BODY>\n" \
>                      "        <DIV class='math'>\n" \
>                      "            \\int_0^1 xe^x\\;dx\n" \
>                      "        </DIV>\n" \
>                      "    </BODY>\n" \
>                      "</HTML>\n"
>
>
> int main ( int argc, char** argv )
> {
>     QApplication app(argc,argv);
>     QWebView wv;
>     QString html = QString( HTML_CONTENT ).arg( JSMATH_PATH );
>     qDebug() << html; // prints expected content
>     wv.setHtml( html );
>     wv.show();
>     wv.raise();
>     app.exec();
>     qDebug() << wv.page()->mainFrame()->evaluateJavaScript( "jsMath" ).toString();
> 		// prints empty string, as if jsMath still undefined
> 		// note that this is after a pause, when quitting the app
> 		// so there has been plenty of time for jsMath to load!
> }
>
> _______________________________________________
> webkit-qt mailing list
> webkit-qt at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt
>   



More information about the webkit-qt mailing list