W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2014

=[xhr]

From: Robert Hanson <hansonr@stolaf.edu>
Date: Sat, 12 Jul 2014 10:57:16 -0500
Message-ID: <CAF_YUvX7y2LpCFvoGXosKtxMggfhSNHHgNw9Lf4spfiF=ZTwqQ@mail.gmail.com>
To: public-webapps@w3.org
Hello, I am the principal developer of Jmol, which has been successfully
ported to JavaScript/HTML5 as JSmol.

The following statement at http://xhr.spec.whatwg.org/ concerns me greatly:


*Developers must not pass false for the async argument when the JavaScript
global environment
<http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#javascript-global-environment>
is a document environment
<http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#document-environment>
as it has detrimental effects to the end user's experience. User agents are
strongly encouraged to warn about such usage in developer tools and may
experiment with throwing <http://dom.spec.whatwg.org/#concept-throw> an
"InvalidAccessError <http://dom.spec.whatwg.org/#invalidaccesserror>"
exception when it occurs so the feature can eventually be removed from the
platform. *
I do understand the overall desire to not load files synchronously. I have
designed Jmol to use asynchronous file transfer whenever possible. However,
this seems rather heavy-handed, as there are situations where asynchronous
AJAX file transfer is absolutely critical. (Or convince me that is not the
case.)
JSmol is using Java2Script, which is a highly effective port of Java to
JavaScript. I have been able to reproduce all the thread-based behavior of
Jmol in HTML5 using just the one JavaScript thread, however a key component
of this system is that "Java" classes (such as java.io.OutputStream.js,
which is the JavaScript equivalent of java.io.OutputStream.java) must be
loaded on the fly. For example, a call to

 x = new java.io.ByteOutputStream(b)

must hold while java.io.ByteOutputStream.js is loaded, if this is the first
call to instantiate that class.

Q1) I don't see how that could possibly be done asynchronously. This could
easily be called from a stack that is 50 levels deep. Am I missing
something here? How would one restart an entire JavaScript stack
asynchronously?

Q2) Is there an alternative to "the main thread" involving AJAX still using
synchronous transfer?


Bob Hanson
Principal Developer, Jmol/JSmol


-- 
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Department of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
Received on Monday, 14 July 2014 17:29:24 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:26 UTC