156 Commits
Author SHA1 Message Date
Jos van den Oever 6134b1c2a1 Add xmled package to build system.
This includes adding a missing declaration to externs.js.
2015-06-07 20:25:02 +02:00
Jos van den Oever b8ad5b3889 Upgrade to Closure Compiler 20150505.
We are now using our own copy of the externs to deal with differences
of opinion on best typing of types.
2015-06-01 08:53:35 +02:00
Friedrich W. H. Kossebau 6fa1f56f05 Move HTML rendering of logging out of normal BrowserRuntime 2015-03-14 01:37:32 +01:00
Friedrich W. H. Kossebau 5a2db9c1ac Handle a possible BOM in Runtime.byteArrayToString for utf-8 2015-03-14 01:27:01 +01:00
Philip Peitsch 0c3e7034fc Remove now-unused runtime.getFileSize function 2014-09-11 15:03:43 +10:00
Philip Peitsch 7f50cdc093 Remove now-unused runtime.isFile function 2014-09-11 15:02:02 +10:00
Philip Peitsch 9e0aa08780 Remove cache from browser runtime
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.
2014-09-11 12:07:03 +10:00
Philip Peitsch 3314898d68 Standardize all runtime assert implementations 2014-08-14 21:49:27 +10:00
Philip Peitsch 93537740ac Remove unused 3rd parameter of runtime.assert
This 3rd callback parameter is never used inside the current WebODF
source.
2014-08-14 21:29:46 +10:00
Philip Peitsch e03622d68b Make browser assertions throw a proper Error type instead of a string
Error objects can have stack traces and other things to make diagnosing
asserts easier.
2014-08-14 21:29:45 +10:00
Philip Peitsch 63bc7d3e5e Provide hook to prevent alerts from being shown when logging 2014-08-14 21:29:44 +10:00
Friedrich W. H. Kossebau 0e3b468ad5 Dump //@ sourceURL= variant, use just //# sourceURL=
For some versions of firefox and chromium they support //# now,
and on debugging all the deprecated warnings at least with firefox
are annoying
2014-08-07 11:19:43 +02:00
Friedrich W. H. Kossebau 1e2a4a8323 Normalize license headers of the webodf.js source files
* 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
2014-06-02 12:19:05 +02:00
Philip Peitsch da30864de8 Fix crash in utf8ByteArrayToString when opening UTF8 heavy docs
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)
2014-04-14 19:27:40 +10:00
Friedrich W. H. Kossebau 97ff04b0a7 make Webodf version a global property on the new namespace webodf 2014-04-11 15:05:07 +02:00
Aditya Bhatt cd4a39b9d6 Remove unnecessary @param declaration from
the Rhino runtime's cancelAnimationFrame.
2014-03-04 13:56:33 +01:00
Aditya Bhatt e60be56431 Implement runtime.requestAnimationFrame()
which abstracts away browser prefixes
and simply executes the callback if it is
not supported by the browser.

