Appendix C Tests
In order to better understand how LibreJS works, you can try to visit
these pages with LibreJS installed and enabled and see how they are
being processed:
- http://lduros.net/assets/librejs/tests/trivial-inline-trivial-external/
This page contains trivial on-page JavaScript code, and an external
script that contains trivial JavaScript code. Therefore, all JavaScript
is being executed.
- http://lduros.net/assets/librejs/tests/trivial-inline-nontrivial-external/
The on-page script here is trivial and uses a built-in method, but the
external script in this page is nontrivial (defines a function.) The
external script is blocked, the inline script is executed.
- http://lduros.net/assets/librejs/tests/nontrivial-inline-trivial-external/
This page contains nontrivial code on page, and trivial code in its
external page. All JavaScript is removed from the page, and the
external script is never analyzed, since the nontrivial conditions are
already met in the page.
- http://lduros.net/assets/librejs/tests/free-inline-free-external/
This page contains free on-page (GPL 3) JavaScript, and free external
Javascript. Therefore all JavaScript is being executed.
- http://lduros.net/assets/librejs/tests/free-inline-nonfree-nontrivial-external/
This page contains free on-page JavaScript. The external script contains
nonfree nontrivial JavaScript (AJAX request). The free code that is
inline is executed, but the external file is blocked.
- http://lduros.net/assets/librejs/tests/intrinsec-event/ This page
contains trivial on-page code, with an intrinsic event in an html
attribute (onload). All JavaScript is being executed.
- http://lduros.net/assets/librejs/tests/trivial-inline-free-external-defines-function/
This page contains on-page trivial JavaScript (only makes a window alert
and loads an external script using the html <script> tag with the src
attribute. The external script is free (GPL v3), and since it is only
nontrivial because it defines a function, the on-page trivial code is
allowed to use it. All JavaScript is being executed.
- http://lduros.net/assets/librejs/tests/trivial-inline-free-external-writes-script/
This page contains trivial on-page JavaScript code, and loads an
external script that is free. Since no function is defined, the external
script is being analyzed. The external script is free. Trivial here is
not allowed because the external script, although free, writes a
script. The inline trivial script should also have a free license notice
for it to be interpreted.
- http://lduros.net/assets/librejs/tests/shelltypist/demo/real-life-example-with-jquery-free.html
This is a real-life example of a small jQuery plugin. The on-page
JavaScript code has a free license. The jQuery external file has a free
licensed. The shelltypist.js file has a free license as well. All
licenses are defined between
@licstart
and @licend
. All
JavaScript is executed.
- http://lduros.net/assets/librejs/tests/shelltypist/demo/same-page-without-free-license.html
This is the same page than the previous example, except it does not have
a free license for the main HTML page on-page script. While the actual
code there is trivial, since jQuery defines methods that make use of
AJAX, trivial code is not allowed, and no JavaScript is executed.
- http://lduros.net/assets/librejs/tests/test-labels/ This page
contains JavaScript (jQuery minified) that does not have proper license
information in the file, as it has no
@licstart
@licend
comment. It would be considered nonfree, however, the page itself uses
the JavaScript Web Labels method. On the page itself, you will find a
link labeled “JavaScript License Information”, which leads to a page
that contains a properly formatted table with the required data on the
external JavaScript file. LibreJS visits this link and determines the
version of jQuery linked from the original page is the one listed there,
and flags it as free. All JavaScript is executed (and the title should
turn green.)