Removing the internal cache means the XHR will fall back to the browser cache
instead. Most uses don't reload the same unmodified document multiple times
within the same session, so there should be no major problems with this
approach.
* remove @license tag (to prevent Closure compiler keeping the comment)
* use copyright@kogmbh.com email address everywhere
* remove "additional permission", to be added only to released webodf.js
* separate license header by empty line from following content
UTF8 allows double-byte chars (as shown in the loop handling behaviour).
This means that it's possible for the number of chars to never be exactly
1000. E.g., a double-byte char is added after there are 999 chars. If this
happens, the char length will never flush until the function returns, at
which point too many arguments are passed into the apply invocation and
a maximum stack size error will be thrown.
There is no measurable performance from this change (tested @ 1000pages.odt)
which abstracts away browser prefixes
and simply executes the callback if it is
not supported by the browser.
Also adds cancelAnimationFrame() similarly.
Dependencies between classes are listed in the manifest.json files.
These files list what classes are required to load other classes. Yet, each eval
of a class can trigger loading of a required class. This means that the request
for a particular class is only sent out when the class that needs it is loaded.
This patch adds a new function:
runtime.loadClasses(classNames, callback);
This function creates a list of all required classes before doing any loading.
If the environment is the browser and a callback is provided, the list of files
is added as <script/> tags to the DOM. This means the browser can request all
files at once. The callback is attached to the onload trigger of the last
<script/> tag.
If no callback is provided, the files are still loaded synchronously.
runtime.loadClass is still present but redundant, since the runtime already
knows what classes are needed for other classes.
odf.html is adapted to use the new class.
This test was broken because webkit browsers report the request as a string
instead of a byte array. The string has to be converted back to a byte array
in such cases.
The manifest.json files are generated automatically from the sources by the script updateJS.js, which also runs JSLint.
Dependencies are stored in manifest.json now. This allows the loading of modules to be more efficient, since all the required modules can be determined before loading.
The type Runtime.ByteArray is removed. Uint8Array is used instead.
The more rigorous type checking is enabled by the flag --jscomp_error reportUnknownTypes.
To compile with this flag, build the target typecheck-target.
Note, this function returns the size of the file in bytes. For a string,
the length is not indicitive of the file size, therefore a lookup is required
to the server.
Though string concatenation is theoretically faster, in practice
the myriad of calls to String.fromCharCode still seems to create
a lot of waste and cause more GC cycles. Batching these up using
an array and String.fromCharCode.apply produces roughly a 30%
speed-up in most browsers when loading the 1000page.odt document.
Results from benchmark, 1000page.odt:
Chrome 31.0.1650.48
Before: 1953ms
After: 1450ms
Safari 6.1 (7537.71)
Before: 1670ms
After: 1374ms
Firefox 25.0
Before: 2056ms
After: 1722ms
and programs/editor/Translator.js which is a reference
implementations of a translator.
The programs/editor/Translator code is used entirely in
localeditor.js/collabeditor.js and the editor itself, or webodf,
and need not know anything about the translation mechanism.
Translate all strings within the editor and all
user-facing strings in webodf core itself using
runtime.tr();
MemberModel, SessionList, and OperationRouter are proxy classes which use
the server object to communicate with the server, while the server does
not always need to know about them
e.g. some server could not provide a SessionList, while another could have
that and more, while sharing the same basic server protocol.
Thus the serverfactory instance is separated from the server instance.
Even though the server says it's ok to access the Content-Length
field in a CORS request, (and Chrome & Safari work with it), Cocoa's
WebView still refuses to return the proper length.