The default is 'true'. When set 'false', file: and qrc: URLs are
treated as invalid (unknown scheme) rather than opening local files,
as requested in issue #12752.
In order to test this, I added a mechanism to test/run-tests.py
allowing individual tests to be annotated with command-line
options to pass to phantomjs or the script.
Unfortunately, due to Qt and WebKit limitation, this is technically
clearing all the cache used by every web page instance. It is the
best we can have right now.
https://github.com/ariya/phantomjs/issues/10357
This is available via the new property called `release`. A very simple
example to demonstrate it:
var system = require('system');
console.log('Kernel release', system.os.release);
which will print (on OS X 10.7.5 Lion):
Kernel release 11.4.2
https://github.com/ariya/phantomjs/issues/12587
This means you don't have to wait 30 seconds in between invocations of
run-tests.py.
Also, if the test server fails to bind its port, print the actual
OS-level error message rather than guessing what the problem is.
issue #12439
* correctly fake a package to hold all the response-hook modules
* use StringIO correctly in the response hooks
* prevent .py(c) files in test/www/ from being accessed directly
* prevent test/www/__init__ from being treated as a response hook
* add a test case that makes sure the existing hooks _can_ return 200 OK
(issue #12439; buggy commit 4d60e94)
If there are any positional arguments to test/run-tests.py, they are matched
(verbatim, not as regular expressions) against each test's name. Only those
tests whose names contain at least one of the positional arguments will be
run. Thus, for instance, you can run just the webpage tests with
./test/run-tests.py module/webpage
or one specific test with
./test/run-tests.py exact/name/of/test.js
or the basics and standards tests with
./test/run-tests.py basics standards
If no tests at all match, run-tests.py will print "ALL TESTS SKIPPED" and
exit unsuccessfully.
Ongoing work on issue #12439.
Rather than add all the special URLs we'll ever want to run-tests.py,
the embedded HTTP server now supports scripts in test/www/. If you
try to load http://localhost:9180/path and test/www/path doesn't exist
but test/www/path.py does, then test/www/path.py is loaded as a module.
That module must export one function, handle_request(), which is called
to produce the response.
handle_request() has the same semantics as
SimpleHTTPRequestHandler.send_head(). That is, it takes one argument,
the SimpleHTTPRequestHandler object, conventionally named 'req'.
It should call the send_response(), send_header(), and end_headers()
methods of that object as appropriate. And it should return a readable
filelike whose contents are taken as the body of the response.
If either module import or handle_request() throws any exception, the
HTTP response will be a 500 Internal Server Error with body provided
by cgitb.
Ongoing work on issue #12439.
We already have 'base_path' as a global variable, so use that (or rather,
a new derivative of that) instead of inspect.getfile(inspect.currentframe()).
Rather than splitting the path and then iterating over every component
trying to figure out if it's "special", take advantage of the fact that
posixpath.normpath() will reliably produce a path with all ../ and bare-/
components at the very beginning. Preserve the distinction between paths
with and without a trailing /, as SimpleHTTPRequestHandler expects.
So that paths containing unusual (e.g. non-ASCII, non-UTF-8) segments can
safely be tested, unquote and then requote the entire path. This means
that the *bytes* corresponding to the ASCII characters
0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz -_./
are guaranteed to be unquoted, and all other *bytes* are guaranteed to be
%-quoted. (Note especially that *whether or not* the tests are being run
on Windows, \ in the original URL will be represented as %5C, and will
*not* be treated as a pathname separator.)
So that the tests behave consistently whether or not the OS has a case-
sensitive filesystem, after the above transformation, lowercase the entire
path.
Ongoing work on issue #12439.
This means that there is no longer a need to add every individual test
to the list; only new *directories* have to be mentioned. New tests
can be added just by dropping .js files into appropriate directories.
Tests which are not meant to be run by default now live in tests/manual/.
Currently there is one such test, tests/manual/standards/ecma-test262.js,
which downloads and runs the ECMAScript conformance suite.
Ongoing work on issue #12439.
The HTTP server launched by the test runner has a new endpoint called
/echo. This simply echoes back some information (current on the made
request, in the future it will be expanded to further information)
formatted as JSON. This echo system facilitates easy testing for request
header manipulation feature.
https://github.com/ariya/phantomjs/issues/12439
The server runs on port 9180 and serves the content from test/www
directory. Any tests can use this base URL to load test content and
to exercise certain PhantomJS API.
https://github.com/ariya/phantomjs/issues/12439
The use of phantom.scriptName has been deprecated since System#args was
introduce (version 1.5, March 2012). Any old scripts need to migrate to
System#args.
https://github.com/ariya/phantomjs/issues/12529
The use of phantom.args has been deprecated (see commit 545a3f7)
since a long time ago (version 1.5, March 2012). Any old scripts
need to switch to use System#args instead.
https://github.com/ariya/phantomjs/issues/12527
This Python script serves as a master test runner. It will run each test
script with a fresh instance of PhantomJS. The exit code of each script
determines its success or failure.
The existing tests (run-tests.js) are wrapped as one of the test
scripts. This permits a gradual migration to the new test system.
https://github.com/ariya/phantomjs/issues/12439
This is to reduce maintenance burden. A GIF representation of a web
page can be produced by converting its PNG capture. There are numerous
third-party tools which can do the job better (optimized palette,
minimized loss, etc).
https://github.com/ariya/phantomjs/issues/12480
To prevent unintended macro expansion, don't use the name
stdout/stdin/stderr in the native System object. Those properties are
achieved by shadowing it in the module interface (JavaScript side).
https://github.com/ariya/phantomjs/issues/12496
Regression from #12431: the loop to clear all surviving pages
neglects to check for entries in `m_pages` which have already
been closed, fully destructed, and therefore replaced by NULL
pointers.