Also adds cancelAnimationFrame() similarly.
2014-03-03 22:46:51 +01:00
Friedrich W. H. Kossebau 157a9613fa Fix broken automatic loading of manifest.json at script location when executing runtime
* Fix extracting the path from a script passed as arg to runtime
* Allow failing on trying to load a manifest file from the current directory
2014-02-17 17:19:46 +01:00
Philip Peitsch f578153a8d Improve diagnostics output if class definitions are missing 2014-02-15 00:39:43 +11:00
Jos van den Oever 613bb51a5d Use clearer names for the functions that load the dependencies. 2014-02-07 15:38:09 +01:00
Jos van den Oever df645071b7 Add comments and better browser detection. 2014-02-07 15:38:09 +01:00
Jos van den Oever a637eb31bf Add support for asynchronous loading of classes.
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.
2014-02-07 15:38:09 +01:00
Friedrich W. H. Kossebau d2671e2a00 @returns -> @return 2014-01-31 15:33:43 +01:00
Jos van den Oever 1bfd1af795 Only load a class if it has not yet been defined. 2013-12-18 09:03:09 +01:00
Friedrich W. H. Kossebau efcf964df3 Workaround possible parallel calls to runtime's loadManifest(dir, manifests) 2013-12-16 23:46:29 +01:00
Jos van den Oever 5703d17248 Fix unit test for reading a utf-8 file as binary.
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.
2013-12-11 12:53:32 +01:00
Jos van den Oever 9984265c10 Make odf.OdfCanvas 100% typed. 2013-12-02 13:01:56 +01:00
Jos van den Oever dfec9ee62e Use manifest.json instead of manifest.js
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.
2013-11-29 18:33:17 +01:00
Jos van den Oever dedf020d71 Avoid loading classes more than once. 2013-11-26 18:29:27 +01:00
Jos van den Oever 3d36212d9f Fix bug in runtime: manifest is now loaded only once per directory. 2013-11-26 16:56:01 +01:00
Jos van den Oever d39d255824 Make typed compilation standard for the js files that are 100% types. 2013-11-26 16:56:00 +01:00
Jos van den Oever 2ccfde5fa4 Simplify loading of classes.
runtime.js is now 100.0% typed. The contents of packages.js moves to runtime.js. manifest.js files now use JSON format.
2013-11-26 16:56:00 +01:00
Jos van den Oever 2ac6736d41 Make Runtime play a bit nicer with closure compiler. 2013-11-26 16:55:59 +01:00
Jos van den Oever 9d5b061734 Whitespace cleanup. 2013-11-26 16:55:00 +01:00
Jos van den Oever 0a215ff0f1 Fix more types in runtime.js.
There are still a number of tough type situations involving eval left over.
2013-11-26 16:55:00 +01:00
Jos van den Oever 81112e6532 Add more type checking for the IE workaround code. 2013-11-22 18:32:21 +01:00
Jos van den Oever aa50928233 Pass Uint8Array directly into Buffer constructor. 2013-11-22 18:32:21 +01:00
Jos van den Oever 1013d63a3e Add fallback for loading in IE. 2013-11-22 18:32:21 +01:00
Jos van den Oever 49a25d7c5c Fix loading of files via XHR. 2013-11-22 18:32:20 +01:00
Jos van den Oever 83982c5059 More type fixes.
This patch also contains quite some cleanups and reorganization in runtime.js.
2013-11-22 18:32:20 +01:00
Jos van den Oever 29b04dbbd3 Update Closure compiler and more typechecking.
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.
2013-11-22 18:32:20 +01:00
Philip Peitsch cb9b666fb1 Use the cached data if possible when finding the file size of a path
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.
2013-11-22 00:50:47 +11:00
Philip Peitsch 3c7eabb1cd Reduce GC load by batching calls to String.fromCharCode
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
2013-11-18 23:37:27 +11:00
Aditya Bhatt 6a4f0e69ab Add translations support to runtime.js,
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();
2013-11-05 18:38:41 +01:00
Friedrich W. H. Kossebau c2a795e668 Update link to repo: now https://github.com/kogmbh/WebODF/ 2013-10-23 18:20:30 +02:00
Friedrich W. H. Kossebau 508570dab8 Add copy of the AGPL3 to sources (+ add to created zip files) 2013-10-21 17:55:16 +02:00
Friedrich W. H. Kossebau f2b56083e6 add a ops.Server interface + a ServerFactory interface, move Nowjs-based server stuff into programs/editor/server/nowjs
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.
2013-08-28 16:33:49 +02:00
Friedrich W. H. Kossebau 9e1f0ce990 Do not reuse var name "document" in RhinoRuntime.loadXML() 2013-08-12 21:39:28 +02:00
Friedrich W. H. Kossebau 27d2663f4b Add more types to API documentation of odf.* 2013-08-12 18:50:14 +02:00
Philip Peitsch a653bb3539 Workaround a CORS bug in Cocoa's WebView on OSX10.8
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.
2013-07-25 13:29:20 +02:00