Compare commits

...

731 Commits

Author SHA1 Message Date
Vitaliy Filippov 2c0316f07d always use fontconfig 2015-02-15 12:57:28 +03:00
Vitaliy Filippov cef6c84e00 Make qphantom platform plugin static and adjust build scripts 2015-02-15 12:39:07 +03:00
Vitaliy Filippov f37c7e29e0 Remove QT source and make phantomjs compile with unmodified QT, fix binary encoding of web response 2015-02-07 01:48:33 +03:00
Ariya Hidayat d3cd0599c8 Issue #12897: README is updated with 2.0 info. 2015-01-31 21:13:44 -08:00
Ariya Hidayat a2912c216d Set version from `2.0.0-development` to `2.0.0`.
https://github.com/ariya/phantomjs/issues/12897
2015-01-23 18:19:52 -08:00
Ariya Hidayat 0352ddb502 Version 2.0.0: initial cut at the ChangeLog.
https://github.com/ariya/phantomjs/issues/12897
2015-01-23 17:00:59 -08:00
Paul Millar 05d7e3e77d remove hardcoded "PhantomJS is launching GhostDriver..." message
Apart from being undesirable that debugging messages are always
written to stdout, the information is redundant as a similar message
is logged at debug level.

https://github.com/ariya/phantomjs/issues/12681
2015-01-09 07:41:48 -08:00
Andrey Plotnikov cf246eb853 Cast maxDiskCacheSize to qint64 to allow disk cache be more than 2Gb.
https://github.com/ariya/phantomjs/issues/12303
2014-12-18 09:16:38 -08:00
Jacek Migdal 806da21e2b Fix passing date as argument to page.evaluate().
https://github.com/ariya/phantomjs/issues/12615
2014-12-11 20:43:46 -08:00
Jacek Migdal 32d20b4aa7 Port more tests from webpage-spec.
https://github.com/ariya/phantomjs/issues/12439
2014-12-11 20:38:35 -08:00
Jacek Migdal 0bf14a3d0c Don't rely on JSON.parse() for page.evaluate().
https://github.com/ariya/phantomjs/issues/12615
2014-12-10 22:53:53 -08:00
Jacek Migdal 3b8282cb2e Port the tests from webpage-spec.js
Callback, clip-rect, confirm, object, prompt, scroll-position,
viewport-size and window.

https://github.com/ariya/phantomjs/issues/12439
2014-12-07 16:59:11 -08:00
Zack Weinberg 50ae50e871 Add a command-line option --local-urls={true,false}
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.
2014-11-21 15:51:35 +00:00
Vitaly Slobodin a65a487d99 Fix invalid directory path for Windows.
https://github.com/ariya/phantomjs/issues/12715
2014-11-16 17:02:26 -08:00
Vitaly Slobodin 12870d90ad Fix JPG image rendering.
To pass QString as a const char* we should call <QString>.toLocal8Bit().constData().

https://github.com/ariya/phantomjs/issues/12684
2014-11-14 08:22:52 -08:00
Ariya Hidayat eddb0db1d2 Port the tests for mousedown, mouseup, and mousemove events.
https://github.com/ariya/phantomjs/issues/12439
2014-10-10 06:40:42 -07:00
Ariya Hidayat 619225b1da Port the tests of keyup, keydown, and keypress events.
https://github.com/ariya/phantomjs/issues/12439
2014-10-09 07:16:59 -07:00
Ariya Hidayat ce66f290c3 Port the test of web page's zoom factor.
https://github.com/ariya/phantomjs/issues/12439
2014-10-08 06:51:16 -07:00
Ariya Hidayat 2cbb695490 Port the tests of the web page's setContent().
https://github.com/ariya/phantomjs/issues/12439
2014-10-02 22:31:49 -07:00
Ariya Hidayat bad1fee468 README: Note on PhantomJS 2.
https://github.com/ariya/phantomjs/issues/10448
2014-10-01 20:17:07 -07:00
Ariya Hidayat b68d9467a7 Port the tests of the cookiejar module.
https://github.com/ariya/phantomjs/issues/12439
2014-09-30 22:00:53 -07:00
Ariya Hidayat a5f0ff7433 Port the test for console.log multiple arguments.
https://github.com/ariya/phantomjs/issues/12439
2014-09-29 21:29:44 -07:00
Ariya Hidayat 7e8986cd3e Port test tests of CJK codecs.
https://github.com/ariya/phantomjs/issues/12439
2014-09-28 22:39:20 -07:00
Ariya Hidayat 7bcb9a8725 Add a test to demonstrate the problem with JSON-ification.
https://github.com/ariya/phantomjs/issues/12615
2014-09-27 13:22:12 -07:00
Ariya Hidayat 5768b705a0 Implement clearMemoryCache() on a web page to clear the cache.
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
2014-09-25 07:09:33 -07:00
Ariya Hidayat 105bcb32a9 Fix the mismatch of test files and their contents.
https://github.com/ariya/phantomjs/issues/12439
2014-09-24 21:49:26 -07:00
Ariya Hidayat 51d5835942 System#os.version workaround for new(er) OS X versions.
In case Qt doesn't provide the information yet, deduce it from the OS
kernel version (e.g. 14.x.y for OS 10.10 Yosemite).

https://github.com/ariya/phantomjs/issues/12579
2014-09-23 07:51:36 -07:00
Ariya Hidayat 72c53b5476 System#os.version should know OS 10.9 Mavericks.
https://github.com/ariya/phantomjs/issues/12579
2014-09-22 20:46:51 -07:00
Ariya Hidayat 639e09bd3a Provide OS kernel version in system.os.
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
2014-09-21 23:47:57 -07:00
Ariya Hidayat 7c61f8857d Port the tests of web page properties and functions.
https://github.com/ariya/phantomjs/issues/12439
2014-09-18 23:17:21 -07:00
Ariya Hidayat b36da277e9 Port the user agent test.
https://github.com/ariya/phantomjs/issues/12439
2014-09-17 21:57:42 -07:00
Ariya Hidayat 9c7753189f Speed-up the tests by reducing some time-outs.
Running all tests should finish in 22 seconds instead of 41 seconds.

https://github.com/ariya/phantomjs/issues/12439
2014-09-16 20:43:10 -07:00
Zack Weinberg 4d4aa42c94 Set SO_REUSEADDR on the test server's listening port.
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
2014-09-16 21:00:52 +00:00
Zack Weinberg 3d4f89b41e Bug fixes to test-server Python response hook support.
* 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)
2014-09-16 20:56:27 +00:00
Ariya Hidayat 2e8f0e8f68 Minor test runner clean-up.
Unused imports are removed.
Ensure that the correct reference is used.

https://github.com/ariya/phantomjs/issues/12439
2014-09-15 21:38:36 -07:00
Zack Weinberg 767494dc35 Add support for selective test execution.
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.
2014-09-15 16:21:25 +00:00
Zack Weinberg 4d60e9450d Support Python scripts in test/www/.
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.
2014-09-15 16:21:17 +00:00
Zack Weinberg 2b2d52e343 Improvements to logic in FileHandler.translate_path.
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.
2014-09-15 16:21:04 +00:00
Zack Weinberg 1adbbe4830 Support globs in run-tests.py#TESTS.
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.
2014-09-15 16:17:27 +00:00
Ariya Hidayat 83f4baf8c6 Port the test to check for plugin non-existence.
https://github.com/ariya/phantomjs/issues/12439
2014-09-14 09:35:41 -05:00
Ariya Hidayat f85238322e Port the test to change the encoded URL of network request.
https://github.com/ariya/phantomjs/issues/12439
2014-09-13 20:00:21 -05:00
Ariya Hidayat 3b972fbfbb Port the test to change the URL of network request.
https://github.com/ariya/phantomjs/issues/12439
2014-09-12 23:29:40 -05:00
Ariya Hidayat dca6f77a36 Port the test for onRepaintRequested handler.
https://github.com/ariya/phantomjs/issues/12439
2014-09-11 09:57:07 -07:00
Ariya Hidayat d52df7a1cf Port the test to abort network request.
https://github.com/ariya/phantomjs/issues/12439
2014-09-11 09:57:03 -07:00
Ariya Hidayat f95ef19fcb Port the test to check for resource received upon error.
https://github.com/ariya/phantomjs/issues/12439
2014-09-10 21:29:07 -07:00
Ariya Hidayat f29b76bb7f Port the test for resource request error handling.
https://github.com/ariya/phantomjs/issues/12439
2014-09-09 23:08:16 -07:00
Ariya Hidayat 804f61bcf5 Speed-up the tests: default auto-exit timeout is set to 1 second.
This reduces the total test duration from 72 seconds to 54 seconds.

https://github.com/ariya/phantomjs/issues/12439
2014-09-08 08:04:06 -07:00
Ariya Hidayat f20835735c Port custom headers testing of web page.
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
2014-09-07 21:13:59 -07:00
Ariya Hidayat 2c10f6095b Port loading tests of web page.
https://github.com/ariya/phantomjs/issues/12439
2014-09-06 22:58:02 -07:00
Ariya Hidayat 784a06c3a7 The test runner also launches an HTTP server.
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
2014-09-05 21:31:38 -07:00
Vitaly Slobodin 235d072db5 Cast malloc to wchar_t. This is required in C++.
https://github.com/ariya/phantomjs/issues/12543
https://github.com/ariya/phantomjs/issues/12236
2014-09-05 06:32:45 -07:00
Zack Weinberg ab2e4788c6 Set the terminate handler to std::abort. (#12541) 2014-09-04 15:45:19 -04:00
Ariya Hidayat e8598a849e Port the tests of JavaScript's date parsing.
https://github.com/ariya/phantomjs/issues/12439
2014-09-04 08:28:45 -07:00
Ariya Hidayat 729f12c7d8 Port the tests for error handling.
https://github.com/ariya/phantomjs/issues/12439
2014-09-03 23:15:11 -07:00
Ariya Hidayat c883a80caf Port a few basic tests of global objects.
https://github.com/ariya/phantomjs/issues/12439
2014-09-02 22:28:53 -07:00
Ariya Hidayat 3274001e07 Remove the deprecated phantom.scriptName.
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
2014-09-01 08:11:28 -07:00
Ariya Hidayat 6c6059fd91 Remove the deprecated phantom.args.
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
2014-08-31 10:05:19 -07:00
Zack Weinberg f4eb3645f2 Make ciphersuite selection configurable; match Chromium by default. (#12524)
New option --ssl-ciphers takes a colon-separated list of OpenSSL
cipher names and sets the client cipher list to exactly that list.

The default for this option is arranged to match Chromium 35, which
has had its cipher selection optimized for the modern Web
(see https://briansmith.org/browser-ciphersuites-01.html for
rationales).  (Newer versions are the same except that they also add
ChaCha20-based ciphersuites, which OpenSSL 1.0.1 hasn't yet picked up.)
2014-08-30 20:49:58 -04:00
Zack Weinberg e8cddbfe7b Enable support for modern SSL (#12524).
* --ssl-protocol= option now accepts 'tlsv1.2', 'tlsv1.1', 'tlsv1.0'
   and 'default' as well as the existing 'tlsv1', 'sslv3', and 'any'.

 * The default is now none of the above, but rather QSsl::SecureProtocols,
   which means "whatever subset of ANY is still considered secure and also
   supported by the OpenSSL library in use".  (As of this writing, Qt's idea
   of "still considered secure" includes everything from SSLv3 on up, which
   is technically wrong -- SSLv3 has known breaks -- but we can live with.
   Qt currently doesn't have a way to select "TLSv1.0 and up".)
2014-08-30 20:49:38 -04:00
Ariya Hidayat 488a130799 A true OS X build fix for CrashHandler.
As suggested by ZackW.

https://github.com/ariya/phantomjs/issues/12236
2014-08-30 09:14:07 -07:00
Zack Weinberg 9afcf3c23d Explicitly suppress video and audio when building QtWebkit. (#12518)
This mostly matters when system sqlite is selected; that has the side
effect of enabling pkg-config which in turn causes QtWebkit to detect
the presence of system GStreamer and/or QtMultimedia and turn video on.
This way, the build is consistent across the board.
2014-08-30 07:02:21 -07:00
Zack Weinberg c64b1c078c More adjustments to system library usage on Unix (incl. Darwin) (#12518).
The affected libraries are fontconfig, freetype, harfbuzz, libpng, libjpeg,
sqlite, pcre, and zlib.

* On Darwin, by default, fontconfig is disabled and all of the other
  libraries are bundled.
* On non-Darwin, by default, fontconfig is enabled and system-provided
  freetype, libpng, libjpeg, and zlib are used.  Harfbuzz, pcre, and sqlite
  continue to be bundled.

* Individual libraries from the above list may now be enabled or disabled
  on the build.sh command line with e.g. --freetype=system or
  --freetype=bundled.

* The existing --system-qtdeps, --system-qt, --system-qtwebkit options
  have been renamed --qtdeps=system, --qt=system, --qtwebkit=system
  respectively.  New option --qtdeps=bundled forces all available
  bundled libraries to be used.

Also:

* Slight adjustments to organization of preconfig.sh.
* Can now disable PulseAudio and ALSA.
* Directly link OpenSSL instead of loading it at runtime.
* Clarify the pkg-config situation (it must be enabled if and only if
  sqlite comes from the system).
2014-08-30 07:02:21 -07:00
Zack Weinberg 0693711b0a Make it possible to disable ALSA and PulseAudio in qtbase. (#12518)
Cherry-picked configure script changes from upstream Qt5.3.
2014-08-30 07:02:21 -07:00
Ariya Hidayat a680ed41b2 Temporary OS X build fix for CrashHandler.
https://github.com/ariya/phantomjs/issues/12236
2014-08-29 21:40:02 -07:00
Zack Weinberg 858972e7ef Convert Utils into a namespace and remove dead code.
Post-cleanup for #12236.
2014-08-28 11:42:09 -04:00
Zack Weinberg 2ab57b875e Improve handling of crash dumps (issue #12236).
* If the environment variable PHANTOMJS_DISABLE_CRASH_DUMPS
   is set to any value, do not initialize Breakpad.

 * On Mac and Linux, if the environment variable TMPDIR is set,
   put the crash dumps there instead of in /tmp.

 * On Windows, %TEMP% was already being honored, but streamline
   the code for that.

 * Move the code that initializes Breakpad, and the code to print
   the crash messages, to their own module (src/crashdump.{h,cpp})
   and RAII class (CrashHandler).

 * Better wording of the crash message, particularly in the case where
   Breakpad failed to write a minidump file; update URL of crash-reporting
   guide.

 * Generally less repetitive code.  (Still way too many #ifdefs.)
2014-08-28 11:41:50 -04:00
Ariya Hidayat 2c0364b082 Port the tests of 'system' module.
https://github.com/ariya/phantomjs/issues/12439
2014-08-27 22:57:13 -07:00
Ariya Hidayat 7317724723 Fix consistent crash on OS X when rendering to PDF format.
By implementing a dummy platform native interface (for now, it may be
extended in the near future), QPlatformPrinterSupportPlugin will avoid
the path of loading the printer support plugin
(QCocoaPrinterSupportPlugin on OS X).

Related upstream bug (QCocoaPrinterSupportPlugin problem with static build):
https://bugreports.qt-project.org/browse/QTBUG-33109

https://github.com/ariya/phantomjs/issues/12500
2014-08-26 23:25:01 -07:00
Ariya Hidayat 4bc91b1bf0 A revamped test runner.
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
2014-08-25 21:13:32 -07:00
Ariya Hidayat 3a9fc49679 Enable even more tests (to 322 specs).
https://github.com/ariya/phantomjs/issues/10448
2014-08-24 20:24:39 -07:00
Ariya Hidayat 0cd703085d Reenable some more tests.
Now that the failing tests are isolated (among other, PDF crashing of
https://github.com/ariya/phantomjs/issues/12500), more tests should be
enabled. Going from 270 specs to 316 specs.

https://github.com/ariya/phantomjs/issues/10448
2014-08-24 20:00:04 -07:00
Ariya Hidayat 5ec80ff09c Enable more system module tests.
https://github.com/ariya/phantomjs/issues/12496
2014-08-24 19:33:53 -07:00
Ariya Hidayat 8cabfed4b3 Remove GIF format for screen capture export (render).
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
2014-08-23 09:20:20 -07:00
Ariya Hidayat 51c8c9cc62 Fix OS X stdout, stdin, and stderr.
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
2014-08-22 07:56:40 -07:00
Milian Wolff 9e832a1569 Disable the phantom QPA on Windows.
It cannot, nor should it, be selected on windows machines. There, we
stick to the Windows QPA which is required to get a lot of things up
and running, like an eventloop, socket integration etc. pp.

There was code in the phantom QPA to make it compile, but it never
actually worked since a lot of things where missing (such as
instantiating QWindowsContext among others).

https://github.com/ariya/phantomjs/issues/12494
2014-08-22 16:35:26 +02:00
Vitaliy Slobodin 22e74549a3 Disable colorized output in tests on Windows.
https://github.com/ariya/phantomjs/issues/12484
2014-08-20 20:57:09 -07:00
Marcel Duran 3be7005a17 run-jasmine example: Ensure exit code is always returned.
https://github.com/ariya/phantomjs/pull/12486
2014-08-20 20:56:15 -07:00
Zack Weinberg 1e7829db97 Fix crash on exit if pages have been closed (#12482)
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.
2014-08-20 14:38:45 -04:00
Ariya Hidayat b5626bff97 Add a simple test for exit behavior.
https://github.com/ariya/phantomjs/issues/12431
https://github.com/ariya/phantomjs/issues/12439
2014-08-20 05:51:19 -07:00
Milian Wolff a9809996b1 Stop processing of JavaScript after phantom.exit().
This code:

    console.log("Hello World!");
    phantom.exit();
    console.log("Meh, noone should see me!");

currently produces this unexpected output:

    Hello World!
    Meh, noone should see me!

This patch fixes it to only output the first line, by loading a blank
page on phantom.exit(). Direct deletion of the web page can trigger
crashes, so this is a safe workaround.

https://github.com/ariya/phantomjs/issues/12431
2014-08-20 05:50:30 -07:00
Ariya Hidayat 77c47044cf Remove misc references to CoffeeScript.
https://github.com/ariya/phantomjs/issues/12410
2014-08-19 20:37:06 -07:00
Artem 5e018bd650 Update sleepsort.js
https://github.com/ariya/phantomjs/pull/12344
2014-08-19 20:35:06 -07:00
Ariya Hidayat a6f6130767 Travis CI can't build PhantomJS anymore.
https://github.com/ariya/phantomjs/issues/11880
2014-08-19 20:30:22 -07:00
Zack Weinberg 26934f32a9 Add a -v/--verbose option to run-tests.{sh,js}.
The newer ConsoleReporter is very quiet by default, which is nice, but
this provides a way to get something more like the older one-line-per-test
output.

 #12230 (Test suite improvements).
2014-08-19 20:24:28 -07:00
Zack Weinberg b524d53d36 Add ability to run tests selectively.
* Anything on the command line after "run-tests.sh" will be understood
   as a regular expression (if there is more than one argument, they are
   concatenated, with spaces in between) and only the tests whose "full
   names" match that regexp will be run.  The full name of a test is the
   "describe" string plus a space plus the "it" string.  Note well that,
   unlike the test-runner output, there is no colon in there.

 * run-tests.sh and run-tests.js now correctly handle being invoked from
   an arbitrary directory; the cwd does not have to be the project root.

 * Shell portability fixes for run-tests.sh.

 #12230 (Test suite improvements).
2014-08-19 20:24:28 -07:00
Zack Weinberg 6fb347d296 Fix jasmine.ConsoleReporter.specFailureDetails.
The new Jasmine includes a version of this formerly external add-on, but it
is buggy and doesn't print details of failing tests.

 #12230 (Test suite improvements).
2014-08-19 20:24:27 -07:00
Zack Weinberg e6b67bddc5 Import Jasmine 1.3.1.
The newer jasmine-console behavior requires minor adjustments to the
 ConsoleReporter we create in run-tests.js.  Also, en passant fix for
 a bug in the final callback: exiting with status equal to the number
 of failed tests does not work, because the _exit() system call takes
 only the low eight bits of the value passed.  If a test run happened
 to have 256 failing tests, the old code would have spuriously exited
 successfully.  Instead, just exit(1) if any tests fail.

 #12230 (Test suite improvements).
2014-08-19 20:24:27 -07:00
Zack Weinberg 7102e87bf4 Eliminate console spam during normal test execution.
Three tests were (potentially) dumping text to console.log during the
run, which they should never do.

Fixing that revealed that one of them, the test for interrupting a
long-running JS script, was not actually testing what it was supposed
to test. Fixing *that* revealed that the long-running-script hook is
broken and does not actually interrupt JS infinite loops; that test
has been temporarily disabled.

 #12230 (Test suite improvements).
2014-08-19 20:24:27 -07:00
Zack Weinberg 406f736e14 Do not use github.com in tests.
Two tests were spuriously failing because they tried to load pages on
`github.com` that were no longer structured as expected.  Use a local
webserver instead.

 #12230 (Test suite improvements).
2014-08-19 20:24:27 -07:00
Craig Teegarden f245d3ed22 update modernizr to 2.8.2 - specifically shows phantomjs supports "legacyflexbox" instead of the current "flexbox"
https://github.com/ariya/phantomjs/issues/12273
2014-08-19 20:18:46 -07:00
Zack Weinberg 9bbff95a57 Correction to fontconfig usage on Unix-not-OSX.
The PhantomJS QPA hardcoded usage of QFontconfigDatabase on
Unix-not-OSX, causing build failures in "bundle all the libraries" mode.
Use QGenericUnixFontDatabase instead, which is QFontconfigDatabase if
fontconfig is enabled, and QBasicFontDatabase if it isn't.  This means
that the bundled-qtdeps build will use only the fonts bundled with Qt,
and won't be able to find them on a machine that doesn't have the source
tree, which is suboptimal, but at least this makes the bundled-qtdeps
build complete successfully again.

Part of issue #12467.
2014-08-19 16:44:12 -04:00
Ariya Hidayat 2681756efd Obsolete links to any wiki page.
The documentation has been using GitHub pages for a while already.

https://github.com/ariya/phantomjs/issues/10627
2014-08-19 07:27:39 -07:00
Zack Weinberg 30a4a01bca 80-column compliance for build.sh messages.
Cosmetic fix as part of issue #12467.
2014-08-19 07:20:50 -07:00
Zack Weinberg 8d23afb782 Add --system-qtdeps build mode.
In this mode, system-provided libraries will be used for all of
Qt's dependencies, but Qt and QtWebkit themselves are still the
bundled copies.  This mode actually works.

Now that this mode exists, disable fontconfig in the "everything
bundled" mode, because it drags in the system freetype and several
other system libraries.  (There is no bundled fontconfig.)

Part of issue #12467.
2014-08-19 07:20:49 -07:00
Zack Weinberg 4246ed0533 Correct SQLITE3SRCDIR setting.
This is how we arrange for QtWebkit to use QtBase's bundled copy of
sqlite; without it, QtWebkit will attempt to use a system-provided
library instead, and if headers are unavailable, the build will fail.

Part of issue #12467.
2014-08-19 07:20:49 -07:00
Zack Weinberg e9e6f30e69 Add option to build against system qtbase but bundled qtwebkit.
As with the system-qtwebkit option, this does not actually work at this
point, but it enables experimentation toward getting it to work.

Part of issue #12467.
2014-08-19 07:20:49 -07:00
Zack Weinberg 9254f6855e Rationalize handshake between build.sh and preconfig.sh.
* build.sh now handles building qt and qtwebkit.
 * preconfig.sh is now only responsible for accumulating arguments
   to pass to qt's configure script.
 * preconfig.sh doesn't have command line arguments of its own;
   anything on its command line will be passed directly to qt's
   configure script.
 * first pass of adjustments to the qt configure parameters
   to try to get a more static build - unfortunately, system
   sqlite, libz, libpng, and libexpat are still getting pulled
   in somehow (mostly via fontconfig, I think).

Part of issue #12467.
2014-08-19 07:20:49 -07:00
Zack Weinberg 615f33c9c4 Add capability to build PhantomJS against system Qt/Webkit.
Invoking build.sh with --system-qtwebkit will skip the build of Qt and
QtWebkit and use the qmake in $PATH to build PhantomJS proper.

This doesn't actually *work* at the moment because the bundled
copy of Webkit has patches not yet merged upstream, but it's still
useful to have for testing purposes.

Part of issue #12467.
2014-08-19 07:20:48 -07:00
Zack Weinberg 5b5e63af23 Better Qt version check.
* Allow any patchlevel of Qt 5.3.x.
 * Do it in the master .pro file instead of main.cpp; this makes the build
   fail immediately rather than after compiling a bunch of stuff.

Part of issue #12467.
2014-08-19 07:20:48 -07:00
Zack Weinberg b81d7aec0a Update .gitignore for Qt 5.3.
* Ignore src/phantomjs_plugin_import.cpp, which is now created during
   the build.
 * Add leading slashes to a bunch of files that should not be ignored if
   they crop up in subdirectories.

Part of issue #12467.
2014-08-19 07:20:48 -07:00
Vitaliy Slobodin 0c8eb88c15 Add build script for Windows 2014-08-18 23:35:27 +04:00
John Gozde de2a19da9c Use Array.prototype.slice in window.callPhantom.
window.callPhantom formerly used Array.prototype.splice for cloning
its arguments to the internal _phantom.call. This relied on
non-standard behaviour of the splice method when only a single
argument was passed to it (it requires 2 arguments).

The correct method for cloning the arguments array is to use
Array.prototype.slice, which accepts a single argument (index) and
returns a new array from the specified index.

https://github.com/ariya/phantomjs/issues/12306
2014-08-18 00:15:08 -07:00
Petteri Räty a86ae1948c Fix rasterize example exit status on failure.
https://github.com/ariya/phantomjs/issues/11911
2014-08-17 23:23:05 -07:00
Ariya Hidayat fbe8eefc29 Launcher for ECMA-262 test suite (test262.ecmascript.org).
https://github.com/ariya/phantomjs/issues/12439
2014-08-16 20:46:28 -07:00
Ariya Hidayat 25ddf566e7 Fix path handling when running the build process.
https://github.com/ariya/phantomjs/issues/12433
2014-08-16 13:22:10 -07:00
Mike McQuaid 0a8b13403f preconfig.sh: don't require ICU on OSX
This isn't needed for the full build, only QtWebKit which has it's own ways of finding the system ICU.

https://github.com/ariya/phantomjs/issues/10448
2014-08-16 11:18:27 -07:00
Ariya Hidayat f532b73cb2 More tests for the arguments object.
https://github.com/ariya/phantomjs/issues/11845
https://github.com/ariya/phantomjs/issues/11558
https://github.com/ariya/phantomjs/issues/11746
https://github.com/ariya/phantomjs/issues/10315

https://github.com/ariya/phantomjs/issues/12439
2014-08-15 22:42:23 -07:00
Ariya Hidayat 3c9cf90d12 Remove website/ directory.
The web site has been based on GitHub pages for 2.5 years already.
2014-08-15 22:42:22 -07:00
Ariya Hidayat eca1081b6e Remove patches/ since they are for 1.x only.
https://github.com/ariya/phantomjs/issues/10448
2014-08-15 22:42:21 -07:00
Milian Wolff aa0300607c Stop early when QtBase or QtWebKit failed to compile.
Currently, the build script will continue to try to build PhantomJS
even when either QtBase or QtWebKit failed to compile. In such a
case, the script should return early and emit an error message.

https://github.com/ariya/phantomjs/issues/12433
2014-08-15 21:54:56 -07:00
Milian Wolff 4bf75c50b0 Simplify Env code by reusing QProcessEnvironment.
This gets rid of the custom parse code and slims down the API.

https://github.com/ariya/phantomjs/issues/12424
2014-08-15 21:49:46 -07:00
Ariya Hidayat 3136898976 Some tests for JavaScript's Function.
https://github.com/ariya/phantomjs/issues/12439
https://github.com/ariya/phantomjs/issues/10522
2014-08-09 11:53:19 -07:00
Ariya Hidayat bbdaa9e884 A simple assertion for the fortcoming revamped test system.
https://github.com/ariya/phantomjs/issues/12439
2014-08-09 10:59:22 -07:00
Vitaly Slobodin 28045aaf6b Merge pull request #12430 from KDAB/remove_coffeescript_test
Remove CoffeeScript references from unit tests
2014-08-08 18:24:26 +04:00
Vitaly Slobodin 2ebe5fd8a8 Merge pull request #12428 from KDAB/cleanup_qt5merge
Fixup wrong merge: remove src/qt/src
2014-08-08 18:24:02 +04:00
Milian Wolff 0c55c0a9e0 Remove CoffeeScript references from unit tests
https://github.com/ariya/phantomjs/issues/12429
2014-08-06 15:08:24 +02:00
Milian Wolff 514972db80 Fixup wrong merge: remove src/qt/src
This reapplies the patch of issue #11590 and drops the patch
from issue #11264. The former is still valid, while the latter
is hopefully resolved properly in Qt5 (see e.g. this:
https://bugs.webkit.org/show_bug.cgi?id=69419).

https://github.com/ariya/phantomjs/issues/12427
2014-08-06 15:00:34 +02:00
Ariya Hidayat 48fabe0646 Remove CoffeeScript support.
https://github.com/ariya/phantomjs/issues/12410
2014-07-30 01:29:21 -07:00
Ariya Hidayat 64b6fd2f4b ChangeLog for 1.9.7.
https://github.com/ariya/phantomjs/issues/11919
2014-07-30 01:29:20 -07:00
Ariya Hidayat 20a73a6d40 Update ChangeLog for 1.9.6.
https://github.com/ariya/phantomjs/issues/11905
2014-07-30 01:29:20 -07:00
Ariya Hidayat dc8d3c7052 Update ChangeLog for 1.9.3.
https://github.com/ariya/phantomjs/issues/11904
2014-07-30 01:29:19 -07:00
Ariya Hidayat 13e788f2c1 Travis CI: Get more dependencies for building Qt 5.
https://github.com/ariya/phantomjs/issues/11880
https://github.com/ariya/phantomjs/issues/10448
2014-07-28 06:51:35 -07:00
Ariya Hidayat 53edf23e8f Reintroduce silent mode for building PhantomJS 2.
https://github.com/ariya/phantomjs/issues/11880
https://github.com/ariya/phantomjs/issues/10448
2014-07-28 06:18:10 -07:00
Ariya Hidayat e2682edf48 Disable some failing and/or crashing unit tests.
Also, reorder the tests since webpage-spec.js seems to be sensitive to
any previously executed tests.

https://github.com/ariya/phantomjs/issues/10448
2014-07-28 03:33:13 -07:00
Ariya Hidayat 1bf54d8776 Correct the unit tests of PhantomJS version.
https://github.com/ariya/phantomjs/issues/10448
2014-07-27 17:10:30 -07:00
Ariya Hidayat 125c8d3d49 Qt 5 base: Fix permissions of some files.
https://github.com/ariya/phantomjs/issues/10448
2014-07-27 07:47:55 -07:00
Vitaliy Slobodin cf12fc4a23 Long live PhantomJS 2!
https://github.com/ariya/phantomjs/issues/10448
2014-07-27 07:47:34 -07:00
Vitaly Slobodin d10b8dc583 Merge pull request #12287 from zackw/expose-http-status-to-onresourceerror
Expose HTTP status and reason to onResourceError (#12252).
2014-07-15 10:12:55 +04:00
Vitaly Slobodin 4393627a80 Merge pull request #12313 from Vitallium/remove-nullptr-warning
Variables QT_GCC_* are undefined for QPA.
2014-07-15 10:10:18 +04:00
Vitaliy Slobodin c166662c0d Variables QT_GCC_* are undefined for QPA. 2014-06-15 18:19:02 +04:00
Vitaly Slobodin 05277b2d84 Merge pull request #12300 from artkoshelev/proxysetuprefactoring
Replace proxy initialization with existing method
2014-06-15 12:19:22 +04:00
Artem Koshelev 00afabc993 Replace proxy initialization with existing method
Since we have setProxy() method, we can replace the existing code
block in Phantom::init() with simple method call getting rid of
duplicated code.
2014-06-10 16:56:29 +04:00
Zack Weinberg d65601fe90 Expose HTTP status and reason to onResourceError (#12252). 2014-06-03 20:52:44 -04:00
Sven Eckelmann 13ad8a134e Use correctly rendered pdf for webpage-spec-renders tests
The last reference test.pdf in the tests was using a complete different region
of the input "image.jpg" because the used phantomjs version used to generate it
had a bug. This bug was fixed in 833eb824f5bae07f1b157d6757e7e3c98343f812
("Don't scale the unit px to 1/2.54 points for PDFs") and
1daa2eb4dd49efb848ff96e37f298a774520cc9b ("Disable page shrinking for pdf
printing to create accurate output").

The new version should now use the same region of the input image as the other
generated files for the gif, jpg and png tests. The only difference is the
extra height is still displayed on a second page but this is currently expected
by phantomjs.

https://github.com/ariya/phantomjs/issues/11590 ("page.paperSize is not
accurate for .pdf")
2014-05-31 08:23:32 -07:00
Sven Eckelmann b4e295cc97 Disable page shrinking for pdf printing to create accurate output
PDFs are not rendered like PNG or other image formats by phantomjs because it
uses the printer functionality of Qt+Webkit. But Webkit uses some printer
"optimization" to save paper by shrinking the output. Such shrinking results in
too small content on a page.

https://github.com/ariya/phantomjs/issues/11590 ("page.paperSize is not
accurate for .pdf")
2014-05-31 08:23:24 -07:00
Sven Eckelmann 800fbe8452 Don't scale the unit px to 1/2.54 points for PDFs
The unit px is one point inside the HTML source page but phantomjs handles it
without reason as 1/2.54 points. This makes the page smaller than expected when
trying to render a page as PDF.

https://github.com/ariya/phantomjs/issues/11590 ("page.paperSize is not
accurate for .pdf")
2014-05-31 08:23:13 -07:00
Ivan De Marino 62fbad4814 Adding IRC #phantomjs notif. to TravisCI build 2014-05-10 01:28:11 +01:00
Eric Heydenberk ccdd86f47f Add missing RPM spec file names; update changelog.
Issue #11262 https://github.com/ariya/phantomjs/issues/11262
2014-04-22 21:38:38 -07:00
Artem Koshelev 3c5302d567 Example of runtime proxy setup
https://github.com/ariya/phantomjs/issues/10803
2014-04-17 23:02:43 -07:00
Thomas Schlage 9da842df2b Added setProxy function
https://github.com/ariya/phantomjs/issues/10803
2014-04-17 23:02:15 -07:00
Dmitry Mazuro 4d2fedf243 Use SVG version of travis build status badges
https://github.com/ariya/phantomjs/issues/11880
2014-04-07 22:01:46 -07:00
Richard Harris 7d3f3f0819 Fix harfbuzz assertions using patch from Chromium.
Exotic text (e.g. attempting to render a binary file such as .zip
or .exe as a webpage) can trigger an assertion failure in the
Harfbuzz code. Chromium developers also noticed this issue and
committed a patch to fix it:

http://lists.freedesktop.org/archives/harfbuzz/2009-August/000354.html

This patch has not been accepted by upstream, but this (old) version
of Harfbuzz has been abandoned and superceded by Harfbuzz-NG.

Issue #11264
2014-04-07 21:58:36 -07:00
Ivan De Marino e9c77252ee Merge branch 'master' of https://github.com/pauloalem/phantomjs into pauloalem-master 2014-03-29 11:28:50 +00:00
petercoles d831dea8c8 Update example
Since this example was written the phantomjs home page has been redesigned and the targeted ID no longer exists. This tweaks the example so that it can again find content to report.
2014-03-29 11:09:51 +00:00
Ivan De Marino e9a47eddee Changing Travis CI build list into a table 2014-03-09 19:25:54 +00:00
Ivan De Marino 8f685818aa Fixed tests that dealt with manipulating request URLs.
Related to #11952.

Those tests use "http://phantomjs.org" as fixture.
The website "/images" directory has been renamed "/img",
breaking the tests.

Maybe not the greatest way to go about it, but
for now it will do. We probably need to have fixtures
served by a local server.
2014-03-09 01:02:49 +00:00
Ivan De Marino 77b5de1362 Run PhantomJS's tests as part of TravisCI
Related to #11952.
2014-03-09 01:02:49 +00:00
Ivan De Marino ba5998f74e Making GhostDriver test "quiet-er" (and parallel)
Also, trying to get the exit status of those tests reported, in case they fail.

Related to #11952.
2014-03-09 01:02:21 +00:00
Ivan De Marino 1797c146f1 Adding "test/ghostdriver-test" to run in Travis CI
Related to issue #11880
2014-03-08 23:37:47 +00:00
Adrian Chung 300f28cc5d Add example for how to post a json request to HTTP server
https://github.com/ariya/phantomjs/issues/11969
2014-02-19 21:40:02 -08:00
Rikke Simonsen bda8838698 Fix for crash bug caused by Iframe NULL reference
https://github.com/ariya/phantomjs/issues/10947
https://github.com/ariya/phantomjs/issues/11103
https://github.com/ariya/phantomjs/pull/11984
2014-02-19 21:30:11 -08:00
paulo alem 15d0636b70 Runner for jasmine 2
The old script needed some updates in order to support the new jasmine lib
2014-02-14 19:27:14 -02:00
Ivan De Marino 9940e8b25e Travis CI: Adding comments to ".travis.yml".
Related to issue #11880
2014-02-02 21:25:05 +00:00
Ivan De Marino 0765f9bdd2 Travis CI: trying to make the build more "resilient".
Related to issue #11880.
2014-02-02 21:00:53 +00:00
Ivan De Marino 06672a03aa Add links to "travis ci" to README file.
Linking branches "master" and "1.9" for now.
2014-02-02 19:58:36 +00:00
Ivan De Marino 056aa50c19 Importing GhostDriver 1.1.1.
Yes, 1.1.0 has just been imported.
But the key feature in 1.1.1 is Session Isolation in WebDriver: something that has been requested many times,
particularly when using GhostDriver with Selenium Grid.
2014-01-12 21:08:21 +00:00
Trevor North 18b8a4d444 Update table page break improvements patch
Includes the following fixes taken from trvrnrths-qt:
- Ensure we have a first cell to measure when checking required table
  height
- Handle page break edge case with exactly fitting last table row
  In the case where the last table row on a page fitted exactly no
  extra offset was afforded to the next row. This resulted in no
  space being left for the painting of the table header on the next
  page.
- Fix segfault when checking heights for pagination if table body does
  not have a cell at 0,0

See https://github.com/ariya/phantomjs/pull/11291 and
https://github.com/ariya/phantomjs/pull/11490.
2014-01-10 20:56:52 -08:00
Ariya Hidayat 42b3a86bcd OS X: Unsafe patch to fix selectable text on PDF output.
https://github.com/ariya/phantomjs/pull/11723
https://github.com/ariya/phantomjs/pull/11509
2014-01-10 16:18:08 -08:00
Joseph Rollinson 244cf251cd Adds support for multiple Cookie Jars.
Previously, there was a single global cookie jar shared between all web pages.
Now, one can have separate cookie jars for different web pages.

Makes CookieJar a normal class, not a singleton.
Moves many public CookieJar methods to public slots.
Adds default cookie jar to Phantom.
Adds the CookieJar module that provides access to cookie jars in javascript.
Adds cookie jar module tests.

Usage:
var jar = require('cookiejar').create();
var webpage = require('webpage').create();
webpage.cookieJar = jar;
...
webpage.close();
jar.close();

JS API changes:
Webpage:
    var jar = page.cookieJar; -- assigns 'jar' the given webpage's cookie jar.
    page.cookiejar = jar; -- sets 'jar' as the given webpage's cookie jar.
CookieJar:
    var jar = require('cookiejar').create(path)
        creates a cookie jar with persistent storage at the given file path
        (path not mandatory).
    var cookies = jar.cookies; -- assign's 'jar' the list of cookies in the
        cookie jar.
    jar.cookies = [c1, c2]; -- sets the cookie jar's cookies as the ones in the
        list.
    jar.addCookie(cookie) -- adds cookie 'cookie' to the cookie jar.

https://github.com/ariya/phantomjs/issues/11417
2014-01-10 16:12:39 -08:00
Vasyl Vavrychuk 3ae9d38d40 fixed test suite 'WebPage render image'
Previously the test suite 'WebPage render image' made a series of
webpage.open without waiting them to complete. This effected next
runned tests because on load handlers for pages were fired after
'WebPage render image' test finish.

https://github.com/ariya/phantomjs/issues/11780
2014-01-09 17:47:11 -08:00
Ashish Kulkarni 3ed2f68909 Implement "page-break-inside: avoid" for non-floating block elements.
This patch is taken from https://bugs.webkit.org/show_bug.cgi?id=5097#c17

It was originally part of PR #211 but was possibly overlooked in PR #344
(when the other two patches got reapplied after the QT source import).
2014-01-07 08:46:18 -08:00
Ariya Hidayat 6b45113cfe QWidget: Fix unused parameter warning when there's no Graphics View.
This reduces the amount of repetitive compiler warnings.

https://github.com/ariya/phantomjs/issues/11880
2014-01-06 23:27:34 -08:00
Ariya Hidayat 266ef0da59 Travis CI: Silent build.
https://github.com/ariya/phantomjs/issues/11880
2014-01-06 22:35:02 -08:00
Ariya Hidayat 46eb122ba3 Travis CI: Ensure that the build script executable.
https://github.com/ariya/phantomjs/issues/11880
2014-01-06 17:08:48 -08:00
Ariya Hidayat e533587107 Travis CI: Packages installation needs a priviliged access.
https://github.com/ariya/phantomjs/issues/11880
2014-01-06 16:59:50 -08:00
Ariya Hidayat 23f31391af Travis CI: Fix the build directives.
https://github.com/ariya/phantomjs/issues/11880
2014-01-06 16:45:33 -08:00
Ariya Hidayat e897ab8bb2 Travis CI: Ensure packages are cached for faster setup.
https://github.com/ariya/phantomjs/issues/11880
2014-01-06 16:42:56 -08:00
Ariya Hidayat aa388a05ef First attempt on using Travis CI.
https://github.com/ariya/phantomjs/issues/11880
2014-01-06 16:34:23 -08:00
James McParlane dca15d7ff6 Added onRepaint callback to webpage API.
Enables subscription to RepaintRequested events.
When the callback is invoked the time that the repaint was requested as well as the x,y and width,height of the repainted rectangle are provided as parameters.
Usage: page.onRepaint = function(time, x, y, width, height) { }

https://github.com/ariya/phantomjs/issues/11793
2014-01-06 23:05:30 +00:00
Ivan De Marino 9bfe22b428 Merge pull request #11784 from vvavrychuk/parse-error
fix lack of parse time errors location info
2014-01-06 11:30:29 -08:00
Ivan De Marino a9a219e74b Importing GhostDriver 1.1.0 in PhantomJS.
CHANGELOG for v1.1.0 (https://github.com/detro/ghostdriver/issues?labels=1.1.0&state=closed)

JavaScript Driver (Core)
* ENHANCEMENT: `/maximize` window will set the window size to 1336x768,
currently most common resolution online (see http://gs.statcounter.com/#resolution-ww-monthly-201307-201312)
* ENHANCEMENT #275: Implemented Browser and Network (HAR) Logging types
* FIXED #284: Attempt to wait for Page to Load if input causes form submit
* FIXED #291: Throw exception when attempting to set invalid timeout value
* FIXED #259: Fix issue regarding mouse clicks
* ENHANCEMENT #290: Enabled support for "Keep Alive" HTTP connections
* ENHANCEMENT #262: Allow access to PhantomJS API from WebDriver (Driver part)
* ENHANCEMENT #293: Import Selenium 2.39.0 WebDriver Atoms

Java Binding
* MINOR #251: Minor compilation issues for Binding
* ENHANCEMENT #262: Allow access to PhantomJS API from WebDriver (Java Binding part)

Tested using GhostDriver validation tests (https://github.com/detro/ghostdriver/tree/master/test).

https://github.com/ariya/phantomjs/pull/11877
2014-01-04 14:44:04 -08:00
Ariya Hidayat b70ff8929c Fix warning of obsolete userSpaceScaleFactor on OS X 10.9 (Mavericks).
Related upstream bug: https://bugreports.qt-project.org/browse/QTBUG-28574

Issue #1162 https://github.com/ariya/phantomjs/issues/11612
2014-01-03 20:41:00 -08:00
Ariya Hidayat b67866b612 Fix CoreText performance note on OS X 10.9 (Mavericks).
Upstream Qt bug: https://bugreports.qt-project.org/browse/QTBUG-32789
Upstream patch: https://codereview.qt-project.org/#patch,all,70097,4.
Upstream commit: https://qt.gitorious.org/qt/qt/commit/98352b964f

https://github.com/ariya/phantomjs/issues/11418
2014-01-03 20:40:53 -08:00
Ivan De Marino 9b0132712b Merge pull request #11868 from bradleyboy/click-modifier-fix
Pass modifier to mouse events for click/dblclick
2014-01-01 11:04:44 -08:00
Brad Daily 7659f2551c Adding tests for #11867
This tests mousedown, mouseup, click, and doubleclick for clicks with
modifier events. The mousedown/mouseup tests pass in 1.9.2, the
click/doubleclick do not. All pass with a build from this branch.
2014-01-01 13:47:33 -05:00
Ben Cox 18b342d3e7 Update some grammar on the README.md
Replaces the "a, b, c, d" with the more grammatically correct "a, b, c, and d"
2014-01-01 09:44:33 -08:00
Ivan De Marino e1ae72a866 Merge pull request #11866 from bmarkovic/patch-1
Added bitmap size and clipping to rasterize.js
2014-01-01 08:18:42 -08:00
Brad Daily e40ebb93d7 Pass modifier to mouse events for click/dblclick
A fix for the issue described here:

https://github.com/ariya/phantomjs/issues/11867
2014-01-01 11:06:11 -05:00
Bojan Markovic 54c1611801 Added bitmap size and clipping to rasterize.js
Added support for defining window/viewport size and eventual clipping to bitmap rasterization similar to how it is used with paper output.
2014-01-01 13:14:19 +01:00
Aaron Stone 3d80670e22 Handle script language in debug mode too.
f919121a35
2013-12-15 22:27:26 -08:00
Aaron Stone 176d435901 REPL is only valid for javascript updates.
https://github.com/ariya/phantomjs/issues/11744
2013-12-15 22:27:10 -08:00
Oleg Plakhotniuk f4128d7ede Select monospace font family properly.
CSS style "font-family: monospace" should select monospace font.

https://github.com/ariya/phantomjs/issues/11764
2013-12-13 07:34:49 -08:00
Aaron Stone 4ca640c5e7 Reject script-language values other than javascript and coffeescript
https://github.com/ariya/phantomjs/issues/11744
2013-12-13 06:58:20 -08:00
Aaron Stone 394e2f8699 Add option --script-language to explicitly set javascript or coffeescript
https://github.com/ariya/phantomjs/issues/11744
2013-12-13 06:58:04 -08:00
Francisco de Borja Lopez Río d5eaf41063 Set proper jobs number and library paths before building in OpenBSD
https://github.com/ariya/phantomjs/issues/10996
2013-12-05 07:30:02 -08:00
Martin Popelak 8f8de58752 Update of reference for mongoose license
As it seems that project Mongoose has been relicensed from MIT to GPL2. The link provided is leading to the new licensing agreement but as today version 3.1 of Mongoose is used which is licensed under MIT therefore correct reference to a license should be provided.

https://github.com/ariya/phantomjs/issues/10718
2013-12-05 07:27:53 -08:00
Vitaliy Slobodin efcc6c7861 Define the new page callback for interrupting a long-running JavaScript
Issues:
https://github.com/ariya/phantomjs/issues/11198
https://github.com/ariya/phantomjs/issues/11183
https://github.com/ariya/phantomjs/issues/11189
2013-11-23 22:09:39 -08:00
Vasyl Vavrychuk c8e4215097 fix lack of parse time errors location info
Location information of parse time error is given to javaScriptError not
with stack by with separate lineNumber and sourceID arguments. Put this info
to stack if it is empty so that it will be visible to user.

https://github.com/ariya/phantomjs/issues/11640
2013-11-24 01:43:10 +02:00
Vitaliy Slobodin 6a01a8dece Upgrade to Qt 4.8.5
https://github.com/ariya/phantomjs/issues/11452
2013-10-19 07:52:31 -07:00
Max Edmands 94e63bfa04 Fix typo in the cookie jar debug message. 2013-10-19 07:52:01 -07:00
Vitaliy Slobodin 23df8811a1 REPL returns empty object on enumerating properties on a simple JavaScript type (Number, String, Logical).
We should not to do that.

Issue:
https://github.com/ariya/phantomjs/issues/11622
2013-10-07 20:33:52 -07:00
Mike McQuaid fe6a967bad Fix Clang compilation
Already merged in Qt: b82b8bfa81

Issue #11611 https://github.com/ariya/phantomjs/pull/11611
2013-10-01 07:38:40 -07:00
Ariya Hidayat 2691540711 Getting ready for 1.9.2.
Issue #11452: https://github.com/ariya/phantomjs/issues/11452
2013-09-08 07:25:43 -07:00
hexid b1e181176e Add require.paths support
Issues: https://github.com/n1k0/casperjs/issues/462 https://github.com/ariya/phantomjs/issues/11339
2013-09-01 07:53:08 -07:00
Morgan Roderick 7431cbf229 CONTRIBUTING.md: convenient => confident
Minor correction to language use in CONTRIBUTING.md
2013-08-15 12:05:41 +02:00
Ivan De Marino 73bb560840 Import GhostDriver v1.0.4
Issues in this release: https://github.com/detro/ghostdriver/issues?labels=1.0.4&state=closed
See GhostDriver Changelog for more details.
2013-07-25 23:24:53 +01:00
Dmitry Parshin 8114d44a28 fixed compile errors for no-JIT configuration
Issue #11475 https://github.com/ariya/phantomjs/issues/11475
2013-07-24 23:38:44 -07:00
Richard Harris 4989445e71 Fix harfbuzz assertions using patch from Chromium.
Exotic text (e.g. attempting to render a binary file such as .zip
or .exe as a webpage) can trigger an assertion failure in the
Harfbuzz code. Chromium developers also noticed this issue and
committed a patch to fix it:

http://lists.freedesktop.org/archives/harfbuzz/2009-August/000354.html

This patch has not been accepted by upstream, but this (old) version
of Harfbuzz has been abandoned and superceded by Harfbuzz-NG.

Issue #11264
2013-07-24 23:34:45 -07:00
Vitaliy Slobodin 1a25383307 Use Qt::transparent to resolve graphical artifacts with images with transparent background.
We need to use QImage::Format_ARGB32_Premultiplied on Windows to preserve a text hinting and antialiasing. Using the function `qRgba()` leads to wrong pixel values on a target image. Since, `QImage::fill(uint pixel)` doesn't handle the QImage::Format_ARGB32_Premultiplied format, so we need to use the another overload `QImage::fill(const QColor &color)`

Issues:
https://github.com/ariya/phantomjs/issues/11276
https://github.com/ariya/phantomjs/issues/11007
https://github.com/ariya/phantomjs/issues/11366
2013-06-24 01:07:24 +04:00
Vitaliy Slobodin b1cb3a00bd Merge pull request #11425 from Vitallium/master
Fix typo in the `loadurlwithoutcss` example
2013-06-23 00:45:30 -07:00
Vitaliy Slobodin fdec25ac4c Fix typo in `loadurlwithoutcss` example
Issue: https://github.com/ariya/phantomjs/issues/11321
2013-06-23 11:28:51 +04:00
Ivan De Marino 6ba33cbcab Merge pull request #11422 from detro/ghostdriver-dev
WebServer Headers for Request are treated case-insensitive
2013-06-21 15:55:25 -07:00
Ivan De Marino c466d8aeef WebServer Headers for Request are treated case-insensitive
To achieve this, Request Headers are stored in both "original" and "lowercase".
In this way we don't mangle with the request object we have received, while
still be able to handle headers when NOT in the classic "Camel-Case" format.

Fixes #11421.
2013-06-21 23:51:05 +01:00
Ariya Hidayat edf2d90a11 Patch for table page break improvement.
From d78182d3a6451522f239ee1ecbb71863eb053792 Mon Sep 17 00:00:00 2001
From: Artem Baranovskiy <likejavascript@gmail.com>
Date: Mon, 6 May 2013 08:01:01 +0400
Subject: [PATCH] Table page-break improvements

See issue #11291 https://github.com/ariya/phantomjs/pull/11291
2013-06-08 21:40:55 -07:00
Ariya Hidayat 644f379588 Include all the changes from 1.9.1. 2013-06-08 02:20:42 -07:00
Ariya Hidayat b4c4429e86 Unit tests: reduce the flakiness of loading progress tests.
For whatever reason, swapping the order with the render() tests solve the
intermittent random failures. Also, split the tests between loading
start and finish checks (to better recognize which one is failing, if
there is a failure), also make the tests more asynchoronous.

https://github.com/ariya/phantomjs/issues/11091
2013-06-08 02:18:31 -07:00
Ariya Hidayat 01587211cb Unit test: secure connection check becomes async.
Issue #10882: https://github.com/ariya/phantomjs/issues/10882
2013-06-08 02:05:07 -07:00
Ariya Hidayat 44c3d6080d Unit tests: robustify the tests of PDF, GIF, PNG, JPEG rendering.
Issue #10973 https://github.com/ariya/phantomjs/issues/10973
2013-06-08 02:04:59 -07:00
Ariya Hidayat 9f1f56bc3b Unit tests: terminate any web servers after finishing the tests.
Issue #11163: https://github.com/ariya/phantomjs/issues/11163
Issue #11243: https://github.com/ariya/phantomjs/issues/11243
2013-06-08 02:04:48 -07:00
Ariya Hidayat f57fa468ab Unit test: tweak secure connection check.
The main wikipedia page can be slow to load and thus triggers the timeout.
Let's use the fast Google site so that we don't get flaky outcome.

Issue #10882: https://github.com/ariya/phantomjs/issues/10882
2013-06-08 02:04:39 -07:00
Bryan Bishop fb8edb7c72 Fix minor typos in preconfig.sh.
One is a typo, while the other is grammar-related.

fixes #11388

https://github.com/ariya/phantomjs/issues/11388
2013-06-05 18:07:42 -05:00
Vitaliy Slobodin 4d916971b3 Fix including http:// in the proxy URL:
The proxy host parsed incorrectly, when it was typed with a scheme (http or https).
Now proxy can be specified with the scheme.

Fix invalid type conversion:
m_proxyPort converts to its ASCII representation.
Use `QString::number` to include a proxy port properly.

Issues:
https://github.com/ariya/phantomjs/issues/11117
https://github.com/ariya/phantomjs/issues/10811
2013-05-29 00:38:15 +04:00
Vitaliy Slobodin 639e8c85b2 Make QNetworkReplyHandler deliver content asynchronously
when its load type is set to SynchronousLoad.

Issue #11338: https://github.com/ariya/phantomjs/issues/11338
Upstream bug: https://bugs.webkit.org/show_bug.cgi?id=62808
2013-05-20 19:49:23 -07:00
Ariya Hidayat fa238856f9 third-party.txt: Include OpenSSL.
Issue #11269 https://github.com/ariya/phantomjs/issues/11269
2013-05-20 19:49:22 -07:00
Ariya Hidayat 9aa0705d3c Update ChangeLog. 2013-05-20 00:20:14 -07:00
Alex Alvarez 3bd7a3dfa6 Netsniff.js example should exit with an error when fails to load the adress
Issue #11333 https://github.com/ariya/phantomjs/issues/11333
2013-05-19 22:29:31 -07:00
Alex Alvarez 2f851086e4 Netsniff.coffee example should exit with an error when fails to load the adress
Issue #11333 https://github.com/ariya/phantomjs/issues/11333
2013-05-19 22:28:09 -07:00
Jan Minar 320608662d Reword for better English 2013-05-19 18:16:09 -07:00
Vitaliy Slobodin 0726a8e2bb Fix crash when calling QObject::disconnect for QNetworkReplyWrapper
Fix it by watching the QNetworkReply's destroyed() signal and avoid the dangling pointer
instead. The QNetworkReply doesn't need to be aborted in this case anyway.

Issue #11252: https://github.com/ariya/phantomjs/issues/11252
Upstream bug: https://bugs.webkit.org/show_bug.cgi?id=116035
2013-05-19 12:01:33 -07:00
Ariya Hidayat 706e928e78 Update ChangeLog. 2013-05-15 00:03:39 -07:00
Eric Heydenberk f1472b54d1 Update RPM spec changelog
- Describe %files change
- Fix year in timestamp in previous changelog entry

Issue #11262 https://github.com/ariya/phantomjs/issues/11262
2013-05-13 23:34:35 -07:00
Eric Heydenberk dff8ce2526 Update rpm spec file names
- Add missing example files
- Alphabetize names

Issue #11262 https://github.com/ariya/phantomjs/issues/11262
2013-05-13 23:33:51 -07:00
Vitaliy Slobodin 5528d75c9d Network request header manipulation
Issue: https://github.com/ariya/phantomjs/issues/11299 (#11299)

User should be able  to manipulate HTTP headers per each network request, not only using global setting page.customHeaders.
2013-05-13 22:48:58 -07:00
Vitaliy Slobodin f8e79fb8c6 Limit the maximum request post size to 10 MB (megabytes).
std::numeric_limits<qint64>::max is too big for QByteArray (throws Out of Memory exception).
Set up the limit like it was done in Google Chrome
Ref: https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp

Related to issue #10158 https://github.com/ariya/phantomjs/issues/10158
2013-05-13 22:41:15 -07:00
Ivan De Marino 23515550d5 MINOR: Reorder initialisation order in NAM constr.
`m_resourceTimeout` is declared before of other
private variables, and the compiler was complaining
the initialisation order could not be respected.
This caused annoying (but innocuous) warnings at compile time.
2013-04-30 22:57:58 +01:00
Andrew Galloni 3ae632e704 ChangeUrl to accept an encoded string
Issue #11243: https://github.com/ariya/phantomjs/issues/11243.
2013-04-29 07:07:53 -07:00
Robin Helgelin f72f2962d1 Updated rpm spec file to work with 1.9.
Issue #10939: https://github.com/ariya/phantomjs/issues/10939
2013-04-29 07:05:48 -07:00
execjosh 39bec1ce17 Synchronize std{in,out,err} encoding with `Terminal`
See #11234 https://github.com/ariya/phantomjs/pull/11234
Spin off from #11168 https://github.com/ariya/phantomjs/pull/11168
2013-04-29 07:00:47 -07:00
execjosh b159144a48 Teach `File` how to change its encoding
If a `File` is in "text" mode, then it has an encoding.  This
encoding defaults to UTF-8; however, it can be set only at time of
construction (by using `fs.open`).

This modification allows the user to change the encoding on-the-fly
for "text" mode `File` instances.

See #11234 https://github.com/ariya/phantomjs/pull/11234
Spin off from #11168 https://github.com/ariya/phantomjs/pull/11168
2013-04-29 07:00:19 -07:00
execjosh 3d874d9e0d Make `Terminal` emit a signal upon encoding change
See #11234 https://github.com/ariya/phantomjs/pull/11234
Spin off from #11168 https://github.com/ariya/phantomjs/pull/11168
2013-04-29 06:58:44 -07:00
Ariya Hidayat c07a2efa33 Update ChangeLog. 2013-04-22 22:39:02 -07:00
execjosh f8a905c8b0 Link with text codec plugins on mac and linux
Fixes [#10249](https://github.com/ariya/phantomjs/issues/10249)
2013-04-22 22:35:56 -07:00
execjosh d925a510d9 Improve WebPage CJK support tests.
This is for issue #10249: https://github.com/ariya/phantomjs/issues/10249.
2013-04-22 22:35:08 -07:00
Vitaliy Slobodin 3edcabef9f Fix compilation with MSVC 2010
Issue #10158: https://github.com/ariya/phantomjs/issues/10158
This bug introduced by the marco max( ) defined in <windef.h>.
It replaces max( ) with another statement but still preceeded by numberic_limits<Type>::
The workaround is to use the parenthesis
2013-04-13 20:17:12 -07:00
Vitaliy Slobodin 78242e5d6c Fix command line option typo
Issue #11219: https://github.com/ariya/phantomjs/issues/11219
2013-04-12 23:12:20 -07:00
execjosh 36ab7194e4 Use UTF-8 encoding for std{in,out,err}
This fixes issue #11162.

`File` constructor takes a `QTextCodec *`, codec; but, if codec is
`NULL`, then it assumes "binary" mode, which causes non-ASCII
characters to be converted to NUL (`\0`) in `File::write`.

This change passes the codec for UTF-8 to the `File` constructor for
the `std{in,out,err}` instances, thus opening them in *text mode*.
2013-04-12 23:10:25 -07:00
execjosh 8042f3b92c Flush in `File::write` when in unbuffered "text" mode
If the wrapped `QFile` was opened with `QIODevice::Unbuffered`, any
writes should be unbuffered.  However, as currently implemented,
using `QTextStream` when the `File` is in "text" mode causes all
reads/writes to be buffered.

This modification forces a flush in `File::write` if the wrapped
`QFile` was opened with `QIODevice::Unbuffered`.

Necessary to fix issue #11162 https://github.com/ariya/phantomjs/issues/11162.
2013-04-12 23:10:08 -07:00
Ariya Hidayat 24078b56c7 Update ChangeLog. 2013-03-31 03:08:26 -07:00
Ariya Hidayat 0bc2eb418e Temporarily call this branch as version 1.10.
Issue #10448 https://github.com/ariya/phantomjs/issues/10448#issuecomment-15689386
2013-03-31 03:06:50 -07:00
Pavel fcdd274f2e Show postData in onResourceRequested callback.
Issue #10158 https://github.com/ariya/phantomjs/issues/10158
2013-03-31 02:54:37 -07:00
Vitaliy Slobodin 47dc82681d Fire `onResourceReceived` callback when the resource error occured.
Issue #11163: https://github.com/ariya/phantomjs/issues/11163
2013-03-31 02:39:53 -07:00
Vitaliy Slobodin 9ca45ed62e Fix loading modules from an absolute path on Windows.
Don't check the module path using Linux-style path checking.

Issue #11165: https://github.com/ariya/phantomjs/issues/11165
2013-03-25 19:01:32 -07:00
Ariya Hidayat da71c5fbdd Issue #10939: Mention 1.9 as the new stable.
https://github.com/ariya/phantomjs/issues/10939
2013-03-20 22:38:03 -07:00
Ariya Hidayat bb1a407e8d ChangeLog: Always mention the code names. 2013-03-20 22:38:03 -07:00
Ariya Hidayat bda3355060 Issue #10939: Get ready for version 1.9.0.
https://github.com/ariya/phantomjs/issues/10939
2013-03-20 22:23:51 -07:00
Ariya Hidayat 08bbd324d1 Update ChangeLog.
https://github.com/ariya/phantomjs/issues/10939
2013-03-20 22:22:59 -07:00
Ariya Hidayat 9ef69005d4 ChangeLog: Modify the issue numbers to match the new issue tracker.
https://github.com/ariya/phantomjs/issues/10939
2013-03-20 20:32:24 -07:00
DjinnS b5345bc133 netsniff example: Exclude Data URI from HAR.
Fixes issue #10740.

https://github.com/ariya/phantomjs/issues/10740
2013-03-20 20:24:59 -07:00
Jonathan Wilkins 9f9053ec44 Add support for specifying non-default CA certificate bundles.
This is done via SSL_CERT_DIR and --ssl-certstore.

Fixes issue #10916.

https://github.com/ariya/phantomjs/issues/10916
2013-03-20 08:27:54 -07:00
Tom Aizenberg 52883ced68 WebPage: network timeout setting.
Fixes issue #11129.

https://github.com/ariya/phantomjs/issues/11129
2013-03-19 22:57:26 -07:00
Laurent Jouanneau b16a5348a9 WebPage: new constants for modifiers keys
Declares in event.modifiers all constants needed for the fifth
parameter of sendEvent.

http://code.google.com/p/phantomjs/issues/detail?id=1056
https://github.com/ariya/phantomjs/issues/11056
2013-03-18 22:24:02 -07:00
Ariya Hidayat 63dc1e2c8f Add a patch to disable touch event support.
This is from https://github.com/ariya/phantomjs/pull/408.
See also issue #10375 for some related discussion.

https://github.com/ariya/phantomjs/issues/10375
2013-03-18 22:00:16 -07:00
Max Desyatov 0147fcbc07 Support for specifying request body encoding for WebPage::openUrl
Added a simple test in test/webpage-spec.js

Test data from http://code.google.com/p/phantomjs/issues/detail?id=1043
2013-03-18 21:43:22 -07:00
Max Desyatov 357dbf46d2 Support for specifying request body encoding for WebPage::openUrl
doesn't break existing functionality and currently supports only
"utf-8" and "utf8" encodings

Fixes http://code.google.com/p/phantomjs/issues/detail?id=1043
2013-03-18 21:43:00 -07:00
Ivan De Marino 6989188fa0 Merge pull request #11146 from detro/ghostdriver-dev
Importing GhostDriver v1.0.3
2013-03-18 02:22:46 -07:00
Ivan De Marino 78d90641df Importing new GhostDriver 1.0.3.
See the https://github.com/detro/ghostdriver/ project for details.
2013-03-18 09:20:50 +00:00
Ivan De Marino 005db037cf Tests for the new "page.loading" property.
This commit provides the unit tests for the new property, as asked by
Ariya in #11091.
2013-03-18 09:19:41 +00:00
Ivan De Marino 9740990990 New "page.loading" and "page.loadingProgress".
Now you can know about the Page Loading Progress
using 2 property:
- [bool] page.loading
- [int: 0-100] page.loadingProgress

Implements #1091: http://code.google.com/p/phantomjs/issues/detail?id=1091
2013-03-17 16:24:47 +00:00
Ariya Hidayat 9af1f09f58 Change issue tracker link to point to the new one.
From now on, it's https://github.com/ariya/phantomjs/issues.

For the details, check this mailing-list discussion:
https://groups.google.com/d/msg/phantomjs/It04OsP7csU/Vw2cmJkAILUJ
2013-03-16 09:19:25 -07:00
Ariya Hidayat 9df52bb752 Update ChangeLog.
Also, includes changes from 1.8.x.

http://code.google.com/p/phantomjs/issues/detail?id=863
https://code.google.com/p/phantomjs/issues/detail?id=939
2013-03-02 21:52:45 -08:00
Ariya Hidayat d42c4002c4 examples/follow: Update Twitter handles.
https://code.google.com/p/phantomjs/issues/detail?id=1082
2013-03-02 21:33:36 -08:00
Ariya Hidayat 1c80f7306e Update ChangeLog.
http://code.google.com/p/phantomjs/issues/detail?id=939
2013-02-24 19:51:26 -08:00
Alexander James Phillips 5d6b8240f7 page_events example should show requests and navigate to step2url
http://code.google.com/p/phantomjs/issues/detail?id=1028
2013-02-24 16:18:05 -08:00
Dody Suria Wijaya 58566bbe76 Fix concurrent issue on render_multi_url example
webkit (thus phantomjs) load() does not call loadFinished at the expected timing when running concurrently. The example is changed to run non-concurrently as a work around.

Issue: http://code.google.com/p/phantomjs/issues/detail?id=1021
2013-02-24 10:26:42 -08:00
Vitaliy Slobodin fed209c546 Allocate JsNetworkRequest on the stack to avoid leaking it.
https://code.google.com/p/phantomjs/issues/detail?id=539
2013-02-24 09:00:49 -08:00
Vitaliy Slobodin 212e4b7cd9 Reworked api for canceling network requests. Added experimental API for changing the url of the network request.
Issue:
http://code.google.com/p/phantomjs/issues/detail?id=539

Stub
2013-02-24 09:00:07 -08:00
Capi Etheriel ca27a8eab1 Use fs.write in the example for clarity.
https://code.google.com/p/phantomjs/issues/detail?id=1082
2013-02-24 08:56:38 -08:00
Ivan De Marino 04368c6af8 HOTFIX: @Vitalliumm discovered a typo in CookieJar
Original message: https://twitter.com/vitalliumm/status/301220038323613697
This was affecting date comparison/espiration in the
CookieJar.

Typical case of "I have no idea how it did work so far".

http://code.google.com/p/phantomjs/issues/detail?id=1068
2013-02-12 07:34:57 -08:00
Ariya Hidayat fef171e14f Renew the weather example with OpenWeatherMap service.
Google "secret" Weather API is shutdown. Let's use the crowd-sourced
OpenWeatherMap to supply the weather data (albeit there is no forecast
available).

http://code.google.com/p/phantomjs/issues/detail?id=794
2013-02-05 00:27:20 -08:00
Juliusz Gonera 2d42b52c67 Make require.stub() optionally accept a factory function
require.stub() can now accept a factory function instead of an object
so that stubbed modules are initialized lazily:

require.stub('zlib', function() {
    // initialized once, when zlib first required
    return {
        createGzip: function() { ... }
    };
});

http://code.google.com/p/phantomjs/issues/detail?id=1044
2013-02-05 00:04:17 -08:00
Julian Szulc 1e5638678d Fix ignoring ssl errors on synchronous xhrs
disabling peer verify in ssl configuration when ignore-ssl-errors is set

issue http://code.google.com/p/phantomjs/issues/detail?id=985
2013-02-05 00:01:50 -08:00
James M. Greene 1604b4d6c1 Updated help output to prefer true/false to yes/no
Similarly, I updated the API Reference too:
7cddd19676

This arguably makes more sense to PhantomJS's typical audience of web developers.
2013-02-04 23:58:10 -08:00
James M. Greene e6ae4cca6d Adding the whole 'bin' folder to '.gitignore'
On Windows, there are 3 files produced in the 'bin' folder and none of them should be checked in.
2013-01-29 00:02:23 -06:00
Ariya Hidayat 43ab20d4ae Prevent possible crash on pages with iframes.
In some cases, setupFrame() has not been invoked (due to the queued
signal-slot connection) after the frame is destroyed and thus leads
to the crash. We prevent this from happening by making sure it is a
direct connection instead and therefore setupFrame() will be executed
as soon as possible.

Investigation + patch by Vitaliy Slobodin <vitaliy.slobodin@gmail.com>.

http://code.google.com/p/phantomjs/issues/detail?id=947
2013-01-28 21:13:47 -08:00
Jeff Boulter ec6b242a9f Fixed the CreationDate value format when creating PDFs.
This was confusing Adobe Reader and not allowing it to save PDFs.

This bug appears to have been introduced in commit 08fc50d149 which was applying the patch from http://qt.gitorious.org/qt/qt/merge_requests/706 but missed two lines.

This should fix issue http://code.google.com/p/phantomjs/issues/detail?id=663 .
2013-01-25 00:12:06 -08:00
Matthew Barr fe78d4d9fe Updated rpm spec file to work with 1.8.
http://code.google.com/p/phantomjs/issues/detail?id=1012
2013-01-25 00:04:20 -08:00
bongole 0734811514 Add rendering to stdout and stderr.
This feature renders PDF, GIF and other format supported by Qt to
stdout or stderr.

*NOTE*
"/dev/stdout" and "/dev/stderr" are converted to System::stdout and
System::stderr on Windows.

Issue: https://code.google.com/p/phantomjs/issues/detail?id=973
2013-01-21 21:44:18 -08:00
Vitaliy Slobodin 6d81933941 Pass the resource URL to the resourceError handler.
http://code.google.com/p/phantomjs/issues/detail?id=997
2013-01-21 21:42:10 -08:00
Ariya Hidayat 797b47ae81 Update ChangeLog.
http://code.google.com/p/phantomjs/issues/detail?id=939
2013-01-17 21:48:06 -08:00
Ivan De Marino 7e7325c0f5 Fixing up indentation for our Jasmine test specs.
Just getting rid of an itch of mine.
2013-01-17 23:52:47 +00:00
Ivan De Marino 12bb24f418 FIX: 'resource request errors' close the server.
The test "should handle resource request errors"
was not closing the server at the end of the test,
interfering with the successive tests.
2013-01-17 23:47:41 +00:00
Ivan De Marino 4dec091ac2 FIX: Check file exist when attempting upload.
Both "page.uploadFile()" and "onFilePicker = function() {}" check file exists before accepting them.
If file don't exists, they are "ignored".

Fixes issue #941: https://code.google.com/p/phantomjs/issues/detail?id=941
2013-01-17 23:45:34 +00:00
Vitaliy Slobodin a7a3928af9 Fix compilation on Windows.
We need to include QtCore/qt_windows.h on Windows since Q_PID mapped to
_PROCESS_INFORMATION, but _PROCESS_INFORMATION not defined.

Issue:
http://code.google.com/p/phantomjs/issues/detail?id=219
2013-01-16 08:00:52 -08:00
James M. Greene 1a487d2bbf Added myself to the copyright list 2013-01-16 08:00:51 -08:00
James M. Greene 360dc3a30c Corrected default value for disk-cache help
Fixes http://code.google.com/p/phantomjs/issues/detail?id=908
2013-01-16 08:00:51 -08:00
Ariya Hidayat 34ed1169f3 Record more changes for the upcoming 1.9.
http://code.google.com/p/phantomjs/issues/detail?id=939
2013-01-09 20:35:00 -08:00
Ariya Hidayat d58eae54d7 Ensure we describe onNavigationRequested behavior properly.
http://code.google.com/p/phantomjs/issues/detail?id=562
2013-01-09 20:26:55 -08:00
Ariya Hidayat aaca7774c9 Vagrant setup: Don't clone PhantomJS into Git build directory.
http://code.google.com/p/phantomjs/issues/detail?id=963
2013-01-09 01:03:27 -08:00
Oleg Pudeyev 26e51f4b8a -ldl is needed only on Linux, not on all Unices.
In particular on FreeBSD there is no -ldl as the respective
functionality is in -lc.

http://code.google.com/p/phantomjs/issues/detail?id=597
2013-01-09 00:07:36 -08:00
Oleg Pudeyev c3c17a5364 Use hw.ncpu sysctl on FreeBSD to determine processor count.
Patch by Mike Meyer.

http://code.google.com/p/phantomjs/issues/detail?id=597
2013-01-09 00:07:14 -08:00
Oleg Pudeyev 52e67c5aa7 Use bash from PATH rather than hardcoded in /bin.
E.g. FreeBSD has bash in /usr/local.

http://code.google.com/p/phantomjs/issues/detail?id=597
2013-01-09 00:06:58 -08:00
Ariya Hidayat 69bf72bca7 Setup Vagrant to build Linux packages on CentOS 5.
The goal is to use old glibc so that it can reach more audience (in
particular, RHEL and CentOS users).

Also, we don't compress the executable (using UPX) so that it can be
inspected with ldd. Bonus: no more decompression overhead, faster
startup.

http://code.google.com/p/phantomjs/issues/detail?id=963
2013-01-05 09:35:27 -08:00
Ariya Hidayat aa907343b9 Record more changes for the upcoming 1.9.
http://code.google.com/p/phantomjs/issues/detail?id=939
2013-01-04 23:44:36 -08:00
Vitaliy Slobodin 09e929d599 Allow to abort network requests.
Issue: http://code.google.com/p/phantomjs/issues/detail?id=230
2013-01-04 23:39:23 -08:00
Vitaliy Slobodin fd700b0702 New WebPage callback: onResourceError.
This callback is invoked when the WebPage was unable to request the resource

Issue: http://code.google.com/p/phantomjs/issues/detail?id=954
2013-01-04 21:24:30 -08:00
execjosh d906bc3819 Automate lazy generation of REPL completion lists
All invokable methods, slots, signals, and properties visible from
JavaScript, but which do not start with an underscore, are lazily
(only when necessary) added to the completion list through dynamic
reflection.

This leverages `QMetaObject` for reflection of `QObject`s.  As such,
there is now no need to inherit `REPLCompletable` and it has been
removed.

http://code.google.com/p/phantomjs/issues/detail?id=943
2013-01-04 21:23:58 -08:00
Ariya Hidayat d0fe6864a9 Mac OS X: Fix possible crash when using some TrueType fonts.
This is just a workaround. We simply avoid removing the custom font
(intentionally leak it, a small price to pay) because otherwise it will
invalidate Qt's font cache, which in turns trigger the crash at
CoreText's CTFontCopyGraphicsFont.

http://code.google.com/p/phantomjs/issues/detail?id=690
2012-12-30 21:17:40 -08:00
Ariya Hidayat 2a2b6e455c Mac OS X: Add a manual test for the crash with TrueType fonts.
http://code.google.com/p/phantomjs/issues/detail?id=690
2012-12-30 21:17:39 -08:00
execjosh f52044cd31 Emulate spawn and execFile from node.js's child_process module
This is a rudimentary implementation of the following methods
from [node.js's `child_process` module][1]:

 *  `spawn`
 *  `execFile`

The examples are relevant only for *nix operating systems...

The following methods are Not Yet Implemented™:

 *  `exec`
 *  `fork`

[1]: http://nodejs.org/docs/v0.8.16/api/child_process.html

http://code.google.com/p/phantomjs/issues/detail?id=219
2012-12-29 01:03:08 +09:00
Ariya Hidayat 83e8152dd6 Collect some changes for the upcoming 1.9.
http://code.google.com/p/phantomjs/issues/detail?id=939
2012-12-25 22:37:00 -08:00
Ariya Hidayat 98ce8922c6 ChangeLog: Add missing window.location fix.
http://code.google.com/p/phantomjs/issues/detail?id=863
2012-12-25 22:36:53 -08:00
execjosh 836719f72e Implement CommonJS IO/A read([n Number])
The [IO/A spec][1] for `read` is as follows:

> Read up to n bytes from the stream, or until the end of the stream
> has been reached. [If] n is null, reads up to the block size of the
> underlying device, or up to 1024 bytes if the block size is not
> discernible. If n is not specified, this method always reads the
> full stream until its end is reached. ...

Since discovering the block size of the underlying device is
non-trivial, we will just default to 1024.

**NOTE**

The initial implementation of `File::read()` saves the current
(original) position, seeks to the beginning of the stream,
`readAll`s to the end, and then resets to the original position.

  I think that this behavior is unexpected and should be changed--it
should read from the current position to the end of the stream and
stay there.  The user should explicitly `seek` to the beginning of
the stream when necessary.

  With the current implementation, the user should note that the
position *will not change* after calling `read()` with no arguments.

[1]: http://wiki.commonjs.org/wiki/IO/A#Instance_Methods

http://code.google.com/p/phantomjs/issues/detail?id=938
2012-12-25 20:46:14 -08:00
execjosh 6bc3a93118 Add `seek` method to `File` class
This method is necessary for random-access streams.  It will also be
helpful in the future when implementing the [IO/A spec][1].

[1]: http://wiki.commonjs.org/wiki/IO/A#Instance_Methods

http://code.google.com/p/phantomjs/issues/detail?id=937
2012-12-25 13:11:20 -08:00
execjosh f6c87221a7 Implement system.std{in,out,err}
See [issue 333][1] and pull request #192.

**Caveat**

`File::read` currently takes no parameters and is equivalent to a
"`readAll`".  This will be changed later to match [IO/A Spec's
`Stream#read`][2]; but, should still be noted.

[1]: http://code.google.com/p/phantomjs/issues/detail?id=333
[2]: http://wiki.commonjs.org/wiki/IO/A#Instance_Methods
2012-12-25 03:41:34 -08:00
Ken Collins e3517f108a Add Mocha-PhantomJS
This project has gotten a pretty good following over the past few months. Would be great to have it in the list.
2012-12-24 17:06:34 -05:00
Ariya Hidayat d7652abc11 Unix packaging: Fix UPX detection for binary compression.
As pointed out by Cristian Ciupitu, our UPX detection logic was broken.
This is now fixed by using `type` to look for the executable.

http://code.google.com/p/phantomjs/issues/detail?id=928
2012-12-23 14:36:24 -08:00
Ariya Hidayat 3f42fb230f Linux: Ensure we use 72 dpi.
For our QPA/Lighthouse platform screen, apparently we need to specify the
physical screen size because otherwise the default 100 dpi will be used.

This also brings font rendering on headless Linux to 72 dpi.

http://code.google.com/p/phantomjs/issues/detail?id=659
2012-12-23 12:03:10 -08:00
Ariya Hidayat fac15407e8 Call the development branch as version 1.9. 2012-12-23 08:57:37 -08:00
execjosh 3458d4d507 Use fs.join(...) instead of fs.separator
http://code.google.com/p/phantomjs/issues/detail?id=361
2012-12-22 23:06:20 -08:00
execjosh 03500e6b55 Implement fs.{split(path),join(...),{to,from}NativeSeparators}
For fs.{split,join} specs, see: http://wiki.commonjs.org/wiki/Filesystem/A#Paths_as_Text

http://code.google.com/p/phantomjs/issues/detail?id=361
2012-12-22 23:05:46 -08:00
Vitaliy Slobodin fc7a5b7b9f Add a bunch of gitignores for Windows 2012-12-22 22:36:04 -08:00
Ariya Hidayat c33b916cfb More 1.8 materials.
http://code.google.com/p/phantomjs/issues/detail?id=863
2012-12-21 22:12:05 -08:00
Ivan De Marino d998c59358 Importing GhostDriver v1.0.2.
Changes listed here: https://github.com/detro/ghostdriver/issues?labels=1.0.2&page=1&state=closed
2012-12-19 19:29:54 -08:00
Ariya Hidayat 8836398825 Generalize WebServer binary data handling into a real encoding support.
http://code.google.com/p/phantomjs/issues/detail?id=505
2012-12-17 23:12:48 -08:00
Sebastian Krzyszkowiak f70a6ab4ee Add test case for WebServerResponse::setEncoding
http://code.google.com/p/phantomjs/issues/detail?id=505
2012-12-17 19:27:19 -08:00
Sebastian Krzyszkowiak 78e72312dc Implement WebServerResponse::setEncoding in order to allow binary encoding to be sent.
Fixes http://code.google.com/p/phantomjs/issues/detail?id=505
2012-12-17 19:27:06 -08:00
Ivan De Marino 302050e0ce Fixing typo in GhostDriver 1.0.1 2012-12-17 19:15:43 -08:00
Ariya Hidayat 9a8b84a293 More changes for 1.8.
http://code.google.com/p/phantomjs/issues/detail?id=863
2012-12-16 23:16:37 -08:00
Ariya Hidayat 9c0888d54d Fix potential hang in the example scripts due to missing exit() call.
Patch by Jônatas Pedraza <jonatas.nona@gmail.com> and Vivek Galatage
<vivekgalatage@gmail.com>.

http://code.google.com/p/phantomjs/issues/detail?id=922
2012-12-16 23:02:44 -08:00
David Burrows 15fe514025 Increase maximum number of redirects in line with modern browsers.
Modern browser mostly limit re-directs to 20. The current limit in  PhantomJS is 10 which is not in line with most browsers. This patch is a simple increase of gMaxRedirections from 10 to 20.

http://code.google.com/p/phantomjs/issues/detail?id=849
2012-12-16 22:21:07 -08:00
qubird f6a91a8813 New WebPage#setContent api - makes possible to specify location along with content
http://code.google.com/p/phantomjs/issues/detail?id=909
2012-12-16 15:43:10 -08:00
Ariya Hidayat daae36c3ba Some changes for 1.8.
http://code.google.com/p/phantomjs/issues/detail?id=863
2012-12-16 14:48:28 -08:00
fastclemmy 3b2a1c27a1 Update examples/pizza.coffee.
Guess the DOM has changed a little. No more class .address but an (incorrectly used) <address> tag instead. (same pull request as the vanilla JS example)

http://code.google.com/p/phantomjs/issues/detail?id=921
2012-12-16 14:20:57 -08:00
fastclemmy 8f14ef027e Fix examples/pizza.js.
Guess the DOM has changed a little. No more class .address but an (incorrectly used) <address> tag instead.

http://code.google.com/p/phantomjs/issues/detail?id=921
2012-12-16 14:19:57 -08:00
Ivan De Marino 027aa93b18 Importing GhostDriver version `1.0.1`.
Changes are documented here:
https://github.com/detro/ghostdriver/issues?labels=1.0.1&state=closed.

https://github.com/detro/ghostdriver/issues/130
2012-12-16 13:55:58 -08:00
Ivan De Marino f5652e5110 Fix "--webdriver-selenium-grid-hub" CLI parameter.
I had forgotten to update the option parsing code,
and the option was never picked.

Related issue: [GhostDriver #130](https://github.com/detro/ghostdriver/issues/130).
2012-12-13 23:45:54 -08:00
Vitaliy Slobodin 04b74f99fd Enable WOFF file support.
Background:
WOFF format requires that WebKit should be compiled with zlib.

Related issues:
http://code.google.com/p/phantomjs/issues/detail?id=592
2012-12-12 21:42:58 -08:00
Jon Leighton eb3c9caa6e Upgrade to Qt 4.8.4
http://code.google.com/p/phantomjs/issues/detail?id=918
2012-12-12 21:42:45 -08:00
Jon Leighton 66ab9a1113 Fix memory leak on linux
We were previously adding the certificates on each instantiation of
NetworkAccessManager, causing memory consumption to grow unbounded.

I have also removed the Qt version check. It's unnecessary as we only
build against a fixed Qt version.

https://code.google.com/p/phantomjs/issues/detail?id=882
2012-12-12 21:25:26 -08:00
Vitaliy Slobodin 5eb0f64e6b Fix window.location.
Description:
Web Page can't navigate to a relative url using the property 'window.location'.

Upstream bug:
https://bugs.webkit.org/show_bug.cgi?id=47978

Issues:
http://code.google.com/p/phantomjs/issues/detail?id=632
http://code.google.com/p/phantomjs/issues/detail?id=530
2012-12-12 17:03:37 +04:00
James M. Greene 31dd714a22 Added getters for the WebPage#onError and phantom.onError properties
Fixes http://code.google.com/p/phantomjs/issues/detail?id=910
2012-12-11 21:57:25 -08:00
Jon Leighton 487fbf3035 Enable multiple files to be uploaded to a file input
Obviously, the input must have the multiple attribute for this to work.

The API is:

    page.uploadFile('#file_input', ['file1', file2'])

I haven't implemented support for multiple files in the page.filePicker
API because I couldn't work out how to get a return value of an array
of strings through the JS/C++ bridge.

https://code.google.com/p/phantomjs/issues/detail?id=256
2012-12-11 21:41:02 -08:00
James M. Greene e8380e42d7 Added CoffeeScript examples where missing, minor other fixes
Added CoffeeScript examples where missing, minor other fixes such as spacing standardization (2 spaces is the standard in CoffeeScript via Ruby). Also a small set of minor JS example fixes and additional comments.

Fixes http://code.google.com/p/phantomjs/issues/detail?id=907
2012-12-06 14:29:37 -06:00
James M. Greene 4c285c419d Removed an invalid spec file and an invalid spec include.
Fixes http://code.google.com/p/phantomjs/issues/detail?id=906
2012-12-06 08:27:55 -08:00
James M. Greene f61635f2d4 Adding 'WebPage#close' calls where appropriate in example scripts.
Fixes http://code.google.com/p/phantomjs/issues/detail?id=903
2012-12-06 08:27:06 -08:00
James M. Greene c9f9b5a14b Added getters for all of the WebPage signal//callback handlers.
Fixes http://code.google.com/p/phantomjs/issues/detail?id=899
2012-12-05 23:43:50 -06:00
Ariya Hidayat a777797942 Stub for 1.8 changes.
http://code.google.com/p/phantomjs/issues/detail?id=863
2012-12-04 08:41:40 -08:00
Jan Schaumann 94e1f40ad9 Add a spec file to allow creation of an rpm from the (previously built) binary.
http://code.google.com/p/phantomjs/issues/detail?id=897
2012-11-30 22:31:50 -08:00
Milian Wolff fd653fe61f Properly use bottom margin to calculate the footer height.
http://code.google.com/p/phantomjs/issues/detail?id=894
2012-11-29 13:42:18 +01:00
Ivan De Marino 4caa71a6b7 Importing latest GhostDriver, tag "1.0.0".
http://code.google.com/p/phantomjs/issues/detail?id=49
2012-11-27 08:00:45 -08:00
Ivan De Marino ffa9fab316 Embedding GhostDriver into PhantomJS(!!!)
Finally. After so much work, this is finally a reality.
To launch PhantomJS in "Remote WebDriver mode":

```bash
$ phantomjs --webdriver=OPTIONAL_IP:OPTIONAL_PORT
```

Also, GhostDriver brings along support for Selenium Grid: now PhantomJS can register itself to a Selenium Grid HUB.
Just launch it in Webdriver Mode with the following extra options:
```bash
$ phantomjs --webdriver=OPTIONAL_IP:OPTIONAL_PORT --webdriver-selenium-grid-hub=http://url.to.selenium.grid.hub:port
```

http://code.google.com/p/phantomjs/issues/detail?id=49
2012-11-27 07:58:34 -08:00
Ivan De Marino 2dcccc8968 First import of `ghostdriver.qrc` & related files.
http://code.google.com/p/phantomjs/issues/detail?id=49
2012-11-27 07:58:13 -08:00
Vitaliy Slobodin 63dd36205f Don't perform on-demand loading of root certificates on Linux
Description:
Qt is performing loading on-demand of root certificates on Linux, which causing SSL errors.

Issue:
http://code.google.com/p/phantomjs/issues/detail?id=882
2012-11-24 16:41:03 +04:00
Milian Wolff 2d778f687e Repeat thead and tfoot when table contains page breaks.
This was already done in https://github.com/ariya/phantomjs/pull/211
but somehow got lost when the Qt source tree was imported.

Note that I even improved this patch a bit to also properly repaint
the borders of cells in thead/tfoot.

http://code.google.com/p/phantomjs/issues/detail?id=615
2012-11-22 15:39:07 +01:00
Milian Wolff 5c87852c32 Prevent page breaks in table rows.
This was part of a previous PhantomJS release but got reverted
when the Qt source tree was imported. See the old pull request
here: https://github.com/ariya/phantomjs/pull/211

http://code.google.com/p/phantomjs/issues/detail?id=880
2012-11-22 15:38:58 +01:00
Ivan De Marino 9ba13ba989 Implementing "goBack", "goForward" and "go".
Completing work for [Issue #808](http://code.google.com/p/phantomjs/issues/detail?id=808).
2012-11-18 16:11:25 -08:00
Vitaliy Slobodin 40a14b72b1 Restore dirty line logic in RenderInline::destroy.
WebKit upstream fix: http://trac.webkit.org/changeset/86060
WebKit upsteam bug: https://bugs.webkit.org/show_bug.cgi?id=60448

Related issues:
http://code.google.com/p/phantomjs/issues/detail?id=704
http://code.google.com/p/phantomjs/issues/detail?id=703
http://code.google.com/p/phantomjs/issues/detail?id=675
http://code.google.com/p/phantomjs/issues/detail?id=689
http://code.google.com/p/phantomjs/issues/detail?id=532
http://code.google.com/p/phantomjs/issues/detail?id=851
2012-11-14 11:28:58 -08:00
Ariya Hidayat 559afcd4e8 Bump the version.
http://code.google.com/p/phantomjs/issues/detail?id=863
2012-11-10 01:45:54 -08:00
Ariya Hidayat 59dbd77ef5 Ask for a confirmation before initiating the build.
Although it is mentioned in http://phantomjs.org/build.html, many people
are not aware this, they compile from source (even if a binary package
is available) and get shocked to realize the build takes ages.
The build script is thus modified to give the initial warning.

Unattended build is still possible, just use --confirm flag.

http://code.google.com/p/phantomjs/issues/detail?id=862
2012-11-10 00:11:14 -08:00
Ariya Hidayat 7b84e43a10 Merge remote-tracking branch 'JamesMGreene/ExposeProcessId' 2012-11-08 06:24:32 -08:00
James M. Greene 280305797e Exposing the Process ID (PID) via the System module.
`require('system').pid` should return your PhantomJS instance's Process ID.

http://code.google.com/p/phantomjs/issues/detail?id=769
2012-11-06 11:49:55 -06:00
Ivan De Marino eadb03a978 Adding "page.onFilePicker" callback.
This addresses [Issue #843](http://code.google.com/p/phantomjs/issues/detail?id=843).
Important: this doesn't change the ability to use
"page.uploadFile", that will keep working as expected.
2012-11-03 18:41:18 +00:00
Ivan De Marino 1fa9c04845 Reworking code related to Issue #800.
This addresses [Issue #842](http://code.google.com/p/phantomjs/issues/detail?id=842).
2012-11-03 14:38:23 +00:00
Ivan De Marino 7c7d1f961c Adding "date" detection to `detectType`
Addresses [Issue #800](http://code.google.com/p/phantomjs/issues/detail?id=800)
2012-11-03 14:38:22 +00:00
Ivan De Marino 4c5e96d17f FIX: Multiple "onCallback" handlers registered.
Addresses [Issue #807](http://code.google.com/p/phantomjs/issues/detail?id=807)
2012-11-03 14:38:22 +00:00
Ivan De Marino b113993314 MINOR: Avoid frame switching if already there.
Useless to change frame if it's already the right one.
Makes it clearer what is going on when debugging.
2012-11-03 14:38:22 +00:00
Ivan De Marino 3fe308bf8c Adding Navigation methods.
Addresses [Issue #808](http://code.google.com/p/phantomjs/issues/detail?id=808)

* back()        [method]
* canGoBack     [property - boolean]
* forward()     [method]
* canGoForward  [property - boolean]
* reload()      [method]
* stop()        [method]

This is to fill a small gap we ought to deal with.
IMPORTANT: this API is asynchronous. Events
like "onLoadStarted" and "onLoadFinished" are
ideal to monitor the activity of those methods.
2012-11-03 14:38:22 +00:00
Ivan De Marino 9cf6cbe818 MINOR: Fixing typo - "splice !== slice" 2012-11-03 14:38:21 +00:00
Ivan De Marino d5eb657ecc More Douglas Crockford remedials.
Addresses [Issue #800](http://code.google.com/p/phantomjs/issues/detail?id=800)
2012-11-03 14:38:21 +00:00
Ivan De Marino e31528adfe "onLoadFinished" works regardless of "page.open"
Addresses [Issue #801](http://code.google.com/p/phantomjs/issues/detail?id=801)
2012-11-03 14:38:21 +00:00
Ivan De Marino 60ced2ccb6 Provide "detectType" inspired by D. Crockford
Addresses [Issue #800](http://code.google.com/p/phantomjs/issues/detail?id=800)
2012-11-03 14:38:21 +00:00
Ivan De Marino 3f874067f5 Add properties "page.title" and "page.frameTitle"
Addresses [Issue #799](http://code.google.com/p/phantomjs/issues/detail?id=799)
2012-11-03 14:38:21 +00:00
Jim Evans 42bf8b36d8 Making webserver module read request bodies and write response bodies using UTF-8 2012-11-03 14:38:21 +00:00
Jim Evans 395af9cada Correcting keycodes sent for lowercase characters
http://code.google.com/p/phantomjs/issues/detail?id=852
2012-11-02 20:41:57 -07:00
Jim Evans c2df526110 Fixing sending of double-click events
http://code.google.com/p/phantomjs/issues/detail?id=848
2012-11-01 07:18:40 -07:00
Ivan De Marino f2628b32fe Fix compilation issue on Ubuntu.
Reported [here](https://github.com/ariya/phantomjs/commit/402a8d9753395edffb4811aa1834ff31a051e27#commitcomment-2079231).
Conversion from `NULL` to `QVariant()` doesn't work implicitly on Ubuntu.

http://code.google.com/p/phantomjs/issues/detail?id=835
2012-10-31 20:38:16 -07:00
Vitaliy Slobodin f3d920908a QSslConfiguration: SSLv3 should be the default value
http://code.google.com/p/phantomjs/issues/detail?id=174
2012-10-29 06:36:11 -07:00
Vitaliy Slobodin b834f2a590 Allow to specify the SSL protocol for a requests.
http://code.google.com/p/phantomjs/issues/detail?id=174
2012-10-29 06:36:08 -07:00
Jim Evans 380c56e672 Adding test for sendEvent with modifier key
http://code.google.com/p/phantomjs/issues/detail?id=835
2012-10-28 20:58:51 -07:00
Jim Evans f402a8d975 Implementing modifier keys in sendEvent()
http://code.google.com/p/phantomjs/issues/detail?id=835
2012-10-28 20:56:46 -07:00
Johan Sköld b7ca845327 Gave page a maxAuthAttempts setting.
QtWebKit normally loops infinitely trying to authenticate when it receives a
401 code, preventing all callbacks (onLoadFinished, onResourceReceived, etc).
This commit changes it to only try a set amount of times before aborting.

https://code.google.com/p/phantomjs/issues/detail?id=826
2012-10-24 00:02:59 -07:00
Vitallium 35c1971595 Fix parsing dates in ISO8601 format.
Issues:
http://code.google.com/p/phantomjs/issues/detail?id=187
http://code.google.com/p/phantomjs/issues/detail?id=267
2012-10-24 00:00:58 -07:00
Ivan De Marino e521dc16e7 Adding a simple example to help understand events.
Lots of discussions on the ML could be easily put
to rest if people could run something like this
and see the result.
It's not a real fix or improvement, just a "cute"
example and as such I didn't raise a "proper"
issue.
2012-10-16 21:50:53 -07:00
Ariya Hidayat 4f17d94afd Update the link to the crash reporting guide.
http://code.google.com/p/phantomjs/issues/detail?id=576
2012-09-28 08:03:25 -07:00
Vitaliy Slobodin 2403c00e59 Added version info for Windows
http://code.google.com/p/phantomjs/issues/detail?id=797
2012-09-24 07:57:01 -07:00
Ariya Hidayat 8ba3c52d50 Stop potential crash by guarding the access to the page.
Based on the work from Shawn Krisman (krisman.shawn@gmail.com).

http://code.google.com/p/phantomjs/issues/detail?id=719
2012-09-24 07:33:48 -07:00
Ariya Hidayat 63e06cbcbf Revert breaking behavior in commit ecda224233.
Keeping the page alive instead of destroying causes unexpected behavior
compared to version 1.6 and earlier. See the discussion:
https://groups.google.com/d/topic/phantomjs/C84fmd21LDk/.

http://code.google.com/p/phantomjs/issues/detail?id=719
2012-09-24 07:31:27 -07:00
Ariya Hidayat f29827f201 README: Clarify capture-able contents.
http://code.google.com/p/phantomjs/issues/detail?id=764
2012-09-23 22:37:17 -07:00
Ariya Hidayat 9a0f8d0e3a Point to the new wiki.
http://code.google.com/p/phantomjs/issues/detail?id=764
2012-09-23 22:34:12 -07:00
Ariya Hidayat 703a4d14e4 Breakpad symbol tool: Make sure it builds on Mac.
https://code.google.com/p/phantomjs/issues/detail?id=576
2012-09-23 22:20:35 -07:00
Ariya Hidayat 5e91e5355d Blazing Star.
http://code.google.com/p/phantomjs/issues/detail?id=764
2012-09-22 21:29:20 -07:00
Ariya Hidayat b9e1ced36f Bracing for "Blazing Star".
http://code.google.com/p/phantomjs/issues/detail?id=764
2012-09-22 20:24:58 -07:00
Ariya Hidayat e5b040ed1a Advertise the migrated wiki pages. 2012-09-22 19:58:04 -07:00
Ariya Hidayat 7921cb00e1 Remove non-working weather example.
The example stops working since the request is blocked. It needs a
rewrite to use a different service.

http://code.google.com/p/phantomjs/issues/detail?id=794
2012-09-22 13:39:19 -07:00
Ariya Hidayat 58f970a30d Remove outdated Debian control files.
Rather than advertising wrong info (PyPhantomJS etc), debian/ is
removed until new up-to-date content is prepared.

http://code.google.com/p/phantomjs/issues/detail?id=793
2012-09-21 07:51:14 -07:00
Ivan De Marino 32e23339bd Fixing issue with CookieJar not loading at boot.
* Using the "QTimer::singleShot" bites back in the ass
* The "script" takes priority and runs before the SLOT is actually invoked

Why was I using a Timer?
Not sure anymore: it must have slipped in while I was trying to work out
all the other issues I had with QNetworkCookieJar, and I left it there.

http://code.google.com/p/phantomjs/issues/detail?id=790
2012-09-21 07:39:12 -07:00
Ariya Hidayat 8ab4209e0f More changes for the upcoming 1.7.
http://code.google.com/p/phantomjs/issues/detail?id=764
2012-09-21 00:31:51 -07:00
Ian Oxley e85140e80f Non-zero exit code if any test fails.
In the callback function passed to `waitFor`, the call to `page.evaluate`
returns a 1 or 0, and this is then passed to `phantom.exit` (with a 1
indicating at least one test failed, 0 indicating all tests passed).

http://code.google.com/p/phantomjs/issues/detail?id=792
2012-09-21 00:12:52 -07:00
Ian Oxley 1dbd371540 Added 'tests passed' message.
If all tests pass, a message indicating this is output to the console.

http://code.google.com/p/phantomjs/issues/detail?id=792
2012-09-21 00:12:30 -07:00
Ian Oxley be767ee983 Test failure CSS selectors changed.
Changed the CSS selectors used to identify failed tests.

The old selector was `div.jasmine_reporter > div.suite.failed`,
but this no longer seems to match any elements.

The new selector is `.results > #details > .specDetails.failed`. For each
failing test the `.description` and `.resultMessage.fail` elements are
used to output the failures to the console.

http://code.google.com/p/phantomjs/issues/detail?id=792
2012-09-21 00:11:43 -07:00
Ian Oxley 2662d5875b Changed CSS selector used when checking for whether tests have finished.
When using the jasmine 1.2.0 standalone version, `.runner .description`
doesn't seem to match any elements.

I noticed pending tests can be found using the CSS selector
`.symbolSummary .pending`, so changed the testFx callback to check
that no elements are left matching this selector.

http://code.google.com/p/phantomjs/issues/detail?id=792
2012-09-21 00:11:24 -07:00
Shawn Krisman ecda224233 Revert "Fix crash on exit (Issues #136, #148 and #149)"
This reverts commit 5acaa6b42d.

Conflicts:

	src/phantom.cpp
	src/phantom.h

removed m_page deletion.

http://code.google.com/p/phantomjs/issues/detail?id=719
2012-09-21 00:07:09 -07:00
Ariya Hidayat 9f8056334e Keep ARGB32 premultiplied format for Windows for the time being.
http://code.google.com/p/phantomjs/issues/detail?id=785
2012-09-21 00:05:18 -07:00
Ariya Hidayat 18ca114111 Windows: Use ARGB32 premultiplied to have better font rendering.
Thanks to Vitaliy Slobodin for the analysis.

http://code.google.com/p/phantomjs/issues/detail?id=785
2012-09-20 23:52:05 -07:00
Ariya Hidayat cab2635e66 Make the key enums as part of WebPage instance.
This way, we don't add anything into phantom object.

http://code.google.com/p/phantomjs/issues/detail?id=492
2012-09-20 23:44:06 -07:00
Jon Leighton e7c37d4a2b Fix --help and --version
https://code.google.com/p/phantomjs/issues/detail?id=789
2012-09-19 21:56:56 +01:00
Ariya Hidayat 0d63e9c0a8 Contribution guide: highlight various aspects of communication.
http://code.google.com/p/phantomjs/issues/detail?id=783
2012-09-18 18:23:19 -07:00
Ariya Hidayat 9a25f31715 Merge pull request #319 from detro/ghostdriver-dev
GhostDriver Development Branch - Master Push #4
2012-09-18 18:08:07 -07:00
Ivan De Marino 26583740c8 Made the "Callbacks injection" recursive.
Before this, only the first level of child frames had the possibility to use
the Callbacks object. Now is injected recursively in all of them.

This is an extension of coverage for [Issue #683](http://code.google.com/p/phantomjs/issues/detail?id=683).
2012-09-18 22:46:14 +01:00
Ivan De Marino e5ebcf90df Git-ignoring debugging-helper on mac 2012-09-18 14:57:59 +01:00
Ivan De Marino b1185cd22a Redesign the Cookies API (part 2)
Addresses [Issue #761](http://code.google.com/p/phantomjs/issues/detail?id=761).

This is a combination of 5 commits.

1. Date in Cookie can be set via "seconds since epoch" as well.

* In addition to the current string format, we can now set cookies via integer of msec since epoch
* Expiration date can be set via "expires" or "expiry" option ("expires" has priority)
* Returned cookie will contain "expires" as string and "expiry" as msec since epoch

I believe this can simplify code that uses cookies and it doesn't change the functionality.

2. Applying the "--debug" command line options as early as possible.

3. Fixing bug and behaviour in the CookieJar

* It's not possible to set a cookie without a domain: will default to the domain of the page it's set on
* "page.clearCookies()" was broken
* "cookiejar.deleteCookie("name", url)" reimplemented because deleting via "expiration" doesn't work

4. Improving (and more fixing) in the CookieJar

* Purging Session or Expired Cookies now works
* Added boolean return values to inform if the requested cookie operation succeeded
* Timestamps for "expiry/expires" in Milliseconds, as JS does by default
* Improved detection that a cookie has been accepted or rejected by the cookiejar

NOTE: Unfortunately, the Qt provided QNetworkCookieJar is a very limited
and not extremely well designed solution. It doesn't provide any "nice
and clean" CRUD API, and you are only left with a SET/GET to deal with.
Mechanism to understand when and when not a cookie is added are hidden,
and require extra work in the sub-class (our CookieJar) to fill the gap.

5. Methods on the "phantom" object to manipulate the CookieJar.

* phantom.cookies (array of JSON/Cookies)
* phantom.cookiesEnabled (boolean)
* phantom.addCookie
* phantom.deleteCookie
* phantom.clearCookies

Those methods operate on the CookieJar directly and have no URL restriction.
In other words, if page P1 can see set of cookies C1, and page P2 can see set of
cookies C2, "phantom.cookies" can see (i.e. operate upon) both C1 and C2.
2012-09-18 08:42:13 +01:00
Ariya Hidayat 64fa65edaf More changes for the upcoming 1.7.
http://code.google.com/p/phantomjs/issues/detail?id=764
2012-09-18 00:41:20 -07:00
Ariya Hidayat 22c8e5610f Fix the link to the contribution guide.
http://code.google.com/p/phantomjs/issues/detail?id=783
2012-09-17 23:41:23 -07:00
Ariya Hidayat 2c4e95ad3e Use GitHub contributing guide feature.
See https://github.com/blog/1184-contributing-guidelines.

http://code.google.com/p/phantomjs/issues/detail?id=783
2012-09-17 23:37:18 -07:00
Zhaolong 62584ce7d4 Remove the dirty link hack for a static PhantomJS + MSVC.
http://code.google.com/p/phantomjs/issues/detail?id=753
2012-09-17 22:13:40 -07:00
Ryan Cumming 23fe144a39 Treat all args after the script name as script args
This fixes CapserJS which builds a command line like this:
phantomjs bin/bootstrap.js --casper-path=~/capserjs --cli

That works on Phantom 1.6 but not on master due to the qcommandline
port.

Fix by extending qcommandlne to take a ParameterFence flag which causes
it to treat any options after a parameter as arguments. Switch
"scriptname" to use that so the 1.6 behaviour is restored.

http://code.google.com/p/phantomjs/issues/detail?id=55
2012-09-17 22:05:42 -07:00
Harry Waye 4f7df7073a Maintain m_currentFrame as opposed to using QWebPage's currentFrame().
Currently focused frame made available with page.focusedFrameName and page.switchToFocusedFrame.

http://code.google.com/p/phantomjs/issues/detail?id=683
2012-09-17 21:59:05 -07:00
Ariya Hidayat e33bfedb9a Merge pull request #317 from Vitallium/fix-missing-ico-plugin-win
Rendering ICO images on Windows.
2012-09-17 21:58:07 -07:00
Vitaliy Slobodin af49821cf4 Render ICO images on Windows.
ICO images are not rendered on Windows due to missing ICO plugin.

Issue: http://code.google.com/p/phantomjs/issues/detail?id=779
2012-09-17 10:46:49 +04:00
Ariya Hidayat 1558c07a76 Merge pull request #314 from JakubOboza/patch-1
Update src/config.cpp
2012-09-14 04:10:31 -07:00
Jakub 1ab5c66df8 Update src/config.cpp
This is a patch to resolve issue i reported in ticket 773 <http://code.google.com/p/phantomjs/issues/detail?id=773>. 
I did build it and run tests seems to be working fine.

I hope this helps a bit :) Also i'm sending friday hugs to everyone on the team.
2012-09-14 12:05:52 +02:00
Ariya Hidayat 795d067f4f Mocha tests can run with PhantomJS.
See https://github.com/metaskills/mocha-phantomjs.
2012-09-13 21:41:09 -07:00
Ariya Hidayat 27d6f908e4 README: Mention the Contribution Guide as early as possible. 2012-09-08 07:04:13 -07:00
Ariya Hidayat 3479beb894 Enumerate some important changes for the upcoming 1.7.
http://code.google.com/p/phantomjs/issues/detail?id=764
2012-09-07 21:12:59 -07:00
Ivan De Marino bd21373732 Redesign the Cookies API
Addresses [Issue #761](http://code.google.com/p/phantomjs/issues/detail?id=761).

This is a squash of 5 commits.

1. Complete reimplementation of the CookieJar and the Cookie API - Part 1.

The save/load mechanism is inspired by the Qt Demo "browser".
More info: http://doc.qt.nokia.com/4.7-snapshot/demos-browser.html

2. Making the CookieJar a singleton.

We need to have multiple NetworkAccessManager to monitor the network activity of the page,
but we also need to maintain 1 CookieJar: in this way we now have a shared bucket of Cookies.

3. Exposing the new Cookies API to the JS space.

* Updated the completions.
* Ensured backward compatibility of the API.
* It's now possible to "phantom.cookieEnabled = false" to disable cookies completely.
* New methods: addCookie, deleteCookie, clearCookies

4. Provided some internal Doc for the new Cookies API

5. Ensuring the "page.deleteCookie(name)" method works only if a cookie name is given.
2012-09-07 00:03:03 -07:00
Ivan De Marino 5cb68a1585 Cleaning up some useless TODO left in the code. 2012-09-05 23:31:31 -07:00
Ivan De Marino 6217d6b960 Adding "url" and some frame-related Q_PROPERTIES
* url - current page url
* frameUrl - current frame url
* frameContent - current frame HTML content
* framePlainText - current frame content in Plain Text (no tags)

Fixes [Issue #758](http://code.google.com/p/phantomjs/issues/detail?id=758)
2012-09-05 21:14:59 -07:00
Ivan De Marino 5b25c6feea Adding support for more Mouse Events.
Support for Mouse Events: Left-click, Right-Click, Middle-Click and Double-Click.
Addresses [Issue 712](http://code.google.com/p/phantomjs/issues/detail?id=712)
2012-09-04 09:49:25 -07:00
Ivan De Marino 70d1ff8392 Adding and Removing appropriate auto-completions (REPL). 2012-09-04 09:49:25 -07:00
Ivan De Marino a65be87642 Fixing wrong parameters manipulations in "page.evaluateAsync". 2012-09-04 09:49:24 -07:00
Ivan De Marino 733d21042b Adding property "page.ownsPages".
When set to "true", any page that gets created, is
owned by the "page" that control it's lifetime.
Also, the pages can be found in the "page.pages[]" array.

Default value is "true".

Addresses [Issue #151](http://code.google.com/p/phantomjs/issues/detail?id=151)
2012-09-04 09:49:24 -07:00
Ivan De Marino 27dc699919 Added "page.close()" and "page.onClosing = function(page){}" callback.
* Addresses [Issue 678](http://code.google.com/p/phantomjs/issues/detail?id=678)
* "page.close()" deprecated "page.release()"
* the callback "onClosing(page)" gets back the reference to the closing page - that can be ideal to have 1 handler for all the page that close
* It works both when closing directly the page, or if the page closes by itself
* If parent closes, child close too

Tests provided.
2012-09-04 09:49:24 -07:00
Ariya Hidayat 0a0fa917ff Add the missing local storage change in Lavender.
http://code.google.com/p/phantomjs/issues/detail?id=598
http://code.google.com/p/phantomjs/issues/detail?id=300
2012-09-04 08:04:26 -07:00
Ariya Hidayat 2e96c7c359 Ensure QCommandLine builds with VS 2010.
The fix is from Vitaliy Slobodin <vitaliy.slobodin@gmail.com>

http://code.google.com/p/phantomjs/issues/detail?id=55
2012-09-04 08:01:33 -07:00
Ariya Hidayat 93686d8306 Allow bypassing automatic use and detection of system proxy.
Pass the command-line option --proxy-type=none to completely bypass any proxy.

http://code.google.com/p/phantomjs/issues/detail?id=580
2012-09-03 18:20:02 -07:00
Ariya Hidayat 4d95cf2783 Show a warning when requesting a secure resource without SSL support.
Special thanks to Thiago Maciera for the tip on "https" scheme.

http://code.google.com/p/phantomjs/issues/detail?id=484
2012-09-03 16:15:49 -07:00
Ivan De Marino b3a0eeff87 Fix handling of boolean values in Config.cpp
http://code.google.com/p/phantomjs/issues/detail?id=55
2012-09-03 13:44:21 -07:00
Ariya Hidayat 3b161b914a Add 'isSSLSupported' to the system module.
http://code.google.com/p/phantomjs/issues/detail?id=484
2012-09-03 06:50:34 -07:00
Ariya Hidayat 08bd78f7b9 Use QCommandLine for command-line options handling.
http://code.google.com/p/phantomjs/issues/detail?id=55
2012-09-03 06:02:05 -07:00
Ariya Hidayat 094d3381e8 Build QCommandLine.
http://code.google.com/p/phantomjs/issues/detail?id=55
2012-09-03 06:02:00 -07:00
Ariya Hidayat a5eb729c9d Modify QCommandLine to suit our needs better.
Allow null shortname for options.
Do not include params in the help text.

http://code.google.com/p/phantomjs/issues/detail?id=55
2012-09-03 06:01:36 -07:00
Ariya Hidayat 614259df0e Import QCommandLine 0.3.0 into our source tree.
http://code.google.com/p/phantomjs/issues/detail?id=55
2012-09-03 05:48:58 -07:00
neraliu 4e1735c899 Implement in-memory cookies storage for CookieJar.
http://code.google.com/p/phantomjs/issues/detail?id=603

Squashed commit of the following:

commit 2087320b9549aa2bba53d73e8a681133e5b4fe96
Author: neraliu <neraliu@gmail.com>
Date:   Sat Jul 14 20:55:17 2012 +0800

    Improve the readability of the function CookieJar::setCookies and CookieJar::cookies.

commit 7ef076e9df488c8f82863cb9c6e31350af5eaad8
Author: neraliu <neraliu@gmail.com>
Date:   Fri Jul 13 18:08:07 2012 +0800

    Fix the indentation problem in the file cookiejar.cpp.
    Remove some commented code segment in cookiejar.cpp.

commit d8fd7f49eb1ba0fb47c27aec9b3dcd36ca14f301
Author: neraliu <neraliu@gmail.com>
Date:   Fri Jul 13 18:04:41 2012 +0800

    Simplify the implementation of CookieJar::setCookiesFromUrl to use the same security policy of QNetworkCookieJar::setCookiesFromUrl in QtWebkit

commit f5e34d2b787bb9714c45a8ad0baff8b5282d3249
Author: neraliu <neraliu@gmail.com>
Date:   Fri Jul 13 17:20:38 2012 +0800

    Simplify the implementation of CookieJar::cookiesForUrl to use the same security policy of QNetworkCookieJar::cookiesForUrl in QtWebkit.

commit 5b10e3788cce7bd69bb71c7ee06f0b49e1e92228
Author: Nera Liu <neraliu@gmail.com>
Date:   Mon Jun 25 10:56:32 2012 +0800

    Remove the clearAllCookies() api by allowing to clear cookies by page.cookies = [] Javascript syntax.

commit a1f12b2913b6f3a3f11a2d22b5eb8c35bf62bf48
Author: Nera Liu <neraliu@gmail.com>
Date:   Sun Jun 24 21:48:49 2012 +0800

    Implement in-memory cookies storage for CookieJar allowing dynamic cookie manipulation via Javascript for issue 603.

    Add sanity check for the in-memory cookies storage for CookieJar.

    http://code.google.com/p/phantomjs/issues/detail?id=603
2012-09-03 04:30:49 -07:00
Jim Evans 55a660f35a Only define _HAS_TR1=0 for Visual Studio 2008 and below.
It is already defined in Visual Studio 2010 and later.

http://code.google.com/p/phantomjs/issues/detail?id=744
2012-09-01 12:08:34 -07:00
Jim Evans e7499d0b33 Windows: Adding static build settings.
(Q_NODLL Q_DECL_IMPORT QT_STATIC_BUILD STATIC) to DEFINES list for WebKit build
to quiet linker warnings.

http://code.google.com/p/phantomjs/issues/detail?id=744
2012-09-01 12:08:05 -07:00
Jim Evans d2c3a078ab Suppressing warning C4099, C4100, C4189.
C4900 (Object declared as a struct is defined as a class), C4100 (A formal
parameter to a function is not referenced in the function body), and
C4189 (A variable is declared and initialized, but not used).

http://code.google.com/p/phantomjs/issues/detail?id=744
2012-09-01 12:07:09 -07:00
Jim Evans b8c28cd42a Removed now-unneeded copy of JavaScriptCore and WebCore object files to different location.
Also replaced single backslash with double backslash in OPENSSL_LIBS variable so paths will be properly escaped.

http://code.google.com/p/phantomjs/issues/detail?id=744
2012-09-01 12:06:35 -07:00
Ilya Grigorik fafa01d6ba Add missing pageref attribute to HAR and end-time.
http://code.google.com/p/phantomjs/issues/detail?id=733

Squashed commit of the following:

commit c6b984442c8631ac13308f5d72fd35973bd964d1
Author: Ilya Grigorik <ilya@igvita.com>
Date:   Sun Aug 26 12:23:03 2012 -0700

    add onLoad to pageTimings

commit d2bb53cd7340e920c62bed557bef4e3a1cdc62b2
Author: Ilya Grigorik <ilya@igvita.com>
Date:   Sun Aug 26 12:01:57 2012 -0700

    add mising pageref attr to each entry
2012-08-28 09:17:54 -07:00
Jim Evans 11e8bb1fcd Fixing Windows-specific path issues with loading of modules
http://code.google.com/p/phantomjs/issues/detail?id=721
2012-08-24 05:21:23 -07:00
Ariya Hidayat 0ea2aa0c35 Explicit mentions of third-party code.
http://code.google.com/p/phantomjs/issues/detail?id=718
2012-08-19 12:02:01 -07:00
Ariya Hidayat ae7f39b4ef Add breakpad support for Windows.
Squashed commit of the following:

commit 947ee621067258adc5af382b496868ea6da6a589
Author: Vitaliy Slobodin <vitaliy.slobodin@gmail.com>
Date:   Fri Aug 17 10:34:34 2012 +0400

    Format code according to http://qt-project.org/wiki/Qt_Coding_Style

commit 5aaaa5338370c77dbd7bf7026949b637da536216
Author: Vitaliy Slobodin <vitaliy.slobodin@gmail.com>
Date:   Thu Aug 16 13:12:05 2012 +0400

    Add breakpad support for Windows (crashdumps).
    Issue: http://code.google.com/p/phantomjs/issues/detail?id=576
2012-08-19 00:26:56 -07:00
Ariya Hidayat be5fe36b98 Merge pull request #300 from jonleighton/crash_text
Link to the crash reporting guide
2012-08-04 11:32:02 -07:00
Jon Leighton 1d23a11bd7 Link to the crash reporting guide 2012-08-04 15:08:37 +01:00
Alessandro Portale f6a26033c9 Make the msvc linker happy again.
http://code.google.com/p/phantomjs/issues/detail?id=424
2012-08-03 01:15:34 -07:00
Ariya Hidayat b3b3578a1f Point to the new download info.
http://code.google.com/p/phantomjs/issues/detail?id=662
2012-08-01 01:23:54 -07:00
Ariya Hidayat c191a00277 Better support for OS X Mountain Lion.
require('system').os.version should give "10.8 (Mountain Lion)".

http://code.google.com/p/phantomjs/issues/detail?id=688
2012-07-31 23:37:53 -07:00
Ariya Hidayat c4de69fcaa Qt: Detect Mountain Lion.
Upstream commit: http://qt.gitorious.org/qt/qt/commit/665355e0ba.

http://code.google.com/p/phantomjs/issues/detail?id=688
2012-07-31 23:34:53 -07:00
Ariya Hidayat 9ca88ea681 Better support for Windows 8.
require('system').os.version should give "8" for Windows 8.

http://code.google.com/p/phantomjs/issues/detail?id=684
2012-07-30 05:07:50 -07:00
Ariya Hidayat 5f88a6b95f Qt: Support Windows 8.
Do not display "Qt: Untested Windows..." when running on Windows 8.

Upstream commit: http://qt.gitorious.org/qt/qt/commit/af7e859a3f.

http://code.google.com/p/phantomjs/issues/detail?id=684
2012-07-30 05:07:41 -07:00
Ariya Hidayat c3b30ac136 Windows: Link to multithreaded static run-time library.
As suggested by Alessandro, this gets rid of run-time requirement of MSVC
run-time library.

http://code.google.com/p/phantomjs/issues/detail?id=424
2012-07-27 20:59:34 -07:00
Ariya Hidayat 5bafcd4f8c Isolate static Windows build to MSVC only.
http://code.google.com/p/phantomjs/issues/detail?id=424
2012-07-27 20:59:20 -07:00
Ariya Hidayat d57c8cc0f7 Fix the right compiler define to isolate the static codec on Windows.
http://code.google.com/p/phantomjs/issues/detail?id=645
http://code.google.com/p/phantomjs/issues/detail?id=598
http://code.google.com/p/phantomjs/issues/detail?id=424
2012-07-27 20:59:01 -07:00
Ariya Hidayat 89593bd63d Isolate codec tricks to Windows for now.
http://code.google.com/p/phantomjs/issues/detail?id=645
http://code.google.com/p/phantomjs/issues/detail?id=598
http://code.google.com/p/phantomjs/issues/detail?id=424
2012-07-27 20:58:40 -07:00
Ariya Hidayat b11c6de9ab WIP: Get the PhantomJS+Qt build for MSVC working.
http://code.google.com/p/phantomjs/issues/detail?id=598
http://code.google.com/p/phantomjs/issues/detail?id=424
2012-07-27 20:58:15 -07:00
Ariya Hidayat 5f1a636583 Changes for 1.6.1.
http://code.google.com/p/phantomjs/issues/detail?id=598
2012-07-27 18:16:26 -07:00
Ariya Hidayat 1602394efb detectsniff example: Fix usage text.
http://code.google.com/p/phantomjs/issues/detail?id=680
2012-07-25 01:37:25 -07:00
Ariya Hidayat 281d291cfb Use the new Twitter handle for the examples.
http://code.google.com/p/phantomjs/issues/detail?id=609
2012-07-15 02:13:35 -07:00
Ariya Hidayat 8d0a0b28ed Some more info on X11-less. 2012-07-15 02:11:50 -07:00
Ariya Hidayat b2af7929fb Use the new Twitter handle. 2012-07-15 02:05:08 -07:00
Jon Leighton 31157fbb98 Make static build work on Linux.
Previously, a static build would produce three separate files:
QtWebKit.a, libjscore.a and libwebcore.a. These seem to have
dependencies on each other and this caused the build errors on Linux.

This change means that the sources of jscore and webcore are both built
directly into the QtWebKit.a target. libjscore.a and libwebcore.a are no
longer built. It is then possible to create a static binary on Linux.

http://code.google.com/p/phantomjs/issues/detail?id=413
2012-07-14 23:32:31 -07:00
Ivan De Marino 0ce4dcd719 Provide more "JS-like" API for the current Frame-Switching API.
This addresses issue [#654](http://code.google.com/p/phantomjs/issues/detail?id=654).
2012-07-13 23:35:25 -07:00
Ivan De Marino 8d2384fd29 Tests for the "new" Frame-Switching API
http://code.google.com/p/phantomjs/issues/detail?id=654
2012-07-13 23:35:10 -07:00
Ariya Hidayat b54612bf68 Fix compile for the event handling.
http://code.google.com/p/phantomjs/issues/detail?id=492
2012-07-13 10:41:38 -07:00
Milian Wolff 1b2a84df9c Make Qt::Key accessible via phantom.keys.
We use the Qt Meta Object system to create an easily accessible QVariantMap
representation of the Key enumerator, such that we can now write something
like for example

page.sendEvent(keypress, phantom.keys.Backspace);

http://code.google.com/p/phantomjs/issues/detail?id=492
2012-07-13 10:32:03 -07:00
Milian Wolff bf6fd70c88 Properly handle strings, chars and umlauts in key[press,down,up] events.
http://code.google.com/p/phantomjs/issues/detail?id=492
2012-07-13 10:32:03 -07:00
Nicolas Perriault 11044a8fbd added tests for new keyboard events
http://code.google.com/p/phantomjs/issues/detail?id=492
2012-07-13 10:32:03 -07:00
Nicolas Perriault 25c48d2ed5 draft implementation of keyboard events
http://code.google.com/p/phantomjs/issues/detail?id=492
2012-07-13 10:31:33 -07:00
Ivan De Marino 5f0ed88a90 Handling "window opening" in PhantomJS.
This addresses [Issue #151](http://code.google.com/p/phantomjs/issues/detail?id=151).

Summary of the new API:
- page.pages[]
- page.pagesWindowName[]
- page.getPage(windowName)
- page.windowName
- page.onPageCreated = function(newPage) { ... }

The page object created by the user holds responsibility of the "child" pages it creates.
If a page closes (i.e. window.close()) or a call to "page.pages[i].release()" is done,
the array "page.pages[]" will automatically update to contain only the pages still open.
2012-07-13 09:56:47 -07:00
Ivan De Marino ea83351da3 Tests for the new "window opening" API
http://code.google.com/p/phantomjs/issues/detail?id=151
2012-07-13 09:56:10 -07:00
Ivan De Marino f869e8408d Sorting out the "web server" module.
Doesn't need a reference to the Config object (for now).
2012-07-13 09:55:52 -07:00
Ivan De Marino 0b04f0a672 Removing unnecessary casting from the "Env" class. 2012-07-13 09:55:45 -07:00
Ivan De Marino 008019ae10 Fixed an annoying FileSytem test that was wrongly designed (by me).
http://code.google.com/p/phantomjs/issues/detail?id=611
2012-07-13 09:52:35 -07:00
Ariya Hidayat 6ce27bbefa Version bump needs a unit test adjustment. 2012-07-13 09:38:57 -07:00
Ariya Hidayat 0632658afe Add a simple example to show how the module system works.
http://code.google.com/p/phantomjs/issues/detail?id=47
2012-07-13 07:58:05 -07:00
Juliusz Gonera 0ce2974ff7 Include the browser version of CoffeeScript too
This is still needed so that injectJs() methods work with CoffeeScript
and so that the main script file can be in CoffeeScript.

It causes duplication of code and some consideration is needed as to
how we could refactor the old inject code so that it uses modules
underneath. Lots of the module functionality written in JS could replace
the old C++ code (CSConverter, most functions in Utils).

http://code.google.com/p/phantomjs/issues/detail?id=47
2012-07-12 23:14:53 -07:00
Juliusz Gonera a02cf63984 Add support for CoffeeScript modules
Instead of using a C++ wrapper, I used a Node version of CoffeeScript
with a small JS wrapper (src/modules/_coffee-script.js). This way, since
the module system is similar enough to the Node.js module system, I only
need to require CoffeeScript in bootstrap.js and all the support for
.coffee is added by CoffeeScript itself.

To include a newer version of CoffeeScript in the source tree, see
tools/import-coffee-script.sh.

http://code.google.com/p/phantomjs/issues/detail?id=47
2012-07-12 23:14:13 -07:00
Juliusz Gonera 2555cb448c Refactor loading of native PhantomJS modules
Now PhantomJS modules are loaded just like any other modules, which
means they should be able to require other native modules inside them if
needed.

http://code.google.com/p/phantomjs/issues/detail?id=47
2012-07-12 23:14:13 -07:00
Juliusz Gonera 15204cb8ae Run modules in an empty context
Previously `this` in modules was set to the global `window` object. Now it
is set to an empty object instead.

http://code.google.com/p/phantomjs/issues/detail?id=47
2012-07-12 23:14:13 -07:00
Juliusz Gonera 5015dbec2a Remove old module tests
New module tests contain all the tests from the old ones.

http://code.google.com/p/phantomjs/issues/detail?id=47
2012-07-12 23:14:12 -07:00
Juliusz Gonera 893108ad11 Fix stack trace when module is not found
The stack trace was missing when an error was thrown because of a
missing module. This should not be the case anymore.

http://code.google.com/p/phantomjs/issues/detail?id=47
2012-07-12 23:14:12 -07:00
Juliusz Gonera ba3eabb29e Refactor nativeRequire() and restructure bootstrap.js
nativeRequire() has been refactored so that native modules are also
wrapped in Module objects. Additionally, native modules are also
cached and included in stack traces if an error occures inside them.

Phantom::loadModuleSource() has been renamed to
Phantom::readNativeModule() so that it's clear that it's used only to
load native modules.

Finally, all the require() code has been move after setting error
handlers in bootstrap.js so that if an error occurs in the require()
code, the stack trace is printed.

http://code.google.com/p/phantomjs/issues/detail?id=47
2012-07-12 23:14:12 -07:00
Juliusz Gonera b22e995337 Fix indentation to 4 spaces in new require() tests
http://code.google.com/p/phantomjs/issues/detail?id=47
2012-07-12 23:14:12 -07:00
Juliusz Gonera fdd727e5da Add Phantom::loadModule
Instead of trying to use sourceId to determine what module threw an
error, we now load module's source code using modified
QWebFrame::evaluateJavaScript and leverage PhantomJS's stack traces.

http://code.google.com/p/phantomjs/issues/detail?id=47
2012-07-12 23:14:12 -07:00
Juliusz Gonera 70925a873b Add test for .stack in errors thrown in modules
We want to be sure that the stack contains module file path.

http://code.google.com/p/phantomjs/issues/detail?id=47
2012-07-12 23:14:12 -07:00
Juliusz Gonera 2cfffa029a Merge phantomjs-nodify's require() and fix tests
Most of the tests passed after merging almost unchanged phantomjs-nodify
code, some needed small changes. The one that is still failing is for
CoffeeScript modules.

http://code.google.com/p/phantomjs/issues/detail?id=47
2012-07-12 23:14:12 -07:00
Juliusz Gonera 945a4c0f8c Add require() tests and comment buggy test in fs-spec-03.js
http://code.google.com/p/phantomjs/issues/detail?id=47
2012-07-12 23:14:12 -07:00
Jon Leighton 7892ff3b3e Deploy script improvements.
http://code.google.com/p/phantomjs/issues/detail?id=599

Squashed commit of the following:

commit 2cdcf8a47567f3c067958383843cccf858af531c
Author: Jon Leighton <j@jonathanleighton.com>
Date:   Sat Jul 7 19:37:38 2012 +0100

    Make lib-bundling/brandelf optional in deploy/package.sh

    This configuration has had some problems and we don't wish to use it in
    the official packages.

    Enable it with --bundle-libs.

commit 2a2155a4e1f5873aa8624859cead9d66750747f4
Author: Jon Leighton <j@jonathanleighton.com>
Date:   Sat Jul 7 19:24:40 2012 +0100

    notify user if upx is missing

commit 9656a99df0ff101150276dc88e0127f68041f617
Author: Jon Leighton <j@jonathanleighton.com>
Date:   Sat Jul 7 19:23:36 2012 +0100

    stripping symbols after upx probably doesn't work, reorder that

commit c5f425dc17069c89e7d2ff274309006c728ffab4
Author: Jon Leighton <j@jonathanleighton.com>
Date:   Sat Jul 7 19:17:07 2012 +0100

    fix logical fail
2012-07-08 17:42:58 -07:00
Jon Leighton 1bcacde12c Increase VM memory. Necessary for linking on 64-bit build.
http://code.google.com/p/phantomjs/issues/detail?id=599
2012-07-07 08:03:02 -07:00
Ariya Hidayat c0e8aa996f Merge branch 'master' of github.com:ariya/phantomjs 2012-07-07 08:00:30 -07:00
Ariya Hidayat 940e0089ba Merge pull request #291 from jonleighton/static_inspector
Fix remote inspector when building statically.
2012-07-07 08:00:07 -07:00
Jon Leighton 95186c653e Fix remote inspector when building statically.
For some reason, it seems that checking CONFIG(static) inside
src/phantomjs.pro is not reliable. That caused the STATIC_BUILD define
not to be set, and hence Q_INIT_RESOURCE would never get called in
main.cpp.

Instead of using Q_INIT_RESOURCE, let's just compile the resources
directly into the phantomjs binary. This means we don't need to detect
whether Qt is linked statically or dynamically.

https://code.google.com/p/phantomjs/issues/detail?id=430
2012-07-07 15:38:04 +01:00
Ariya Hidayat 13d929f3dc Merge branch 'master' of github.com:ariya/phantomjs 2012-07-05 09:21:04 -07:00
Ariya Hidayat 516c70b4fd Merge pull request #289 from detro/master
Version bump
2012-07-04 08:00:28 -07:00
Ivan De Marino 7409ec62d0 Bumping version to "1.7.0 (development)" 2012-07-03 22:50:11 +01:00
Ariya Hidayat df0f70f0b7 Merge pull request #284 from jonleighton/deploy2
Deploy fixes
2012-06-29 07:48:02 -07:00
Jon Leighton e05c887c96 Use zip for the OS X package
Requested by @ariya, who was concerned that .tar.bz2 might be confusing to
OS X users who are not well-versed in UNIX.
2012-06-29 14:54:39 +01:00
Jon Leighton 5f510967db Fix the top-level folder name in the packaged symbol tarball. 2012-06-29 14:44:10 +01:00
Jon Leighton a714bab04b Fix symbols generation on Linux
We are linking against e.g. libQtCore.so.4 rather than
libQtCore.so.4.8.2, and this affects symbol generation. (I am not sure
if this changed at some point, but this change should make it generate
the correct symbol files regardless.)

Also makes it less dependent on the Qt version.
2012-06-29 14:31:53 +01:00
Jon Leighton 13c1c164d9 Don't build the deploy in debug mode.
Debug mode turns off all optimisations. This make PhantomJS considerably
slower.

Instead, we build in 'release' mode, but generate debugging symbols at
the same time.

This may present some problems analysing crashes, if the optimisations
make that difficult. However, in my testing I was able to get useful
debug output even with optimisations enabled. So we should see how we go
- if it becomes a problem we can produce seperate debug binaries with no
optimisations.

https://code.google.com/p/phantomjs/issues/detail?id=599
2012-06-29 14:27:48 +01:00
Ariya Hidayat 59f6bb9496 ChangeLog fix: it's onPrompt and not onAlert.
Thanks to Ryuichi Okumura <okuryu@gmail.com> for the notice.

http://code.google.com/p/phantomjs/issues/detail?id=598
2012-06-26 08:20:00 -07:00
Ariya Hidayat ca7e8bb8f3 Merge pull request #281 from detro/master
Forgot to update completions for renderBase64
2012-06-25 01:47:40 -07:00
Ivan De Marino 5ad891c2f3 Forgot to update completions for renderBase64 2012-06-24 19:40:41 -07:00
Ariya Hidayat 3da512370e Lavender.
http://code.google.com/p/phantomjs/issues/detail?id=598
2012-06-20 23:28:26 -07:00
Ariya Hidayat 91d31ffe9e Fix Twitter-related examples to work with the new site.
http://code.google.com/p/phantomjs/issues/detail?id=609
2012-06-20 22:55:04 -07:00
Ariya Hidayat 9c05341698 Changes for Lavender.
http://code.google.com/p/phantomjs/issues/detail?id=598
2012-06-20 21:24:46 -07:00
Ariya Hidayat 8c46d6db83 Only compress with UPX if it's available.
Also, make sure we use the maximum compression level.

http://code.google.com/p/phantomjs/issues/detail?id=599
2012-06-20 21:18:37 -07:00
Ariya Hidayat 06e424b614 Merge pull request #278 from jonleighton/deploy
fix lib paths for dump-symbols.sh
2012-06-20 07:48:08 -07:00
Jon Leighton eca983cdda fix lib paths for dump-symbols.sh 2012-06-20 09:15:03 +01:00
Ariya Hidayat 959f8ca323 Merge pull request #277 from jonleighton/deploy
A couple of packaging script tweaks
2012-06-19 17:23:44 -07:00
Jon Leighton 7ff61604e3 use upx to compress binary on OS X 2012-06-19 23:49:06 +01:00
Jon Leighton d0ee703529 tweak/fix provision-vm.sh 2012-06-19 23:19:49 +01:00
Ariya Hidayat 78d23935a5 Update CoffeeScript compiler to version 1.3.3.
http://code.google.com/p/phantomjs/issues/detail?id=496
2012-06-18 22:40:51 -07:00
Ariya Hidayat 23469d6cde Merge pull request #276 from jonleighton/breakpad
Breakpad / deploy stuff
2012-06-18 20:59:35 -07:00
Ariya Hidayat e5f695a0b4 Merge pull request #275 from jonleighton/stacktraces
Fix segfault when using e.g. console.error
2012-06-18 20:59:12 -07:00
Jon Leighton fe784b45e6 PhantomJS itself also needs to be build in debug mode.
https://code.google.com/p/phantomjs/issues/detail?id=599
2012-06-19 00:30:17 +01:00
Jon Leighton aa533a5659 ignore deploy/brandelf 2012-06-19 00:29:18 +01:00
Tom Stuart & Jon Leighton 5fa0202f29 Add breakpad support for Mac
This provides support for compiling the breakpad client into PhantomJS,
and generifies that Linux packaging scripts so that they also apply to
OS X and automate the symbol generation.

Building the Breakpad tool programs seems to be less than
straightforward on OS X, and documentation is poor. We have managed to
produce tools/dump-syms-mac.pro which allows building the dump_syms
program for dumping the debugging symbols. This needed a couple of
modifications to breakpad in order to compile successfully.

We have run out of time to work on making the minidump_stackwalk program
build. However, this is solely a developer tool and so it can wait until
after the 1.6 release before we complete this work.

Testing is welcome!

https://code.google.com/p/phantomjs/issues/detail?id=576
2012-06-19 00:28:37 +01:00
Jon Leighton 439a58eaee Fix segfault when using e.g. console.error
When console.error was called, there was a segfault because it was
treated as an uncaught exception, but did not have the correct stack
trace information (I am not sure why, but still...)

Now that we are generating the stackTrace in WebCore::reportException,
the MessageType gets set correctly, so we can use this to differentiate
between uncaught exceptions and other messages.

https://code.google.com/p/phantomjs/issues/detail?id=47
2012-06-18 23:43:50 +01:00
Ariya Hidayat c3c65df12d Merge pull request #273 from ferama/master
fix wrong pdf margins using custom header/footer
2012-06-18 06:53:29 -07:00
Marco Ferragina 1a3be3bbce fix wrong pdf margins using custom header/footer
see issue http://code.google.com/p/phantomjs/issues/detail?id=588
2012-06-18 12:25:14 +02:00
Ariya Hidayat 37cfc05a9b Merge pull request #272 from detro/master
Minor adjustments before 1.6
2012-06-17 22:20:12 -07:00
Ivan De Marino b443b7add8 Changing the "working directory" to "/test" before running tests.
This fixes some issues with our tests, where we were erroneously failing.
2012-06-17 19:37:24 -07:00
Ivan De Marino bd6f1f2ffe Adding a Q_UNUSED to removing compilation annoyance. 2012-06-17 19:21:44 -07:00
Ivan De Marino 55efadc926 After discussing with @ariya on [Issue 547](http://code.google.com/p/phantomjs/issues/detail?id=547), I reduced the methods to 1: rendereBase64(format).
Available formats are the one supported by QImageWriter: http://qt-project.org/doc/qt-4.8/qimagewriter.html#supportedImageFormats.
Formats can be entered in lower or uppercase: it gets normalised internally.
2012-06-17 18:27:36 -07:00
Ariya Hidayat a272d660a6 Merge pull request #271 from jonleighton/deploy
Provide scripts and workflow for building Linux packages for release.
2012-06-17 16:37:28 -07:00
Jon Leighton 1b621e9f50 Provide scripts and workflow for building Linux packages for release. 2012-06-17 23:40:12 +01:00
Ariya Hidayat 804a7f3df4 Fix qscriptengine.h after Qt update to 4.8.2.
Our copy of Qt does not build QtScript, only uses the header file for an enum.

As reported by Jon Leighton.

http://code.google.com/p/phantomjs/issues/detail?id=495
2012-06-17 14:48:39 -07:00
Ariya Hidayat 70c09ba620 WebKit: Don't treat warnings as errors.
This was added in Qt 4.8.2. Revert it until we solve all compiler
warnings.

http://code.google.com/p/phantomjs/issues/detail?id=495
2012-06-17 09:59:16 -07:00
Ariya Hidayat 593f4a590b Update Qt to the latest version 4.8.2.
http://code.google.com/p/phantomjs/issues/detail?id=495
2012-06-17 08:27:14 -07:00
Ariya Hidayat ead8066c57 Merge remote-tracking branch 'neraliu/cookiesapi'
Conflicts:
	src/modules/webpage.js
	src/webpage.h
2012-06-17 07:56:25 -07:00
Jon Leighton c9cf14f221 Don't pass an error object to the onError callback.
On reflection, this approach seems like a bad idea and a source of bugs.
I think passing object references between pages seems inherently
problematic, and we are better off just passing data to the onError
handler. If users need the actual object reference, they are able to use
try ... catch within the page.

This change also means that we are no longer breaking backwards
compatibility with the page.onError function signature.

WebCore already has a bunch of plumbing to pass around stacks. This
exists for the inspector/console. However, we need to actually retrieve
the error stack in WebCore::reportException.

To achieve this, I am attaching a stackArray property to the error
object. This is not as clean as I'd like, but seems ok for now. (We
should not document stackArray though.)

https://code.google.com/p/phantomjs/issues/detail?id=166
2012-06-16 14:24:37 -07:00
Jon Leighton d2290a60a9 Localize variables.
This is to avoid adding a onError handler to the page that exists in the
outer scope.

https://code.google.com/p/phantomjs/issues/detail?id=166
2012-06-16 14:24:37 -07:00
Ariya Hidayat a61d5e5400 Build script: don't fail too early.
set -e causes the check for compile jobs environment variable to quit
the script too early. Avoid this by guarding the check properly.

http://code.google.com/p/phantomjs/issues/detail?id=226
2012-06-16 14:21:28 -07:00
Anthony O 744df38071 Fixing a compilation problem on Ubuntu 10.04 64bits
Return type for 'window.callPhantom', in case no handler is set, has to be 'null', not '0'

http://code.google.com/p/phantomjs/issues/detail?id=133
2012-06-16 10:55:08 -07:00
Nera Liu 94a1fbecdb Fix an indentation problem in the file test/webpage-spec.js. 2012-06-16 08:13:05 -07:00
Nera Liu 77052e60a8 Simplify the cookies api as property setter and getter for issue 354.
Update the test case for the cookies api.

http://code.google.com/p/phantomjs/issues/detail?id=354
2012-06-16 07:58:11 -07:00
Ivan De Marino 1014efe26f Adding missing completions on the "WebPage" object
http://code.google.com/p/phantomjs/issues/detail?id=573
http://code.google.com/p/phantomjs/issues/detail?id=547
2012-06-15 00:23:51 -07:00
Ivan De Marino f40b7ab730 Adding property "os" to the "system" module.
Contains the properties:
- name
- architecture
- version

http://code.google.com/p/phantomjs/issues/detail?id=585
2012-06-15 00:12:08 -07:00
Ivan De Marino f386f7d484 Adding the ability to switch between frames.
1. Passing JavaScript eval and other related actions to the CurrentFrame, not the MainFrame.
2. Added different methods to navigate between frames
3. With a call to "window.frames[0].focus()", the "currentFrame" changes: commands after that are sent to the new frame under focus.
4. The navigation between frames allows to walk over the "tree of frames" contained in the page.

This commit also adds examples (both in JS and CoffeeScript) and Unit Test.

http://code.google.com/p/phantomjs/issues/detail?id=573
2012-06-15 00:07:53 -07:00
david 40fd210c99 Add navigation event hook to PhantomJS.
http://code.google.com/p/phantomjs/issues/detail?id=562
2012-06-14 23:54:17 -07:00
david c153a2816e Fix error handler when error is null.
http://code.google.com/p/phantomjs/issues/detail?id=589
2012-06-14 23:41:23 -07:00
Eivind Uggedal 38c3f862b3 Do not attempt to compile PhantomJS if the Qt compile failed.
http://code.google.com/p/phantomjs/issues/detail?id=226
2012-06-14 23:38:51 -07:00
Jon Leighton 28d507d24f Allow debug/warning messages to be enabled at runtime.
https://code.google.com/p/phantomjs/issues/detail?id=575
2012-06-14 23:34:40 -07:00
Ivan De Marino 51ab11c6d9 Render page as a base64 string.
Provided API for the Webpage object:
- renderBase64PNG()
- renderBase64JPG()
- renderBase64BMP()

Addresses [Issue #547](http://code.google.com/p/phantomjs/issues/detail?id=547).
2012-06-14 23:29:14 -07:00
Ivan De Marino ebc1855483 Another tweak for "evaluateAsync".
Making sure all the parameters are passed on correctly.

http://code.google.com/p/phantomjs/issues/detail?id=593
2012-06-14 23:29:14 -07:00
Ivan De Marino caf13651b7 Adding "window.phantomCallback()" within the page context.
The callback is harmless: if the user registers a "page.onCallback = [Function]",
that will receive any JS type passed via "phantomCallback()".
Also, if the handler for ".onCallback" returns a value, that is passed back as a
return value of "phantomCallback()".

Also, added "page.onConfirm" and "page.onPrompt".
This solves [Issue #133](http://code.google.com/p/phantomjs/issues/detail?id=133).
2012-06-14 23:29:13 -07:00
Ivan De Marino 945b845d35 Adding a new "evaluateAsync" on the "webpage" object.
This is useful in case:
* we don't care about the result of the evaluate
* we don't need to have the result of the evaluate on the spot
* we need the stack of execution to begin WITHIN the page

Also, linting code: everyone should use a linter when writing Javascript. Everyone.

http://code.google.com/p/phantomjs/issues/detail?id=593
2012-06-14 23:29:13 -07:00
Nera Liu 7919387c71 Add WebPage.setCookies and WebPage.cookies apis for the issue 354.
Add sanity check for the cookies api in test/webpage-spec.js.

http://code.google.com/p/phantomjs/issues/detail?id=354
2012-06-14 00:43:20 -07:00
Ariya Hidayat 37003332ac Merge pull request #267 from jonleighton/breakpad
Add a few more missing Makefiles.
2012-06-14 00:30:12 -07:00
Jon Leighton eedf2441b9 Add a few more missing Makefiles.
http://code.google.com/p/phantomjs/issues/detail?id=587
2012-06-13 23:23:52 +01:00
Marco Ferragina 834d9f5891 Fix missing Makefiles in breakpad due to global .gitignore.
http://code.google.com/p/phantomjs/issues/detail?id=587
2012-06-12 09:40:31 -07:00
Ariya Hidayat cec3fdd8a0 Merge pull request #264 from jonleighton/multi_file_input
Handle multiple file inputs.
2012-06-12 08:42:23 -07:00
Ariya Hidayat 8d366f9328 Merge pull request #262 from jonleighton/stacktraces
Error.stack returns a string to match V8/Node.js
2012-06-12 08:41:48 -07:00
Ariya Hidayat cd65c63af1 Merge pull request #263 from jonleighton/breakpad
Compile the breakpad client in directly.
2012-06-12 07:24:34 -07:00
Jon Leighton bbbd6a22d7 Handle multiple file inputs.
https://code.google.com/p/phantomjs/issues/detail?id=256
2012-06-10 23:24:45 +01:00
Jon Leighton e781f243dc Compile the breakpad client in directly.
This removes the need to build breakpad as a separate step.

PhantomJS developers will still need to cd src/breakpad && ./configure
&& make in order to analyse crash dumps, but it is not longer necessary
in order to build PhantomJS itself.

https://code.google.com/p/phantomjs/issues/detail?id=576
2012-06-10 21:42:43 +01:00
Jon Leighton f7ecf6ccb9 Error.stack returns a string to match V8/Node.js
https://code.google.com/p/phantomjs/issues/detail?id=166
2012-06-10 21:28:46 +01:00
Ariya Hidayat fb7a5191f9 Merge pull request #261 from b-long/patch-1
Switched link for GhostDriver, since GitHub page appears to be missing.
2012-06-09 14:33:21 -07:00
Ariya Hidayat 293865ceeb Merge remote-tracking branch 'jonleighton/breakpad' 2012-06-08 11:15:32 +02:00
Jon Leighton 1b53adec2b Tweak the linux deploy script.
* Use exec to replace the bootstrap shell script
* Name the bootstrap shell script `phantomjs` so that invocation is no
  different

http://code.google.com/p/phantomjs/issues/detail?id=413
2012-06-08 11:10:56 +02:00
Milian Wolff 5c2e330a15 Make QWebPage::zoomFactor accessible to PhantomJS scripts.
This adds a new WebPage::zoomFactor property, which can be used to
zoom the page, i.e.:

page.zoomFactor = 1.5; // zoom by 50% in
page.zoomFactor = 0.5; // zoom by 50% out

The rasterize.js example is adapted to take an optional fourth argument
to set the zoom factor. Furthermore, the webpage-spec is extended with
a simple test case for the new property.

ISSUE: 579 (http://code.google.com/p/phantomjs/issues/detail?id=579)
2012-06-08 11:05:54 +02:00
b.long ffb57958d2 Switched link for GhostDriver, since GitHub page appears to be missing. 2012-06-07 17:47:22 -03:00
Jon Leighton 8f7ee0ecd8 Integrate Google Breakpad crash reporter. Linux only for now. 2012-06-05 23:08:16 +01:00
Jon Leighton 0fa15e51c9 Import Google Breakpad 2012-06-05 23:01:07 +01:00
Ariya Hidayat 7448af2f69 Merge pull request #254 from jonleighton/static_inspector
Fix remote inspector + static build.
2012-06-03 06:10:13 -07:00
Jon Leighton & Tom Stuart be4686ab04 Fix remote inspector + static build.
https://code.google.com/p/phantomjs/issues/detail?id=430
2012-06-03 11:17:12 +02:00
Ariya Hidayat c8e311d79d Fix some wrong whitespace.
http://code.google.com/p/phantomjs/issues/detail?id=300
2012-06-02 06:42:14 -07:00
leeight 412c3f4246 FIX build issue with glib 2.31.0+.
Remove the `union GMutex` declaration.

https://bugs.webkit.org/show_bug.cgi?id=72085
http://code.google.com/p/phantomjs/issues/detail?id=559
2012-06-01 22:29:24 -07:00
Ariya Hidayat 1989184fa1 Merge pull request #248 from neraliu/localstorage
Add --local-storage-quota and --local-storage-path options for issue 300...
2012-06-01 21:31:19 -07:00
Ariya Hidayat 824ad9d9d8 Merge pull request #253 from jonleighton/stacktraces
Improve error handling
2012-06-01 21:28:43 -07:00
Jon Leighton ad91d651a8 Pass an actual exception object to the error handler.
Note that for errors that occur within subpages, this object is not the
real error object, but a copy. This is because the real object exists
within the subpage, but the page.onError handler runs within the main
context, so we have to pass it through as data.

https://code.google.com/p/phantomjs/issues/detail?id=166
2012-05-30 20:20:30 +01:00
Nera Liu c85a26a229 Add --local-storage-quota and --local-storage-path options for issue 300.
Add sanity check for the configuration of --local-storage-quota and --local-storage-path.

issue 300 - http://code.google.com/p/phantomjs/issues/detail?id=300
2012-05-19 21:04:01 +08:00
Ariya Hidayat ca60a58596 Fix a wrong module require in imagebin example.
http://code.google.com/p/phantomjs/issues/detail?id=536
http://code.google.com/p/phantomjs/issues/detail?id=276
2012-05-17 23:41:33 -07:00
Brikou CARRE 1125b86e72 Fixed missing exit code when errornous.
http://code.google.com/p/phantomjs/issues/detail?id=544
2012-05-17 23:35:02 -07:00
Ariya Hidayat 71425850f6 Mac: Embed Info.plist in the executable.
Info.plist is needed to surpress the dock icon. Up to now, we need to have
the file available at run-time. With this change, the contents of
Info.plist are embedded in the executable at the linking stage, thus
there is no need to deploy the Info.plist file anymore.

Credit to Smokey Ardisson for the tip.

http://code.google.com/p/phantomjs/issues/detail?id=528
2012-05-08 06:44:14 +07:00
Jon Leighton 54c41ae77a Support retrieving the stack of an error
https://code.google.com/p/phantomjs/issues/detail?id=166
2012-05-07 23:29:36 +01:00
Jon Leighton 479b827b66 Enable rich source info for errors.
https://code.google.com/p/phantomjs/issues/detail?id=510
2012-05-07 17:34:07 +01:00
Milian Wolff 4669c16e64 Fix application font loading in basic font db
ISSUE: 460 (http://code.google.com/p/phantomjs/issues/detail?id=460)

this is a backport from qtbase:

commit 89cfe9eb01ad75c14121dbd6038b7c791226acf1
Author: Jiang Jiang <jiang.jiang@nokia.com>
Date:   Thu Nov 10 18:01:56 2011 +0100

    We need to reregister fonts in initializeDb because basic font db
    doesn't have an internal record like fontconfig does, so just
    repopulating the font database won't work. db->reregisterAppFonts
    is now used properly as intended (reregister application fonts
    after the system font database has been cleared).

    Also, static variable 'initialized' in initializeDb() is removed
    since we check privateDb()->count to see if it needs to be populated
    again.

    Task-number: QTBUG-22063

    Change-Id: Ifc66392b56b72acbe08b99256c61421c204be5d7
    Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
2012-05-03 18:16:14 +02:00
Milian Wolff bf029ae65a Properly handle fourth CLI parameter in rasterize.js example.
After the change to system.args which has the app as first element,
the rasterize example was not properly adapted. Due to that, one
could not pass a size parameter to it anymore, resulting in PDFs
without page breaks.

ISSUE: 523 (http://code.google.com/p/phantomjs/issues/detail?id=523)
2012-05-02 15:31:46 +02:00
Milian Wolff b3d74c9a6c Extend printheaderfooter.js example documentation
The comment now explains how to delegate the header/footer setup
to the loaded HTML page by giving an explicit HTML example that
defines the required PhantomJSPrinting object

ISSUE: 512 (http://code.google.com/p/phantomjs/issues/detail?id=512)
2012-04-30 16:52:28 +07:00
Milian Wolff e185a5c2b6 Improve package-linux-dynamic.sh to create a quasi-static phantomjs.
The script now copies all required shared libraries found via ldd
to the deployment folder.

Furthermore, a run-script is created that runs the phantomjs binary
through the copied build-host's ld-linux.so to ensure all symbols
are properly resolved.

Last but not least, we now include a very slightly modified brandelf.c
from FreeBSD. This version can be compiled on Linux machines and is
used to change the ELF ABI of the binary and libs in the deployment
folder, such that they all use the old SYSV OS ABI for compatibility.

Usage:
$ package-linux-dynamic.sh
$ scp phantomjs-$version.tar.bz2 yourhost
$ ssh yourhost
$ tar -xf phantomjs-$version.tar.bz2
$ ./phantomjs-$version/phantomjs.sh

CC ISSUE: 413 (http://code.google.com/p/phantomjs/issues/detail?id=413)

(proper static build would still be desirable eventually if possible)
2012-04-25 19:36:00 +02:00
Milian Wolff 2c4e7b6a7e Properly pass --qt-config value from build.sh to src/qt/preconfig.sh.
This way one can properly cross-compile PhantomJS for different
platforms e.g. by passing --qt-config '-platform ...' to build.sh.

ISSUE: 507 (http://code.google.com/p/phantomjs/issues/detail?id=507)
2012-04-20 13:38:11 +02:00
Milian Wolff 3a84eb6d16 Reuse number of jobs configured in MAKEFLAGS env var if available
Especially on machines that are connected to a compile farm, the
MAKEFLAGS env var is usually set to configure the default number
of jobs that should be used. This way, one can just call the
PhantomJS build script without passing the number of jobs every
time.

ISSUE: 503 (http://code.google.com/p/phantomjs/issues/detail?id=503)
2012-04-18 14:19:43 +02:00
Ariya Hidayat d937e6e05a Fixed minor typo in README.md.
Thanks to Alessandro for spotting it.
2012-04-16 17:11:05 -07:00
Ariya Hidayat edc93dc8d0 Build system: do not assume 4 parallel jobs on Linux.
Try to grab the number of CPU cores from /proc/cpuinfo and use it as
the number of parallel make jobs (limit to 8 as a safety measure).

http://code.google.com/p/phantomjs/issues/detail?id=454
2012-04-15 18:21:02 -07:00
Ariya Hidayat 5a46423d28 Improve README.md regarding the contributors.
http://code.google.com/p/phantomjs/issues/detail?id=419
2012-04-15 11:27:22 -07:00
Milian Wolff 24a9665c4d Make it possible to print pages with user-defined headers/footers.
Usage:

page.paperSize = {
  margin: "1cm",
  header: {
    height: "1cm",
    contents: phantom.callback(function(pageNum, numPages) {
      return "<h1>" + pageNum + " / " + numPages + "</h1>";
    })
  },
  footer: {
    height: "0.5cm",
    contents: phantom.callback(function(pageNum, numPages) {
      return "<h2>" + pageNum + " / " + numPages + "</h1>";
    })
  }
};

Note: The contents can return arbitrary HTML but since we cannot
re-layout the whole website for every page, the header/footers
must have the static height defined in the height property.

Note: The new example printheaderfooter.js shows the usage. It
also shows how one could delegate the above to a JavaScript
function on the loaded website, which allows one to print pages
and let the actually printed page decide how the header/footer
should look like.

Note: The page-counter can be reset by adding the class "phantomjs_reset_pagination"
to HTML block-elements that should reset the counter.

ISSUE: 410 (http://code.google.com/p/phantomjs/issues/detail?id=410)
2012-04-14 22:04:34 -07:00
Milian Wolff 67d2e8c2f7 Fix crash on close due to an uninitialized pointer in QEventDispatcherQPAPrivate.
ISSUE: 497 (http://code.google.com/p/phantomjs/issues/detail?id=497)
2012-04-11 19:18:20 -07:00
Ariya Hidayat d6f18f7f8b Update CoffeeScript compiler to version 1.3.1.
http://code.google.com/p/phantomjs/issues/detail?id=496
2012-04-11 00:46:43 -07:00
Ariya Hidayat f6f139e99f Moved to gh-pages branch.
http://code.google.com/p/phantomjs/issues/detail?id=490
2012-04-11 00:44:40 -07:00
Ariya Hidayat 81794f9096 Squashed commit of the following:
commit c373ac4d17814588f4e3344f634ec469e56c0303
Author: Danny Wang <wangyang0123@gmail.com>
Date:   Tue Apr 10 12:38:13 2012 +0800

    moved i and l delarations to the top of page.evaluate()

commit bf24d4d1ecdb9e06c7bf461e87c222b10b74bc9d
Author: Danny Wang <wangyang0123@gmail.com>
Date:   Tue Apr 10 08:54:55 2012 +0800

    fixed defects in evaluate() pointed out by detro

commit 0bb8cff7803b70fe60fd761b1b748b5510705ee0
Author: Danny Wang <wangyang0123@gmail.com>
Date:   Fri Apr 6 19:21:47 2012 +0800

    added passing variables to function for page.evaluate

    http://code.google.com/p/phantomjs/issues/detail?id=132
2012-04-10 23:52:56 -07:00
Ariya Hidayat afb0707c9d Improve PhantomJS README, fix minor editing issue.
http://code.google.com/p/phantomjs/issues/detail?id=419
2012-04-01 17:32:43 -07:00
Ariya Hidayat 29d98196b9 Improve PhantomJS README, mention well-known related projects.
Also minor editing everywhere else.

http://code.google.com/p/phantomjs/issues/detail?id=419
2012-04-01 16:20:45 -07:00
Ariya Hidayat 7ec234801b Improve PhantomJS README with various use cases.
http://code.google.com/p/phantomjs/issues/detail?id=419
2012-04-01 08:44:22 -07:00
Ariya Hidayat 71323e3be1 Improve PhantomJS description.
First cut at a more modernized version of the README.

http://code.google.com/p/phantomjs/issues/detail?id=419
2012-04-01 08:20:39 -07:00
david 8c645ecd79 Added tests for customHeaders.
http://code.google.com/p/phantomjs/issues/detail?id=77.
2012-03-27 22:23:46 -07:00
Ariya Hidayat 14b1ec6688 Remove setting and command-line option for plugins loading.
http://code.google.com/p/phantomjs/issues/detail?id=418
2012-03-23 07:42:17 -07:00
Ivan De Marino ac771a22b9 Option to pass "headers" when using "open()" on "webpage" module.
Solves [Issue 452](http://code.google.com/p/phantomjs/issues/detail?id=452)
2012-03-23 11:48:16 +00:00
Ivan De Marino 03e47a1712 Fixing defect in the "Filesystem Spec 03".
Too strong assumption regarding the Current Working Directory.
2012-03-23 11:45:13 +00:00
Ivan De Marino 40b1590cbb Adding Webserver "response.closeGracefully()" to easily (and more elegantly) send empty HTTP responses.
Addresses [Issue 451](http://code.google.com/p/phantomjs/issues/detail?id=451)
2012-03-23 11:42:16 +00:00
Ivan De Marino 59c4e32c60 Updating "webserver" test spec.
I also made a minor fix in the logic of "system" test spec:
too strong assumption on the CurrentWorkingDirectory
when launching the test.
2012-03-23 10:56:51 +00:00
Ariya Hidayat 3a6c243ca9 Fix visibility warnings during the linking stage.
http://code.google.com/p/phantomjs/issues/detail?id=449
2012-03-22 23:05:46 -07:00
Ariya Hidayat fcc0ff7bae Open master branch for 1.6 development. 2012-03-22 21:24:27 -07:00
Ivan De Marino 985d9c58f2 Second attempt to solve Issue 439.
[Issue 439](http://code.google.com/p/phantomjs/issues/detail?id=439).
This works for all kind of "Content Body" but with raw bytes: the issue is that QtWebKit doesn't know how to convert a "QByteArray" to a "QVariant" (to inject it in the JavaScript space), resulting in a malformed conversion (somehow it decides to create a map where byte position is the 'key' and the byte at that position is the 'value').

This fix covers most scenarios (hopefully) but we are blocked on solving it completely.
2012-03-22 21:14:42 -07:00
Ivan De Marino 775c2ad2af Correct use of "QT_NO_DEBUG_OUTPUT" and "QT_NO_WARNING_OUTPUT" 2012-03-22 21:14:34 -07:00
Ariya Hidayat 8db267bb56 Bracing for Ghost Flower. 2012-03-20 17:52:43 -07:00
Ariya Hidayat f3cfb74cfc More changes for 1.5. 2012-03-20 17:52:31 -07:00
Ivan De Marino b6d13a3ac7 Fix for Issue [439](http://code.google.com/p/phantomjs/issues/detail?id=439).
Even without "Content-Type" set to "application/x-www-form-urlencoded", content in the body of a POST or PUT should be available.
2012-03-20 17:41:24 -07:00
Ivan De Marino 39ab313200 Fixing the "request.url" field, excluding symbols '/', '&' and '#' from "percent encoding".
Well, it's not really necessary for '#' but I'm just being safe (non-browser clients).

http://code.google.com/p/phantomjs/issues/detail?id=437
2012-03-20 08:57:11 -07:00
Ariya Hidayat eb112f5c3d Update web site to mention version 1.5. 2012-03-20 00:03:51 -07:00
Ariya Hidayat b0de295132 Changes for 1.5.0. 2012-03-19 23:59:41 -07:00
Ariya Hidayat 173157555e Get ready for 1.5.0. 2012-03-19 23:47:04 -07:00
Jon Leighton adcb14dd0e Basic tests for the onError handler
http://code.google.com/p/phantomjs/issues/detail?id=166
2012-03-18 21:44:31 -07:00
Jon Leighton 8f93ca08ea Fix warnings.
Stop passing around lineNumber and sourceID as they are unused and don't
contain useful information.

Also declare Q_UNUSED on them to fix compiler warnings.
2012-03-18 21:44:30 -07:00
Jon Leighton 35e8c94925 Fix try ... catch exception handling.
The hasHandler flag passed to JSC::Debugger::exception only applies to
the current stack frame. It does not indicate if there are exception
handlers in earlier stack frames.

Therefore, we are saving the frame when an exception occurs, but only
reporting the exception if it is still present once the stack has been
fully unwound.

http://code.google.com/p/phantomjs/issues/detail?id=166
2012-03-18 21:44:23 -07:00
Jon Leighton a48770cba3 support for backtraces (part 2).
add a default error handler on all pages. people can override if they
need.
ensure error handler can be removed without errors.

Hack ScriptSourceCode so we can pass in a raw string and not have it
validated as a URL

change source location hint for webpage.evaluate().

http://code.google.com/p/phantomjs/issues/detail?id=166
 Please enter the commit message for your changes. Lines starting
2012-03-17 18:40:41 -07:00
Jon Leighton afe570484f support for backtraces (part 1).
Mostly plumbing in WebKit and Qt bridge.

http://code.google.com/p/phantomjs/issues/detail?id=166
2012-03-17 18:40:41 -07:00
Ariya Hidayat c6091b48c1 Implement fs.readLink to read symlink target.
http://code.google.com/p/phantomjs/issues/detail?id=329
2012-03-16 20:44:56 -07:00
Ariya Hidayat c2c80c0e96 Fix broken GIF support in QPA (Lighthouse).
This is the same issue like the previous broken JPEG.  In non-static
build, GIF is built as plugin. We force to have GIF support built-in by
explicitly change a variable in the configure script (unfortunately this
can't be done via command-line options).

http://code.google.com/p/phantomjs/issues/detail?id=163
http://code.google.com/p/phantomjs/issues/detail?id=432
2012-03-16 07:24:11 -07:00
Ariya Hidayat d9404c0ab8 Be on the safe side and check for Qt == 4.8.0.
http://code.google.com/p/phantomjs/issues/detail?id=272
2012-03-15 22:54:13 -07:00
Ariya Hidayat 59a777e348 Add a simple check to ensure that there is no loaded plugin.
http://code.google.com/p/phantomjs/issues/detail?id=418
2012-03-15 21:47:01 -07:00
Ariya Hidayat 8c7b586f03 Remove support for Flash and other plugins.
http://code.google.com/p/phantomjs/issues/detail?id=418
2012-03-15 20:54:35 -07:00
Ariya Hidayat a59f11b7cc Fix broken JPEG support in QPA (Lighthouse).
In non-static build, JPEG is built as plugin. We force to have JPEG
support built-in by explicitly change a variable in the configure
script (unfortunately this can't be done via command-line options).

http://code.google.com/p/phantomjs/issues/detail?id=163
2012-03-15 19:31:04 -07:00
Ariya Hidayat 8673597bc4 Fix mistake in 'require' logic.
(as spotted by Nicolas Perriault).

http://code.google.com/p/phantomjs/issues/detail?id=270
2012-03-15 08:12:12 -07:00
Ariya Hidayat 26b28d7842 printenv.js: New example to show system.env.
This is very similar to Unix common 'printenv'.

http://code.google.com/p/phantomjs/issues/detail?id=271
2012-03-15 01:33:27 -07:00
Ariya Hidayat 756d0d3166 Implement system.env to get system environment variables.
Based on the initial work from execjosh:
https://github.com/ariya/phantomjs/pull/192

See also http://wiki.commonjs.org/wiki/System#System_Interface.

http://code.google.com/p/phantomjs/issues/detail?id=271
2012-03-15 01:22:17 -07:00
Ariya Hidayat b7d7cfc542 Update more examples to use system.args.
http://code.google.com/p/phantomjs/issues/detail?id=276
2012-03-15 01:11:30 -07:00
execjosh b73ec44796 Update examples to use system.args.
Also update coffee-script script path names in usage messages.

http://code.google.com/p/phantomjs/issues/detail?id=276
2012-03-15 01:11:30 -07:00
Ariya Hidayat 545a3f76b4 Implement system.args to get command-line arguments.
This also means that phantom.args is deprecated.

Based on the initial work from execjosh:
https://github.com/ariya/phantomjs/pull/192

See also http://wiki.commonjs.org/wiki/System#System_Interface.

http://code.google.com/p/phantomjs/issues/detail?id=270
http://code.google.com/p/phantomjs/issues/detail?id=276
2012-03-15 01:11:26 -07:00
Ariya Hidayat 119e1ba516 Implement the plumbing for CommonJS System module support.
See http://wiki.commonjs.org/wiki/System.

Based on the initial work from execjosh:
https://github.com/ariya/phantomjs/pull/192

http://code.google.com/p/phantomjs/issues/detail?id=270
2012-03-14 23:23:43 -07:00
Jon Leighton 6e929f5fe2 add a bunch of gitignores for Qt build artifacts
http://code.google.com/p/phantomjs/issues/detail?id=226
2012-03-14 17:57:28 -07:00
Ariya Hidayat 6c7b0207f4 Make 'Keep Alive' option to use camel case.
Change 'keep-alive' to 'keepAlive' in the option for the server.
This allows setting the value (in JS object literal) without quoting.

http://code.google.com/p/phantomjs/issues/detail?id=429
2012-03-14 10:52:57 -07:00
Milian Wolff 21fd5b6716 cleanup wait-code for response.close using a semaphore concept
ISSUE: 429 (http://code.google.com/p/phantomjs/issues/detail?id=429)
2012-03-14 10:46:34 -07:00
Ariya Hidayat 6c8a1c2dc1 No X11 requirement on Linux.
This is achieved by using QPA (aka Qt Lighthouse).

http://code.google.com/p/phantomjs/issues/detail?id=163
2012-03-13 22:07:10 -07:00
Ariya Hidayat c78ae190a9 Implement a custom platform integration for Unix QPA operation.
These classes are from the official Qt 4.8.0 platform plugins with some
tweaks:

* By default, use Fontconfig font database.
* No need to save the captured screen on every flush.
* Enlarge the screen to make it more like a typical desktop size.

http://code.google.com/p/phantomjs/issues/detail?id=163
2012-03-13 22:04:05 -07:00
Ariya Hidayat 83af966d94 Modify QPA application to use the custom minimal integration.
http://code.google.com/p/phantomjs/issues/detail?id=163
2012-03-13 21:57:52 -07:00
Ariya Hidayat 6de3e7fdb9 Allow non-X11 to use Freetype font engine.
http://code.google.com/p/phantomjs/issues/detail?id=163
2012-03-13 21:31:11 -07:00
Ariya Hidayat 4c3897fece Make it possible to test QPA (Lighthouse) on Mac.
Do not use CoreText if QPA is specified.
Warning: this is only for testing purposes and it has no practical
use right now.

http://code.google.com/p/phantomjs/issues/detail?id=163
2012-03-13 19:36:10 -07:00
Ariya Hidayat f7ec1533d6 Qt build: Really disable PulseAudio support.
In order to avoid configuration-time detection of PulseAudio,
Qt configure script is slightly modified so that no attempt to
carry out the detection would be made.

http://code.google.com/p/phantomjs/issues/detail?id=226
http://code.google.com/p/phantomjs/issues/detail?id=414
2012-03-13 19:35:01 -07:00
Milian Wolff 7b909bfe45 Add example for keep-alive enabled webserver.
See examples/serverkeepalive.js.

http://code.google.com/p/phantomjs/issues/detail?id=416
2012-03-13 19:01:24 -07:00
Ariya Hidayat 4656988209 Qt build: Ignore PulseAudio for the time being.
http://code.google.com/p/phantomjs/issues/detail?id=226
http://code.google.com/p/phantomjs/issues/detail?id=414
2012-03-13 00:32:39 -07:00
Ariya Hidayat 35afa8fc99 Qt build: Disable ICU, system zlib, and PulseAudio.
http://code.google.com/p/phantomjs/issues/detail?id=226
http://code.google.com/p/phantomjs/issues/detail?id=414
2012-03-13 00:09:39 -07:00
Ariya Hidayat 8965adf7d2 Build: Apply FreeBSD patch to build Mongoose.
This is originally from:
http://www.freebsd.org/cgi/cvsweb.cgi/ports/lang/phantomjs/files/patch-src-mongoose-mongoose.c.

http://code.google.com/p/phantomjs/issues/detail?id=341
2012-03-12 23:45:59 -07:00
Ariya Hidayat c12f1aab4a Control web security setting.
This is through --web-security command-line option and
webSecurityEnabled configuration setting.

When web security is off (disabled), universal access to any location
from any document is granted. Use it with caution!

Patch by Danny Wang <wangyang0123@gmail.com>.
Originally from https://github.com/ariya/phantomjs/pull/212.

http://code.google.com/p/phantomjs/issues/detail?id=28
2012-03-12 23:37:50 -07:00
Ariya Hidayat 21106b4289 WebKit: Add an API to enable and disable Web Security setting.
Patch by Danny Wang <wangyang0123@gmail.com>.
Originally from https://github.com/ariya/phantomjs/pull/212.

http://code.google.com/p/phantomjs/issues/detail?id=28
2012-03-12 22:44:13 -07:00
Ariya Hidayat 74d4a6bd90 Change tweets.js example to official HeadlessPhantom Twitter account.
http://code.google.com/p/phantomjs/issues/detail?id=425
2012-03-12 21:35:40 -07:00
Alessandro Portale 5eb9d8a102 No need for stdint.h and unistd.h when building with MSVC
MSVC 2008 and lower did not provide stdint.h and unistd.h.
This patch adjusts gif.pri, accordingly. We typedef uint32_t
ourselves in gif_hash.h.

http://code.google.com/p/phantomjs/issues/detail?id=424
2012-03-12 21:04:55 -07:00
Stephen Young 7615582e0c Proxy authentication support.
This is through --proxy-auth command-line option and proxyAuth
configuration setting.

http://code.google.com/p/phantomjs/issues/detail?id=105
2012-03-12 20:51:14 -07:00
Ivan De Marino 2451001d81 Create an import script for LineNoise.
This addresses [Issue #409](http://code.google.com/p/phantomjs/issues/detail?id=409).

The script:
* Get the latest code. Since LineNoise is pretty small, grabbing the tarball straight from the repo should be just fine.
* Extract and place the files in the right directory (src/linenoise).
* Remove unnecessary stuff (project files etc).
* Update the src/linenoise/README.md to refer to the revision being imported.
2012-03-12 20:44:04 -07:00
Ariya Hidayat 775c94942d Do not use module include.
For the same reason like in previous commit 685c5f5725: with our
minimalistic copy of Qt, the module header might be incomplete.

http://code.google.com/p/phantomjs/issues/detail?id=226
2012-03-09 07:42:53 -08:00
Ariya Hidayat 13d4f28ece Build scripts clean up.
The contents of deploy/build* scripts have been merged and consolidated
into ./build.sh as part of the Qt import workflow.

http://code.google.com/p/phantomjs/issues/detail?id=226
2012-03-09 07:29:48 -08:00
Ariya Hidayat ac699a4d90 WebKit: Support multiple console.log arguments.
http://code.google.com/p/phantomjs/issues/detail?id=36
2012-03-08 22:10:42 -08:00
Milian Wolff ac906391d4 support keep-alive in the webserver
The recent patch that brought asynchronous webserver response handling
made it impossible to have proper keep-alive support in the server.

We want the server to support keep-alive though, which is especially
useful when writing a PhantomJS script that allows one to "remote control"
PhantomJS, using the WebServer API, without flooding the TCP connections.
Also the performance might be improved.

Note: This patch reverts commit bbce8920d0,
and resets the Mongoose code to the vanilla 3.0 version. Instead we now
support the async handling of HTTP requests using some QWaitCondition
magic.

Note: keep-alive support is optional, and disabled by default. To enable
it, use something like:

server.listen(port, {"keep-alive": true}, function(request, response) {...});

Like before, calling response.close() is crucial. Furthermore though, a
server that has keep-alive enabled *must* set a proper "Content-Length: ..."
header in it's response, otherwise clients will not be able to know when
the response has finished.

fix memory leaks in webserver

ISSUE: 416 (http://code.google.com/p/phantomjs/issues/detail?id=416)
2012-03-08 22:10:17 -08:00
Ariya Hidayat a398b3fec0 Revamp the build scripts in deploy/.
Technically only deploy/package-linux-dynamic.sh is relevant and it's
been adjusted appropriately. All other files are obsoleted with the new
build process.

http://code.google.com/p/phantomjs/issues/detail?id=226
2012-03-08 21:58:30 -08:00
Ariya Hidayat 8c01f46e4d Qt build: More configuration flags for Mac OS X.
This is just adopting the settings from deploy/build-mac.sh.

http://code.google.com/p/phantomjs/issues/detail?id=226
2012-03-08 21:56:02 -08:00
Ariya Hidayat de13c551fb Qt Gui: Disable Graphics View.
Graphics View is not needed for PhantomJS.

http://code.google.com/p/phantomjs/issues/detail?id=414
2012-03-08 07:23:54 -08:00
Ariya Hidayat 1faf94de11 WebKit: Turn off accelerated compositing.
Compositing depends on Graphics View and/or GL-based texture mapper.
Since we don't plan to support either of them, at least for the near
future, we might as well disable compositing.

http://code.google.com/p/phantomjs/issues/detail?id=414
2012-03-08 07:23:22 -08:00
Ariya Hidayat cbe64f0f0f Fix file upload on Qt 4.8.
This is just applying enable_file_input_click.patch.

See the previous commit 00a8e72fb3.

http://code.google.com/p/phantomjs/issues/detail?id=307&q=upload
2012-03-06 23:11:24 -08:00
Ariya Hidayat 08fc50d149 Headless and PDF printing fixes.
This is just applying headless_and_pdf_fixes.patch.
See also https://github.com/ariya/phantomjs/pull/173..
2012-03-06 23:11:23 -08:00
Ariya Hidayat 6299e14641 Fix remote inspection to work.
This is applying fix_inspector.patch.
See also https://github.com/ariya/phantomjs/pull/173.

http://code.google.com/p/phantomjs/issues/detail?id=6
2012-03-06 23:11:23 -08:00
Ariya Hidayat b7a69df6ec Enable remote debugging.
This is just applying enable_debugger.patch.
See also https://github.com/ariya/phantomjs/pull/173.

http://code.google.com/p/phantomjs/issues/detail?id=6
2012-03-06 23:11:23 -08:00
Ariya Hidayat 714642c66c Qt workaround to prevent WebCoreMovieObserver confusion.
See the previous commit 30134bab5d.
This is just applying disable-quicktime-video.patch.

http://code.google.com/p/phantomjs/issues/detail?id=321
2012-03-06 23:11:08 -08:00
Ariya Hidayat 4ccfa463b9 Qt import: Script to build everything, for Linux and Mac OS X.
http://code.google.com/p/phantomjs/issues/detail?id=226
2012-03-06 19:01:24 -08:00
Ariya Hidayat 33f436d703 Qt import: use static build on Linux only.
http://code.google.com/p/phantomjs/issues/detail?id=226
2012-03-06 18:49:04 -08:00
Ariya Hidayat 685c5f5725 Qt import: Don't use module include.
In the current state of our imported minimalistic Qt, some header files
are missing. Since the module include like <QtGui> just includes
everything, this leads to a preprocessor error.

The solution is to include only needed headers from particular class.

http://code.google.com/p/phantomjs/issues/detail?id=226
2012-03-06 18:44:19 -08:00
Ariya Hidayat 36cd85a475 Qt import: Sync with the steps in deploy/build-helper.
http://code.google.com/p/phantomjs/issues/detail?id=226
2012-03-06 18:23:10 -08:00
Ariya Hidayat df93134703 Qt import: Use a customized src.pro.
We need to exclude building SQL, TestLib, and plugins.

http://code.google.com/p/phantomjs/issues/detail?id=226
2012-03-06 18:22:54 -08:00
Ariya Hidayat cbdd80e98e Qt import: Do not force the use HarfBuzz on Mac.
Configure option -harfbuzz breaks Linux build.

http://code.google.com/p/phantomjs/issues/detail?id=226
2012-03-06 17:53:44 -08:00
Brian Donovan f34e8b1528 Without arguments, functions must use parentheses in CoffeeScript.
http://code.google.com/p/phantomjs/issues/detail?id=326
2012-03-05 21:34:52 -08:00
Ivan De Marino 49c2900767 Adding short version of "--help" and "--version" command-line arguments.
This covers [Issue #408](http://code.google.com/p/phantomjs/issues/detail?id=408).
2012-03-05 21:20:52 -08:00
Ariya Hidayat 1ae3c5aa2b Change follow.* example to Twitter accounts of PhantomJS contributors.
http://code.google.com/p/phantomjs/issues/detail?id=405
2012-03-04 21:49:47 -08:00
Ariya Hidayat 4b3bb8e049 Add the missing usage info on REPL.
http://code.google.com/p/phantomjs/issues/detail?id=252
2012-03-04 21:39:13 -08:00
Ivan De Marino 61a3bf9021 A REPL for PhantomJS
This covers [Issue 252](http://code.google.com/p/phantomjs/issues/detail?id=252)

The commit is composed of 12 squashed commits:

commit efdc6ba4f143c30a690fd97d92d80fa412e79999
Author: Ivan De Marino <ivan.de.marino@gmail.com>
Date:   Mon Feb 27 00:19:36 2012 +0000

    Pretty-pringing and Completion Caching done!

    * This completes pretty-printing for the result of evaluated
    * expressions in the REPL.
    * Also, now we cache the "possible completions", to speed things up
    * a bit (nothing fancy though).
    * Minor tweaks to the internal doc and the way we "mock"
    * pretty-printing for QObjects/REPLCompletanle
    * All tests passing :)

commit 1f9ef690e112a535b431fca409b77bb9c09d1c70
Author: Ivan De Marino <ivan.de.marino@gmail.com>
Date:   Sun Feb 26 22:35:00 2012 +0000

    Moving most of REPL shim JavaScritp code in a separate file. Way
easier to work on.

commit 02d460a16fee14e7096ae7d899c03902c5b8a9c6
Author: Ivan De Marino <ivan.de.marino@gmail.com>
Date:   Sat Feb 25 20:25:18 2012 +0000

    Initialisation of the Completions is now done in a pure virtual.

    This means that every REPLCompletable object will ACTUALLY register
completion strings, ONLY if we are running a REPL
    and that object is ACTUALLY created.
    Otherwise, why bother?

    Adding completions for all exposed REPLCompletable objects

    Also, fixed an issue with _getCompletions()

commit 412c3778fb04aa1c7379f8e760afce702b0428dd
Author: Ivan De Marino <ivan.de.marino@gmail.com>
Date:   Tue Feb 21 00:49:17 2012 +0000

    Few more tweaks to the REPL:

    - Now 'phantom' is the first QObject with proper completion
    - No repetition in QObject completions
    - LVAL of any user expression is now correctly prettified and
      printed

    Major things left to do:

    - Cache completions (using QCache?)
    - Add completions for the other QObject
    - When the LVAL of a user expression is a QObject, print what's
      expected, not the QObject "real" structure

commit 46f04713c8165d898055e15478bb31403f8c93f1
Author: Ivan De Marino <ivan.de.marino@gmail.com>
Date:   Tue Feb 7 10:13:23 2012 -0800

    Pretty-print expressions result

    Still not done though: there are issues with the NON-Native JS
objects.

commit 98b2fe67651dc750b62c6fa9cf1d80317fd9ae06
Author: Ivan De Marino <ivan.de.marino@gmail.com>
Date:   Fri Feb 3 00:22:52 2012 -0800

    Introducing REPLCompletable.

    This class should be inherited by any JavaScript-exposed QObject, to
ensure correct Auto-Completion.

    Correct auto-completion for QObjects.

    - Now even QObjects can correctly provide auto-completion, and avoid
      showing "not for users" methods
    - The strings used for the auto-completion are stored in a single
      Index: minimum memory footprint
    - Still, there is optimization that should be done (when "searching"
      for the right completion by prefix)
    - Completion for the objects not set up yet, but now it's just a
      trivial sequence of "addCompletion('bla')" in their constructors

commit 9bd48618154b1530a37b41f4060440184e23253d
Author: Ivan De Marino <ivan.de.marino@gmail.com>
Date:   Thu Feb 2 00:20:25 2012 -0800

    Changing the way we import Linenoise.

    Will just import a specific commit, and update manually when needed.

commit cfc9bae9fbdab13b01019b34b7cbd565e3153780
Author: Ivan De Marino <ivan.de.marino@gmail.com>
Date:   Sun Jan 29 23:22:26 2012 -0800

    Made the REPL into a Singleton. With Auto-completion!.

    Reasons:
    1) Needed a pointer to function (i.e. a static method) to be used
with Linenoise to provide auto-completions
    2) It makes more sense, as it's not like we are going to have 2 REPL
running at the same time, are we?

    There are problems to address:
    - the enumeration in JS seems to return only the native interface of
      our objects
    - the function completions contain argument types of those functions
    - "private" methods are exposed

commit c78bd32e17f8e0e4cc4a0066858de8cc81d33b97
Author: Ivan De Marino <ivan.de.marino@gmail.com>
Date:   Sun Jan 29 22:10:20 2012 -0800

    Migrating from the original, now [unmantained
Linenoise](https://github.com/antirez/linenoise) to the fairly active
[tadmarshall fork](https://github.com/tadmarshall/linenoise).

    Also now the project is imported as a Git Submodule.
    Having migrated to the latest Linenoise (see prev. commit), now this
_SHOULD_ work on Windows too.
    But, of course, this needs testing. :)

commit 43713c5723d7c5ed446ba41ae8d6f8c9feba7f9b
Author: Ivan De Marino <ivan.de.marino@gmail.com>
Date:   Tue Jan 24 23:17:06 2012 -0800

    Now that the basics work, I'm adding support for REPL history.

    This is something almost everyone today is accustomed to.
    Also, now REPL history works!
    And I found some useful resources to solve pending TODOs.

commit 31e5f88b044a5b4a823c67527ef8c245d2ac7863
Author: Ivan De Marino <ivan.de.marino@gmail.com>
Date:   Sun Jan 22 20:56:36 2012 -0800

    Adding Linenoise Project (https://github.com/antirez/linenoise).

    For now is included as a drop-in set of files.
    Later on, if the Linenoise project has frequent
    updates, we might prefer to do it as a
    git-submodule.

commit 4be9c15c65db4767e482fba0be13f8aab286d5f3
Author: Ivan De Marino <ivan.de.marino@gmail.com>
Date:   Thu Jan 5 15:31:13 2012 +0000

    First simple REPL implementation.

    - Not complete
    - Still doesn't handle arrow keys (needed for history)
2012-03-04 21:33:08 -08:00
Milian Wolff a0ef8cb898 simplify maintenance of custom qt-patches during deployment
generic patches now reside in deploy/qt-patches/all
while 4.8 patches are now in deploy/qt-patches/4.8

all *.patch files in these folders are applied during deployment

http://code.google.com/p/phantomjs/issues/detail?id=197
http://code.google.com/p/phantomjs/issues/detail?id=142
2012-03-04 21:07:26 -08:00
Milian Wolff 9943ae541b fix headless-build on linux
in such cases, DISABLE_HEADLESS was unset and hence
the expansion -a -eq 0 resulted in a bash error:

bash: [: too many arguments

this is fixed now by using string-based comparison

http://code.google.com/p/phantomjs/issues/detail?id=197
2012-03-04 21:06:24 -08:00
Ariya Hidayat 0d77f588ec Qt Mac: workaround qt_menu.nib problem.
This is applying qapplication_skip_qtmenu.patch.

See also the upstream bug:
https://bugreports.qt.nokia.com/browse/QTBUG-5952

http://code.google.com/p/phantomjs/issues/detail?id=226
2012-03-02 07:25:31 -08:00
Ariya Hidayat ee4cc1125f Qt: allow static build of WebKit.
This is applying allow-static-qtwebkit.patch already used for the
deploy script.

http://code.google.com/p/phantomjs/issues/detail?id=226
2012-03-02 07:25:10 -08:00
Ariya Hidayat 61c4e4b261 Add Qt 4.8.0 source tree.
This is done via the tools/import-qt.sh script. Note that the script
also removes some unnecesary stuff. In practice, src/qt is not as
big as the plain vanilla Qt source tree.

http://code.google.com/p/phantomjs/issues/detail?id=226
2012-03-02 07:23:58 -08:00
Ariya Hidayat da078de819 Add the importer script to include Qt source.
http://code.google.com/p/phantomjs/issues/detail?id=226
2012-03-02 07:22:09 -08:00
Chris Smith ddc0a7d623 Fix jasmine example terminating too early against jasmine 1.1.0.
The .finished-at element that was being checked for is present all
the time during the test run, so the waitFor call ended too early.

http://code.google.com/p/phantomjs/issues/detail?id=402
2012-03-01 08:17:51 -08:00
Milian Wolff 61eb86782b Filesystem module should allow reading and writing binary files.
CommonJS proposal: http://wiki.commonjs.org/wiki/Filesystem/A.
It's called "raw".

http://code.google.com/p/phantomjs/issues/detail?id=400

Squashed commit of the following:

commit dd5fab4778bb7b67f1eca26a07d430aadd458c6e
Author: Milian Wolff <milian.wolff@kdab.com>
Date:   Thu Feb 23 16:19:21 2012 +0100

    the "mode" string is now properly parsed, and not only the first
    char evaluated. This allows us to do fancy things like

    fs.open(file, "rw+"); // read/write/append

    Furthermore .read() is adapted such that it will always return the
    full file contents, no matter where we have seeked to before (i.e.
    by passing + we seek to the end, hence read() would always return
    an empty string).

    To open a binary file, pass "b" in the mode string to fs.open, e.g.:

    fs.open(file, "rb"); // read binary
    fs.open(file, "wb"); // write binary
    fs.open(file, "rwb+"); // read/write binary, append

    alternatively, one can use these shortcuts:

    fs.write(file, contents, "b"); // write binary
    fs.read(file, "b"); // read binary

    Unit tests are extended and the echoToFile.js example fixed (it did not
    close the file, which lead to the contents never getting written
    on-disk since flush() is never called).

    Also note that the FileSystem::open method was cleaned up and at least
    one memory leak (if QFile* could not open) was fixed. The code should
    now also be more C++-like.

commit 41139951138491459accefab22d48eba7b0b9900
Author: Milian Wolff <milian.wolff@kdab.com>
Date:   Wed Feb 15 16:39:23 2012 +0100

    use QString instead of QByteArray for raw binary data

    QByteArray is simply unusable in JavaScript, since functions like
    e.g. window.btoa expect a string. Also there is no sane way to
    create a byte array in javascript, as ArrayBuffer e.g. is not
    supported by QScript (at least there is no conversion in place).

    If we use QString and some custom read/write code this all works
    as expected though, we can use window.btoa to base64 encode binary
    data and we can create random binary data using String.fromCharCode

    also adds a unit test

commit e45673486ef27daf916902153217f9e5001b68c9
Author: Milian Wolff <milian.wolff@kdab.com>
Date:   Wed Feb 15 14:39:15 2012 +0100

    make it possible to read/write raw/binary files

    this adds File::readRaw and File::writeRaw functions,
    as well as 'shimmed' versions FS::readRaw and FS::writeRaw

    these functions directly use QFile and QByteArray instead of
    QTextStream and QString, making it possible to read and write
    binary data, e.g. images and such.
2012-02-29 07:55:00 -08:00
Jon Leighton e88e008ecf Add option to specify whether or not the remote debugger should autorun.
http://code.google.com/p/phantomjs/issues/detail?id=399
2012-02-28 07:46:09 -08:00
Jon Leighton d17bf8c825 Enable remote web inspector on sub-pages.
Currently trying to use the remote debugger with sub-pages created in
the phantomjs session will result in a segfault inside QtWebKit. With
this patch, it works.

http://code.google.com/p/phantomjs/issues/detail?id=6
2012-02-28 07:41:19 -08:00
Ariya Hidayat 4515332d9d Merge remote-tracking branch 'KDAB/printing-margin' 2012-02-23 07:56:45 -08:00
Milian Wolff a638a07339 js-ify, rename and extend print-margins property
Now the left/top/right/bottom print margins can be set separately
using the pageSize.margin property. You can either use

pageSize.margin = "10px"

or use a map to set the margins separately:

pageSize.margin = {
  left: "10px",
  top: "5cm",
  right: "7in",
  bottom: "13mm"
};

pageSize.border is now a synonym for pageSize.margin to keep
compatibility to existing scripts.

ISSUE: 388 (http://code.google.com/p/phantomjs/issues/detail?id=388)
2012-02-23 14:25:16 +01:00
david cd0567e8cd Add support for HTTP request headers modification.
http://code.google.com/p/phantomjs/issues/detail?id=77
2012-02-19 00:49:28 -08:00
Baffo32 5a53b7ad55 Provide an initial base URL for the root webpage so it is not sandboxed.
This resolves for me http://code.google.com/p/phantomjs/issues/detail?id=257.
2012-02-18 21:33:03 -08:00
Baffo32 9d1c2e90ac Update phantom spec version test 2012-02-15 18:47:56 -08:00
Milian Wolff 1411ebdff6 make POST/PUT data accessible from phantomjs server scripts
For POST and PUT request we now read all data as defined by
the Content-Length header into request.rawData property.
This property is a QByteArray which neatly maps to an array
in javascript.

For POST requests with Content-Type = applicaiton/x-www-form-urlencoded
we furthermore provide a parsed, easy-to-use request.post property.
This one is a QVariantMap of the decoded form data.

There is a new postserver.js example that shows the usage.

The unit test is extended to test the new (and old) features
of the server.

TODO: test that verifies proper decoding of UTF8 data, which
is not yet possible since I see no way to do a post-request
using phantomjs with an explicitly defined charset

ISSUE: 340 (http://code.google.com/p/phantomjs/issues/detail?id=340)
2012-02-15 18:41:51 -08:00
Milian Wolff b224feb246 make it possible to set printing margins separately 2012-02-15 15:55:09 +01:00
Leo Franchi bbce8920d0 Make Mongoose webserver asynchronous.
This allows for asynchronous reply handling, which is much more logical when dealing with the async
nature of PhantomJS like page.open(). This uses a async patch from Andy Rahn's Mongoose close,
available here: http://code.google.com/r/andyrahn-async/

This is from https://github.com/ariya/phantomjs/pull/202.

http://code.google.com/p/phantomjs/issues/detail?id=326
2012-02-14 23:08:38 -08:00
Jon Leighton 7fa13832ef Deploy script refactoring and improvements.
For some detailed discussion, check out
https://github.com/ariya/phantomjs/pull/190.

http://code.google.com/p/phantomjs/issues/detail?id=197
http://code.google.com/p/phantomjs/issues/detail?id=142
2012-02-09 01:12:47 -08:00
Ariya Hidayat d40fb8e637 Merge pull request #199 from execjosh/fix-issue-367
Charset option for `fs.{open,read,write}`
2012-02-04 23:40:31 -08:00
Ariya Hidayat 86e28b0bf1 Merge pull request #200 from execjosh/fix-issue-365
Assume local file if URL scheme is empty (Issue 365)
2012-02-04 23:07:55 -08:00
execjosh 32b3e06ab4 Limit local file URL fix to Qt 4.8.0
http://code.google.com/p/phantomjs/issues/detail?id=365#c17
http://code.google.com/p/phantomjs/issues/detail?id=365#c18
2012-02-05 10:46:31 +09:00
execjosh 9123e4b01f Assume local file if URL scheme is empty
http://code.google.com/p/phantomjs/issues/detail?id=365
2012-02-05 00:31:35 +09:00
Maurice Svay 28071ebcae Update content, optimize loading
Add favicon
Update content
Add links
Add :hover states
Add credits for icons
Minify CSS

http://code.google.com/p/phantomjs/issues/detail?id=355
2012-02-03 09:10:35 -08:00
Maurice Svay e734c3180f Website: new homepage (not optimized)
http://code.google.com/p/phantomjs/issues/detail?id=355
2012-02-03 08:43:18 -08:00
execjosh c22dfdc576 Implement charset param for fs.{open,read,write}
http://code.google.com/p/phantomjs/issues/detail?id=367
2012-02-03 00:44:14 +09:00
execjosh 21906c5536 Allow passing option object to fs.{open,read,write}
http://code.google.com/p/phantomjs/issues/detail?id=367
2012-02-03 00:34:45 +09:00
Ariya Hidayat f6c29b16c1 Remove PyPhantomJS.
Since there is no future maintainer, the code should not be there anymore.

http://code.google.com/p/phantomjs/issues/detail?id=344
2012-01-15 18:24:18 -08:00
Ariya Hidayat 1770a4fd33 Add existing contents of the web site.
First step towards collaboration on the improved new site.

http://code.google.com/p/phantomjs/issues/detail?id=355
2012-01-15 18:16:52 -08:00
Antono Vasiljev 8f08d54b13 Fix version number
1.5 (development) (development) -> 1.5 (development)

  koz it's wrong and also breaks guard-jasmine version parser
2012-01-12 03:06:25 -08:00
execjosh 12504321e1 Add conventional "--help" option
Most command-line programs provide an option to display the usage
message.  Currently, this is achieved by passing no options at all.
This change allows for a more intuitive way for users to check the
list of available options.

http://code.google.com/p/phantomjs/issues/detail?id=347
2012-01-12 03:02:46 -08:00
Ariya Hidayat ada732f4f4 Make sure POST works.
With Qt 4.8, POST request with an empty content type will make the
content type set to "application/octet-stream". Somehow this breaks
POST.

The fix is to set the content type to "application/x-www-form-urlencoded",
like the case with Qt 4.7.

Based on the suggestion by Leo Franchi.

http://code.google.com/p/phantomjs/issues/detail?id=337
2012-01-10 08:26:38 -08:00
Ariya Hidayat 2ed8acb630 Merge pull request #189 from detro/master
Minor fixes found during my catchup process
2012-01-04 16:47:18 -08:00
Ivan De Marino 1531595d2e Heavily simplified (and I dare to say: speed up) the way the remote debugger harness is loaded and injected. 2012-01-04 17:24:36 +00:00
Ivan De Marino e5cd882e6a Fixed type mismatch for this Constructor Parameter. 2012-01-04 17:06:55 +00:00
Ivan De Marino e7ab5e31da Removing a 1 liner method (aka, almost useless) that indeed is not declared (hence, unusable).
Ehm? What?
2012-01-04 17:06:10 +00:00
Ivan De Marino e4f1eb7f99 Removing a forward declaration "left over". 2012-01-04 16:59:49 +00:00
Ivan De Marino 4fd7fb9d40 Fixing what seems like a "copy & paste went wrong".
The parameter "startingScript" was never used, and I think it comes from the sibling method "injectJsInFrame".
2012-01-04 16:56:31 +00:00
Ivan De Marino 7f42c28024 Fixing a typo (I wonder how did this even worked when tested...). 2012-01-04 16:54:38 +00:00
Alessandro Portale 66a79203b1 Fix linking on Windows
mongoose needs symbols from Ws2_32.lib

http://code.google.com/p/phantomjs/issues/detail?id=331
2012-01-03 07:42:51 -08:00
Ariya Hidayat 037009fefe Changes for 1.4.1. 2011-12-30 08:28:56 -08:00
Ariya Hidayat 84cd6a61ad Merge branch 'master' of github.com:ariya/phantomjs
Conflicts:
	deploy/build-mac.sh
2011-12-30 07:32:12 -08:00
Ariya Hidayat 4e5319771c Merge pull request #187 from jonleighton/qt_48_fixes
Qt 4.8 fixes
2011-12-30 07:03:14 -08:00
Jon Leighton e6b6f2ec2e Add a test for file upload support 2011-12-30 11:58:23 +00:00
Jon Leighton 39e4485ce3 Ignore source files in the deploy/ directory 2011-12-30 11:47:09 +00:00
Jon Leighton 977e1aab17 Make linux build script use the Qt 4.8.0 tarball.
Also make it always put the files in deploy/, regardless of where the
script is run from. (So use can run deploy/build-linux.sh from the root
directory.)
2011-12-30 11:47:03 +00:00
Jon Leighton 00a8e72fb3 Fix file upload on Qt 4.8.
Code was added to WebKit to detect whether the click event on the file
input element is triggered by user action or by a script. If it's by a
script, the event is ignored. This prevented us from simulating a click
on the element.

This fix just patches WebKit to remove the detection.

The relevant WebKit commit is:

  931870c11b

The associated WebKit bug is:

  https://bugs.webkit.org/show_bug.cgi?id=47593

Our bug is:

  http://code.google.com/p/phantomjs/issues/detail?id=307&q=upload
2011-12-30 11:46:58 +00:00
Ariya Hidayat 30134bab5d Workaround to prevent WebCoreMovieObserver confusion.
The solution is for the static build script to disable QuickTime video.
In many cases, video support for a headless engine is not so useful.

http://code.google.com/p/phantomjs/issues/detail?id=321
2011-12-29 19:25:18 -08:00
Will 91b272760b Allow proxy type to be set on the command line.
http://code.google.com/p/phantomjs/issues/detail?id=266
2011-12-26 13:16:31 -08:00
Ariya Hidayat 48027a3f01 Don't display debugging and warning messages.
http://code.google.com/p/phantomjs/issues/detail?id=323
2011-12-25 03:34:42 -08:00
Ariya Hidayat 195bb7238c Only support Qt >= 4.7.
http://code.google.com/p/phantomjs/issues/detail?id=272
2011-12-23 21:18:14 -08:00
Ariya Hidayat 7592806fb8 Current master is for PhantomJS 1.5. 2011-12-23 21:08:42 -08:00
Ariya Hidayat bb07cb941e Linux build script: Keep to 4 parallel jobs at most.
http://code.google.com/p/phantomjs/issues/detail?id=197
2011-12-23 21:06:23 -08:00
Ariya Hidayat a383afefd0 Refer to 1.4 in the README. 2011-12-22 21:56:11 -08:00
Ariya Hidayat b465acf5d3 Don't create window.WebServer.
It was done for WebPage for backward compatibility and it would be
removed in the future, so don't do it for WebServer.

http://code.google.com/p/phantomjs/issues/detail?id=115
2011-12-22 21:55:00 -08:00
Ariya Hidayat 6356c28ba3 Mac build script: x86 only for better compatibility.
http://code.google.com/p/phantomjs/issues/detail?id=142
2011-12-22 21:54:55 -08:00
Ariya Hidayat 7ad2f213c8 Mac build script: Make sure it's executable.
http://code.google.com/p/phantomjs/issues/detail?id=142
2011-12-22 21:54:51 -08:00
Ariya Hidayat 90252916a6 Static build: Don't merge Mac and Linux script.
Apparently with Qt 4.8, static build on Linux does not work out of the
box so there is no need to merge the static build scripts.

Also, tweak some configure options.

http://code.google.com/p/phantomjs/issues/detail?id=142
http://code.google.com/p/phantomjs/issues/detail?id=197
2011-12-22 21:54:37 -08:00
1988 changed files with 519178 additions and 23407 deletions

58
.gitignore vendored
View File

@ -2,7 +2,6 @@
*.pro.user*
*.xcodeproj
Makefile*
bin/phantomjs
*~
*.moc
moc_*
@ -10,10 +9,53 @@ qrc_*
*.o
*.swp
*.pyc
debian/*.debhelper
debian/files
debian/*.log
debian/*.substvars
debian/*/
python/build/
python/*.egg-info/
*.a
/debian/*.debhelper
/debian/files
/debian/*.log
/debian/*.substvars
/debian/*/
/deploy/qt-*.tar.gz
/deploy/Qt-*
/symbols
/src/qt/qtc-debugging-helper
/src/phantomjs_plugin_import.cpp
# ignore ctags
/tags
/tools/dump_syms.app/
# Ignore Visual Studio temporary files, build results, etc
*.suo
*.user
*.sln.docstates
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.log
*.sdf
*.vcxproj
*.vcxproj.filters
*.lib
*.prl
*.intermediate.manifest
# Build results
[Dd]ebug*/
[Rr]elease/
bin/
*.class
build/
.gradle/

29
.travis.yml Normal file
View File

@ -0,0 +1,29 @@
language: cpp
compiler:
- gcc
cache: apt
before_install:
- sudo apt-get -yqq update #< Suggested by the Travis CI doc
- sudo apt-get -fyq install #< Fixes inconsistency of packages installed previously
install:
- sudo apt-get -yq install build-essential chrpath libssl-dev libfontconfig1-dev sqlite3 libsqlite3-dev ruby gperf bison flex libicu48 libicu-dev #< Build Dependencies
before_script:
- chmod +x ./build.sh
- chmod +x ./test/run-tests.sh
- chmod +x ./test/run-tests-ghostdriver.sh
script:
- ./build.sh --confirm --silent #< Build
- ./test/run-tests.sh #< Test (PhantomJS)
- ./test/run-tests-ghostdriver.sh #< Test (GhostDriver / PhantomJSDriver)
notifications:
irc:
channels:
- "irc.freenode.org#phantomjs"
on_success: always
on_failure: always
use_notice: true

88
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,88 @@
# Contribution Guide
This page describes how to contribute changes to PhantomJS.
Please do **not** create a pull request without reading this guide first. Failure to do so may result in the **rejection** of the pull request.
## For The Impatients
**Work on a feature branch**.
If your changes need to be modified due to some reviews, it is less clutter to tweak an isolated feature branch and push it again.
**Create a ticket in the issue tracker**.
This serves as a placeholder for important feedback, review, or any future updates.
In the commit message:
* **Keep the first line < 72 characters**. Write additional paragraphs
if necessary.
* **Put the link to the issue** (see above). This is important for cross-referencing purposes.
## Communicate
*Second opinion is always important.*
**Bug fixing**. If you have a fix for a bug, please attach your patch in the corresponding issue in the [issue tracker](https://github.com/ariya/phantomjs/issues). If there is no entry for the bug yet, then please create a new one. If you are confident working with Git, see the Get Ready section below on how to submit your change.
**Improvement and feature request**. If you have an improvement idea, please send an email to the [mailing list](http://groups.google.com/group/phantomjs) (rather than contacting the developers directly) so that other people can give their insights and opinions. This is also important to avoid duplicate work.
**Task management**. Once the feature idea is agreed upon and translated into concrete actions and tasks, please use the [issue tracker](https://github.com/ariya/phantomjs/issues) to create an issue for each individual task. Further technical discussion about the task and the implementation details should be carried out in the issue tracker.
**Extending with new API**. Whenever you want to introduce a new API, please send an email to the mailing list along with the link to the issue. Consider good API name for the object or function, read the [API Design Principle](http://developer.qt.nokia.com/wiki/API_Design_Principles) article. It may require few iterations to agree on the final API and hence it is important to engage all interested parties as early as possible.
## Get Ready
For your proposed change, you need to have:
* **an issue** (in the issue tracker) which describe your bug or feature
* **a feature branch** in your git fork
### Refer the Issue
The commit message needs to link to the issue. This cross-reference is [very important](http://ariya.ofilabs.com/2012/01/small-scale-software-craftsmanship.html) for the following reasons.
First, the commit log is frozen and can not be changed. If it contains a mistake or outdated information, the log can not be amended. However, further updates can be still posted to the linked issue, which can be followed from the commit log itself.
Second, it provides a placeholder for code review and other feedback.
An example of a bad commit log:
Fix Mountain Lion
The above log is too short and useless in the long run. A better version (and note the issue link):
Better support for OS X Mountain Lion.
require('system').os.version should give "10.8 (Mountain Lion)".
https://github.com/ariya/phantomjs/issues/10688
### Use Feature Branch
To isolate your change, please avoid working on the master branch. Instead, work on a *feature branch* (often also known as *topic branch*). You can create a new branch (example here crash-fix) off the master branch by using:
git checkout -b crash-fix master
Refer to your favorite Git tutorial/book for further detailed help.
Some good practices for the feature branch:
* Give it a meaningful name instead of, e.g. `prevent-zero-divide` instead of just `fix`
* Make *granular* and *atomic* commits, e.g. do not mix a typo fix with some major refactoring
* Keep one branch for one specific issue. If you need to work on other unrelated issues, create another branch.
## Review and Merge
When your branch is ready, send the pull request.
While it is not always the case, often it is necessary to improve parts of your code in the branch. This is the actual review process.
Here is a check list for the review:
* It does not break the test suite
* There is no typo
* The coding style follows the existing one
* There is a reasonable amount of comment
* The license header is intact
* All examples are still working

245
ChangeLog
View File

@ -1,4 +1,247 @@
Please see also http://code.google.com/p/phantomjs/wiki/ReleaseNotes.
Please see also http://phantomjs.org/releases.html.
2015-01-23: Version 2.0.0
New features
* Switched to Qt 5 and updated WebKit (issue 10448)
* Implemented clearing of memory cache (issue 10357)
* Added support for HTTP header change for every request (issue 11299)
Improvements
* Fixed rendering of CJK text by always linking the codecs (issue 10249)
* Ensured onResourceReceived is still fired on an error (issue 11163)
* Fixed possible crash in handling network requests (issue 11252)
* Removed hardcoded GhostDriver launching message (issue 12681)
* Allowed disk cache more than 2 GB (issue 12303)
Examples
* Netsniff example should exit when fails to load (issue 11333)
2014-01-25: Version 1.9.7
* Reverted to GhostDriver 1.1.0 instead of 1.1.1 (issue 11915)
* Fixed another warning of obsolete userSpaceScaleFactor on OS X 10.9 (issue 11612)
2014-01-20: Version 1.9.6
* Updated GhostDriver to version 1.1.1 (issue 11877, 11893)
2014-01-19: Version 1.9.3
* Fixed CoreText performance note on OS X 10.9 (issue 11418)
* Fixed warning of obsolete userSpaceScaleFactor on OS X 10.9 (issue 11612)
2013-09-06: Version 1.9.2
* Fixed graphical artifacts with transparent background on Windows (issue 11276, 11007, 11366)
* Updated GhostDriver to version 1.0.4 (issue 11452)
2013-06-04: Version 1.9.1
Critical bug fixes:
* Fixed problems with specifying proxy server (issue 10811, 11117)
* Fixed UTF-8 encoding with system.stdout and system.stderr (issue 11162)
* Ensured that onResourceReceived will be always invoked (issue 11163)
* Fixed module loading from an absolute path on Windows (issue 11165)
* Fixed typo in the command-line option for setting the cache size (11219)
* Fixed possible crash when handling network requests (issue 11252, 11338)
2013-03-20: Version 1.9.0 "Sakura"
New features
* Added spawn and execFile to execute external programs (issue 10219)
* Added the ability to abort network requests (issue 10230)
* Added system access to stdin, stdout, and stderr (issue 10333)
* Added support for custom CA certificates location (issue 10916)
* Added seek function to the File stream (issue 10937)
* Implemented file read for a specified number of bytes (issue 10938)
* Added a callback to handle network error (issue 10954, 10997)
* Added custom encoding support when opening a page (issue 11043)
* Implemented require.stub() support for a factory function (issue 11044)
* Added page loading indicator and progress (issue 11091)
* Added a timeout option for network requests (issue 11129)
Improvements
* Fixed the build on FreeBSD (issue 10597)
* Ensured a consistent 72 dpi for Linux headless rendering (issue 10659)
* Fixed possible PDF error due to invalid CreationDate field (issue 10663)
* Fixed crash when uploading non existing files (issue 10941)
* Improved the autocomplete internal of the interactive/REPL mode (issue 10943)
* Fixed possible crash when accessing inline frames (issue 10947)
* Changed Linux binary package setup to be built on CentOS 5 (issue 10963)
* Extended SSL ignore setting to synchronous XHR (issue 10985)
* Added convenient constants for modifier keys (issue 11056)
* Fixed incorrect date handling in the cookies (issue 11068)
* Updated GhostDriver to version 1.0.3 (issue 11146)
Examples
* Fixed invalid data URI in the netsniff example (issue 10740)
* Implemented a new weather example (issue 10794)
* Fixed rendering issues in render_multi_url (issue 11021)
* Fixed proper event sequence in page_events example (issue 11028)
* Miscellanous tweaks (issue 11082)
2013-03-02: Version 1.8.2
Critical bug fixes:
* Fixed possible PDF error due to invalid CreationDate field (issue 663)
* Fixed crash when uploading non existing files (issue 941)
* Fixed possible crash when accessing inline frames (issue 947)
* Extended SSL ignore setting to synchronous XHR (issue 985)
* Fixed incorrect date handling in the cookies (issue 1068)
2013-01-06: Version 1.8.1
Critical bug fix:
* Mac OS X: Fix possible crash when using some TrueType fonts (issue 690)
2012-12-21: Version 1.8.0 "Blue Winter Rose"
New features
* Integrated GhostDriver as the WebDriver implementation (issue 49)
* Added an option to specify the SSL protocol (issue 174)
* Added encoding support for WebServer's response (issue 505)
* Added process ID (PID) to the System module (issue 769)
* Added properties to obtain page and frame title (issue 799)
* Added page navigation methods (issue 808)
* Added support for modifier keys in keyboard events (issue 835)
* Added onFilePicker callback for more generic file upload API (issue 843)
* Added the ability to set the page content and location (issue 909)
Improvements
* Fixed date parsing in ISO8601 format (issue 187, 267)
* Fixed window.location (issue 530, 632)
* Deregistered multiple callback handler (issue 807)
* Fixed sending of double-click events (issue 848)
* Increases maximum number of redirects (issue 849)
* Fixed keycodes sent for lowercase characters (issue 852)
* Fixed a regression in table row page break (issue 880)
* Completed the CoffeeScript version of the examples (issue 907)
* Updated Qt to version 4.8.4 (issue 918)
* Fixed potential hang in some example scripts (issue 922)
2012-09-22: Version 1.7.0 "Blazing Star"
New features
* Added a module system modelled after CommonJS/Node.js (issue 47)
* Added support for window pop-up (issue 151)
* Static build on Linux (issue 413)
* Added run-time detection of SSL support (issue 484)
* Added more events support (issue 492, 712)
* Added support for disabling automatic proxy detection (issue 580)
* Provided page closing callback (issue 678)
* Added methods to access URL, frames URL, frame Content (issue 758)
* Added more cookies-related API (issue 761)
Improvements
* Refactored command-line options handling (issue 55)
* Improved the workflow for producing release builds (issue 599)
* Improved cookies API and implementation (issue 603, 761)
* Improved frame switching API (issue 654)
* Fixed iframe handling regression (issue 683)
* Fixed OS version number with Windows 8 and Mountain Lion (issue 684, 688)
* Fixed HAR navigation info in the netsniff example (issue 733)
* Fixed compile warnings with Visual Studio (issue 744)
* Removed hacks for static linking on Windows (issue 753)
* Added ICO image handling on Windows (issue 779)
* Fixed font antialiasing on Windows (issue 785)
* Improved Jasmine test runner for Jasmine 1.2 (issue 792)
2012-07-22: Version 1.6.1
Bug fixes
* Don't build the deploy in debug mode (issue 599)
* Fixed building on Windows (issue 424)
* Fixed remote inspector when building statically (issue 430)
2012-06-20: Version 1.6.0 "Lavender"
New features
* Added support for passing arguments to WebPage's evaluate (issue 132)
* Added callbacks for JavaScript onConfirm and onPrompt (issue 133)
* Added stack trace when error occurs (issue 166)
* Added support for local storage path and quota (issue 300)
* Added initial support for cookies handling (issue 354)
* Added support for header footer when printing the page (issue 410, 512)
* Added headers support in the loading request (issue 452)
* Added support to render the web page as base64-encoded string (issue 547)
* Added hooks for navigation event (issue 562)
* Added command-line option to show debug messages (issue 575)
* Added support for the zoom factor for web page rendering (issue 579)
* Added crash reporter for Mac OS X and Linux, based on Google Breakpad (issue 576)
* Added 'os' object to the system module (issue 585)
* Added support for asynchronous evaluation (issue 593)
Improvements
* Fixed remote debugging to work on Mac OS X and Windows (issue 430)
* Fixed web server getting the dropped connection for empty response (issue 451)
* Fixed text rendered as boxes (squares) on headless Linux (issue 460)
* Updated Qt to version 4.8.2 (issue 495)
* Updated CoffeeScript compiler to version 1.3.3 (issue 496)
* Fixed the build script to detect and use MAKEFLAGS (issue 503)
* Fixed the build script to properly pass Qt config flags (issue 507)
* Changed Info.plist to be embedded in Mac OS X executable (issue 528)
* Fixed wrong module require in the imagebin example (issue 536)
* Fixed example scripts to exit with the right exit code (issue 544)
* Fixed build failure with glib 2.31.0+ (issue 559)
* Fixed error handler failures in some cases (issue 589)
* Fixed Twitter-related examples to work with the new site (issue 609)
2012-03-20: Version 1.5.0 "Ghost Flower"
New features
* Added interactive mode, also known as REPL (issue 252)
* Added setting for web security, to allow cross domain XHR (issue 28)
* Added error handler for WebPage object (issue 166)
* Added support for custom HTTP header in the network request (issue 77)
* Added support for read write encoding in the file system module (issue 367)
* Added remote debugging support on Linux (issue 6)
* Added support for proxy authentication (issue 105)
* Added System module, to retrieve environment variables (issue 271) and arguments (issue 276)
* Added fs.readLink function (issue 329)
* Added support for reading and writing binary data (issue 400)
* Added support to retrieve request data in the WebServer? module (issue 340)
* Added support for individual top/bottom/left/right print margins (issue 388)
* Added command-line option --help (issue 347)
* Added short command-line options -v and -h (issue 408)
* Removed support for Flash and other plugins (issue 418)
Bug fixes
* Fixed multiple console.log arguments (issue 36)
* Fixed file upload (issue 307)
* Fixed the web server instance to be asynchronous (issue 326) and still support Keep Alive (issue 416)
* Workaround Qt 4.8.0 crash due to empty URL scheme (issue 365)
* Fixed a Content-Type problem where POST does not work (issue 337)
* Fixed reading body request in the web server even without specific Content-Type (issue 439)
* Fixed Jasmine test runner with Jasmine 1.1 (issue 402)
* Fixed request URL formatting in the web server (issue 437)
* Don't display debugging and warning messages (issue 323)
2011-12-31: Version 1.4.1
Bug fixes
* Fix setting the proxy type (issue 266)
* Workaround for file upload regression (issue 307)
* Fix extraneous messsages in non-debug mode (issue 323)
2011-12-22: Version 1.4.0 "Glory of the Snow"

View File

@ -1,33 +1,46 @@
PhantomJS ([www.phantomjs.org](http://phantomjs.org)) is a headless WebKit with JavaScript API.
# [PhantomJS](http://phantomjs.org) - Scriptable Headless WebKit
It has **fast** and **native** support for DOM handling, CSS selector, JSON, Canvas, and SVG.
PhantomJS ([www.phantomjs.org](http://phantomjs.org)) is a headless WebKit scriptable with JavaScript. It is used by hundreds of [developers](http://phantomjs.org/buzz.html) and dozens of [organizations](http://phantomjs.org/users.html) for web-related development workflow.
PhantomJS is cross-platform, it can be compiled for Linux, Windows, FreeBSD, and Mac OS X.
Refer to the [build instructions](http://code.google.com/p/phantomjs/wiki/BuildInstructions)
for details.
The latest [stable release](http://phantomjs.org/release-2.0.html) is version 2.0.
**Note**: If you are on Mac OS X, [read the notice](http://code.google.com/p/phantomjs/wiki/BuildInstructions#Mac_OS_X)
before you start using `brew` or `port` to install Qt and/or PhantomJS.
**Note**: Please **do not** create a GitHub pull request **without** reading the [Contribution Guide](https://github.com/ariya/phantomjs/blob/master/CONTRIBUTING.md) first. Failure to do so may result in the rejection of the pull request.
PhantomJS scripts can be written in JavaScript or [CoffeeScript](http://jashkenas.github.com/coffee-script/).
## Use Cases
See also [quick start guide](http://code.google.com/p/phantomjs/wiki/QuickStart)
and more [advanced examples](http://code.google.com/p/phantomjs/wiki/ServiceIntegration)
which show various PhantomJS scripts, covering:
- **Headless web testing**. Lightning-fast testing without the browser is now possible! Various [test frameworks](http://phantomjs.org/headless-testing.html) such as Jasmine, Capybara, QUnit, Mocha, WebDriver, YUI Test, BusterJS, FuncUnit, Robot Framework, and many others are supported.
- **Page automation**. [Access and manipulate](http://phantomjs.org/page-automation.html) web pages with the standard DOM API, or with usual libraries like jQuery.
- **Screen capture**. Programmatically [capture web contents](http://phantomjs.org/screen-capture.html), including CSS, SVG and Canvas. Build server-side web graphics apps, from a screenshot service to a vector chart rasterizer.
- **Network monitoring**. Automate performance analysis, track [page loading](http://phantomjs.org/network-monitoring.html) and export as standard HAR format.
* getting driving direction
* showing weather forecast conditions
* finding pizza in New York
* looking up approximate location based on IP address
* pulling the list of seasonal food
* running regression tests from command line
* producing PDF version of a Wikipedia article
* rasterizing SVG to image
## Features
Do not forget to consult the concise [API Reference](http://code.google.com/p/phantomjs/wiki/Interface).
- **Multiplatform**, available on major operating systems: Windows, Mac OS X, Linux, and other Unices.
- **Fast and native implementation** of web standards: DOM, CSS, JavaScript, Canvas, and SVG. No emulation!
- **Pure headless (no X11) on Linux**, ideal for continuous integration systems. Also runs on Amazon EC2, Heroku, and Iron.io.
- **Easy to install**: [Download](http://phantomjs.org/download.html), unpack, and start having fun in just 5 minutes.
PhantomJS is based on [Qt](http://qt.nokia.com). There are two implementations, using C++ and Python.
## Ecosystem
PhantomJS needs not be used only as a stand-alone tool. Check also some excellent related projects:
- [CasperJS](http://casperjs.org) enables easy navigation scripting and common high-level testing.
- [Poltergeist](https://github.com/jonleighton/poltergeist) allows running Capybara tests headlessly.
- [Guard::Jasmine](https://github.com/netzpirat/guard-jasmine) automatically tests Jasmine specs on Rails when files are modified.
- [GhostDriver](http://github.com/detro/ghostdriver/) complements Selenium tests with a PhantomJS WebDriver implementation.
- [PhantomRobot](https://github.com/datakurre/phantomrobot) runs Robot Framework acceptance tests in the background via PhantomJS.
- [Mocha-PhantomJS](https://github.com/metaskills/mocha-phantomjs) run Mocha tests using PhantomJS.
and many others [related projects](http://phantomjs.org/related-projects.html).
## Questions?
- Explore the complete [documentation](http://phantomjs.org/documentation/).
- Read tons of [user articles](http://phantomjs.org/buzz.html) on using PhantomJS.
- Join the [mailing-list](http://groups.google.com/group/phantomjs) and discuss with other PhantomJS fans.
PhantomJS is free software/open source, and is distributed under the [BSD license](http://opensource.org/licenses/BSD-3-Clause). It contains third-party code, see the included `third-party.txt` file for the license information on third-party code.
PhantomJS is created and maintained by [Ariya Hidayat](http://ariya.ofilabs.com/about) (Twitter: [@ariyahidayat](http://twitter.com/ariyahidayat)), with the help of [many contributors](https://github.com/ariya/phantomjs/contributors). Follow the official Twitter stream [@PhantomJS](http://twitter.com/PhantomJS) to get the frequent development updates.
The latest [stable release](http://code.google.com/p/phantomjs/wiki/ReleaseNotes) is version 1.3 ("Water Lily").
If you want to contribute, please read the [Contribution Guide](http://code.google.com/p/phantomjs/wiki/ContributionGuide).

128
build.cmd Normal file
View File

@ -0,0 +1,128 @@
@echo off
SETLOCAL EnableExtensions EnableDelayedExpansion
set BUILD_TYPE=release
if /i "%1" == "debug" (
SET BUILD_TYPE=debug
)
set ROOT_DIR=%CD%
set 3RD_PARTY_LIBRARIES_REPO_URL=https://github.com/Vitallium/phantomjs-3rdparty-win
set 3RD_PARTY_LIBRARIES_REPO_BRANCH=msvc2013
if /i BUILD_TYPE == "debug" (
set 3RD_PARTY_LIBRARIES_REPO_BRANCH=msvc2013_debug
)
set BUILD_DATESTAMP=%date:~-4,4%%date:~-7,2%%date:~-10,2%
set BUILD_TIMESTAMP=%time:~-11,2%%time:~-8,2%
:: replace leading space with 0
set BUILD_TIMESTAMP=%BUILD_TIMESTAMP: =0%
set QT_LOG_FILE=!ROOT_DIR!\build_qt_!BUILD_DATESTAMP!-!BUILD_TIMESTAMP!.log
set WEBKIT_LOG_FILE=!ROOT_DIR!\build_webkit_!BUILD_DATESTAMP!_!BUILD_TIMESTAMP!.log
set PHANTOMJS_LOG_FILE=!ROOT_DIR!\build_phantomjs_!BUILD_DATESTAMP!_!BUILD_TIMESTAMP!.log
set MAKE_TOOL=nmake
echo:
echo Build type: !BUILD_TYPE!
call :build
ENDLOCAL
@exit /B 0
rem ========================================================================================================
:build
SETLOCAL EnableExtensions EnableDelayedExpansion
set _3RDPARTY=!ROOT_DIR!\src\qt\3rdparty
for %%X in (git.exe) do (set GIT_FOUND=%%~$PATH:X)
if defined GIT_FOUND (
echo.
echo GIT found. Getting 3rd party libraries.
if not exist !_3RDPARTY! call git clone -b !3RD_PARTY_LIBRARIES_REPO_BRANCH! !3RD_PARTY_LIBRARIES_REPO_URL! !_3RDPARTY!
) else (
ECHO.
CALL :exitB "Git is missing! Can't proceed. Please install Git."
GOTO :eof
)
:: prepare 3rdparty libraries
:: setup INCLUDE and LIB environment variables
:: OpenSSL
set OPENSSL_DIR=!_3RDPARTY!\openssl
set OPENSSL_LIB=!OPENSSL_DIR!\lib
set OPENSSL_INCLUDE=!OPENSSL_DIR!\include
:: ICU
set ICU_DIR=!_3RDPARTY!\libicu
set ICU_LIB=!ICU_DIR!\lib
set ICU_INCLUDE=!ICU_DIR!\include
:: libxml
set LIBXML_DIR=!_3RDPARTY!\libxml
set LIBXML_LIB=!LIBXML_DIR!\lib
set LIBXML_INCLUDE=!LIBXML_DIR!\include\libxml2
:: sqlite
set SQLITE3SRCDIR=!ROOT_DIR!\src\qt\qtbase\src\3rdparty\sqlite
set LIB=!OPENSSL_LIB!;!ICU_LIB!;!LIBXML_LIB!;%LIB%
set INCLUDE=!OPENSSL_INCLUDE!;!ICU_INCLUDE!;!LIBXML_INCLUDE!;%INCLUDE%
set PATH=!_3RDPARTY!\gnuwin32\bin;%PATH%
echo LIB: %LIB%
echo INCLUDE: %INCLUDE%
for %%X in (jom.exe) do (set JOMFOUND=%%~$PATH:X)
if defined JOMFOUND (
set MAKE_TOOL=jom
) else (
set MAKE_TOOL=nmake
)
pushd !ROOT_DIR!\src\qt
call preconfig.cmd !BUILD_TYPE! 2>&1 >> !QT_LOG_FILE!
popd
set PATH=!ROOT_DIR!\src\qt\qtbase\bin;%PATH%
for %%X in (qmake.exe) do (set QMAKE_FOUND=%%~$PATH:X)
if defined QMAKE_FOUND (
echo.
echo qmake found. Building QtWebkit
) else (
ECHO.
CALL :exitB "qmake.exe is missing! Can't proceed."
GOTO :eof
)
pushd !ROOT_DIR!\src\qt\qtwebkit
call qmake.exe
%MAKE_TOOL% %BUILD_TYPE% 2>&1 >> !WEBKIT_LOG_FILE!
popd
pushd !ROOT_DIR!\src
call qmake.exe
%MAKE_TOOL% %BUILD_TYPE% 2>&1 >> !PHANTOMJS_LOG_FILE!
popd
if EXIST !ROOT_DIR!\bin\phantomjs.exe (
echo.
echo Build has finished
echo.
) else (
echo:
echo Unable to find phantomjs.exe. Please, check log files:
echo Qt: !QT_LOG_FILE!
echo Webkit: !WEBKIT_LOG_FILE!
echo PhantomJS: !PHANTOMJS_LOG_FILE!
echo:
)
EXIT /b
rem ========================================================================================================
:: %1 an error message
:exitB
echo:
echo Error: %1
echo:
echo Contact vitaliy.slobodin@gmail.com
@exit /B 0

82
build.sh Executable file
View File

@ -0,0 +1,82 @@
#!/usr/bin/env bash
set -e
COMPILE_JOBS=1
MAKEFLAGS_JOBS=''
if [[ "$MAKEFLAGS" != "" ]]; then
MAKEFLAGS_JOBS=$(echo $MAKEFLAGS | egrep -o '\-j[0-9]+' | egrep -o '[0-9]+')
fi
if [[ "$MAKEFLAGS_JOBS" != "" ]]; then
# user defined number of jobs in MAKEFLAGS, re-use that number
COMPILE_JOBS=$MAKEFLAGS_JOBS
elif [[ $OSTYPE = darwin* ]]; then
# We only support modern Mac machines, they are at least using
# hyperthreaded dual-core CPU.
COMPILE_JOBS=4
elif [[ $OSTYPE == freebsd* ]]; then
COMPILE_JOBS=`sysctl -n hw.ncpu`
else
CPU_CORES=`grep -c ^processor /proc/cpuinfo`
if [[ "$CPU_CORES" -gt 1 ]]; then
COMPILE_JOBS=$CPU_CORES
fi
fi
if [[ "$COMPILE_JOBS" -gt 8 ]]; then
# Safety net.
COMPILE_JOBS=8
fi
SILENT=
until [[ -z "$1" ]]; do
case $1 in
(--qmake-args)
shift
QMAKE_ARGS=$1
shift;;
(--jobs)
shift
COMPILE_JOBS=$1
shift;;
(--silent)
SILENT=silent
shift;;
"--help")
cat <<EOF
Usage: $0 [--jobs NUM]
--silent Produce less verbose output.
--jobs NUM How many parallel compile jobs to use.
Defaults to the number of CPU cores you have,
with a maximum of 8.
EOF
exit 0
;;
*)
echo "Unrecognised option: $1" >&2
exit 1;;
esac
done
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
echo "System architecture... ($UNAME_SYSTEM $UNAME_RELEASE $UNAME_MACHINE)"
export QMAKE=qmake
# some Linux distros (e.g. Debian) allow you to parallel-install
# Qt4 and Qt5, using this environment variable to declare which
# one you want
export QT_SELECT=qt5
echo
echo "Building main PhantomJS application..."
echo
$QMAKE $QMAKE_ARGS
make -j$COMPILE_JOBS

5
debian/changelog vendored
View File

@ -1,5 +0,0 @@
phantomjs (1.3-1~git20110703) unstable; urgency=low
* Initial release.
-- Dennis Kaarsemaker <dennis@kaarsemaker.net> Sun, 03 Jul 2011 20:45:52 +0200

1
debian/compat vendored
View File

@ -1 +0,0 @@
7

24
debian/control vendored
View File

@ -1,24 +0,0 @@
Source: phantomjs
Section: python
Priority: extra
Maintainer: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Build-Depends: debhelper (>= 7), libqt4-dev (>= 4.6), libqtwebkit-dev, qt4-qmake, python-support (>= 0.6.4), python-all-dev (>= 2.5), python-qt4-dev, python-qt4
Standards-Version: 3.8.4
XS-Python-Version: >= 2.6
Vcs-Git: http://github.com/ariya/phantomjs
Package: phantomjs
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: phantomjs - minimalistic headless WebKit-based JavaScript-driven tool
PhantomJS is a minimalistic, headless, WebKit-based, JavaScript-driven tool.
PhantomJs has native support for different web technologies: DOM handling,
CSS selector, JSON, Canvas, SVG, and of course JavaScript.
Package: python-pyphantomjs
Architecture: all
Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}, python-qt4, python-argparse
Description: phantomjs - minimalistic headless WebKit-based JavaScript-driven tool
PhantomJS is a minimalistic, headless, WebKit-based, JavaScript-driven tool.
PhantomJs has native support for different web technologies: DOM handling,
CSS selector, JSON, Canvas, SVG, and of course JavaScript.

35
debian/copyright vendored
View File

@ -1,35 +0,0 @@
Format-Specification: http://anonscm.debian.org/viewvc/dep/web/deps/dep5.mdwn?revision=174&view=co&pathrev=174
Name: phantomjs
Maintainer: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Source: http://github.com/ariya/phantomjs
Copyright: 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
License: BSD-3-clause
Files: debian/*
Copyright: 2011 Dennis Kaarsemaker <dennis@kaarsemaker.net>
License: BSD-3-clause
License: BSD-3-clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
.
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,2 +0,0 @@
README.md
examples

View File

@ -1 +0,0 @@
debian/tmp/usr/bin/phantomjs

View File

@ -1 +0,0 @@
python/README.md

View File

@ -1,2 +0,0 @@
debian/tmp/usr/bin/pyphantomjs
debian/tmp/usr/lib

19
debian/rules vendored
View File

@ -1,19 +0,0 @@
#!/usr/bin/make -f
%:
dh $@
override_dh_auto_build:
qmake-qt4
$(MAKE)
cd python && python setup.py build
override_dh_auto_install:
$(MAKE) install
mkdir -p debian/tmp/usr/bin
cp bin/* debian/tmp/usr/bin
cd python && python setup.py install --root=../debian/tmp --install-layout=deb
override_dh_auto_clean:
if [ -f Makefile ]; then $(MAKE) distclean; fi
cd python && python setup.py clean

View File

@ -1 +0,0 @@
1.0

2
deploy/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.vagrant
/brandelf

60
deploy/README.md Normal file
View File

@ -0,0 +1,60 @@
Packaging PhantomJS
===================
This directory contains various scripts to assist with making PhantomJS
packages.
Packaging for Linux
-------------------
Linux building/packaging is best done in a virtual machine to ensure
isolation and clean state. This is also necessary to build for different
architectures.
We use [Vagrant](http://vagrantup.com/) to help with this. Please see
the [Vagrant
documentation](http://vagrantup.com/v1/docs/getting-started/index.html)
for instructions on how to install VirtualBox and Vagrant.
Once you have Vagrant installed, building should be as simple as
running:
$ export PHANTOMJS_VERSION=1.6.0 # change as necessary
$ vagrant up $ARCH
Where $ARCH is either `i686` or `x86_64`.
This runs the `provision_vm.sh` script, which installs the necessary
dependencies, checks out a fresh copy of the PhantomJS repository,
switches to the relevant tag, builds and packages the software and the
associated debugging symbols tarball, and copies the tarballs out of the
VM onto your host machine.
If it runs successfully, you will see the tarballs in this directory,
ready for upload.
If there are any problems, you can re-run the script with:
$ vagrant provision $ARCH
Or SSH into the VM:
$ vagrant ssh $ARCH
Once you're done, you can destroy the VM with:
$ vagrant destroy $ARCH
If you need to build a new version, you should destroy the VM and start
again to ensure a clean state. (Or SSH in and do a git clean.)
Packaging for OS X
------------------
Run `deploy/build-and-package.sh`. That's it.
However, if you have previously built the sources in release mode, you
should clean your tree to make sure all the debugging symbols gets
compiled:
$ make clean && cd src/qt && make clean && cd ../..

42
deploy/Vagrantfile vendored Normal file
View File

@ -0,0 +1,42 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
unless ENV['PHANTOMJS_VERSION']
STDERR.puts 'Please specify PhantomJS version in the PHANTOMJS_VERSION environment variable.'
STDERR.puts '(This can be any git ref, e.g. "1.5.0", "master", "origin/1.5", etc.)'
exit 1
end
Vagrant::Config.run do |config|
config.vm.define :i686 do |c|
c.vm.box_url = "https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-centos-5.8-i386.box"
c.vm.box = "centos_58_32bit"
c.vm.customize ["modifyvm", :id, "--ostype", "RedHat"]
end
config.vm.define :x86_64 do |c|
c.vm.box_url = "https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-centos-5.8.box"
c.vm.box = "centos_58_64bit"
c.vm.customize ["modifyvm", :id, "--ostype", "RedHat_64"]
end
config.vm.define :lucid32 do |c|
c.vm.box_url = "http://files.vagrantup.com/lucid32.box"
c.vm.box = "lucid32"
end
config.vm.define :lucid64 do |c|
c.vm.box_url = "http://files.vagrantup.com/lucid64.box"
c.vm.box = "lucid64"
end
config.vm.provision :shell do |s|
s.path = "provision-vm.sh"
s.args = ENV['PHANTOMJS_VERSION']
end
# You may wish to tweak these, but be aware that you need quite a lot of
# memory for the linking stage.
config.vm.customize ["modifyvm", :id, "--memory", 3072]
config.vm.customize ["modifyvm", :id, "--cpus", 2]
end

View File

@ -1,16 +0,0 @@
--- configure 2011-03-29 22:16:21.000000000 -0700
+++ configure.new 2011-08-21 22:11:16.000000000 -0700
@@ -7160,13 +7160,6 @@ if [ "$CFG_GUI" = "no" ]; then
canBuildWebKit="no"
fi
-if [ "$CFG_SHARED" = "no" ]; then
- echo
- echo "WARNING: Using static linking will disable the WebKit module."
- echo
- canBuildWebKit="no"
-fi
-
CFG_CONCURRENT="yes"
if [ "$canBuildQtConcurrent" = "no" ]; then
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT"

213
deploy/brandelf.c Normal file
View File

@ -0,0 +1,213 @@
/*-
* Copyright (c) 2000, 2001 David O'Brien
* Copyright (c) 1996 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
//NOTE: commented out to make it compile on linux
// __FBSDID("$FreeBSD: src/usr.bin/brandelf/brandelf.c,v 1.25.22.2 2012/03/16 03:22:37 eadler Exp $");
#include <sys/types.h>
//NOTE: changed path to make it compile on linux
#include <elf.h>
#include <sys/errno.h>
#include <err.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static int elftype(const char *);
static const char *iselftype(int);
static void printelftypes(void);
static void usage(void);
struct ELFtypes {
const char *str;
int value;
};
/* XXX - any more types? */
static struct ELFtypes elftypes[] = {
{ "FreeBSD", ELFOSABI_FREEBSD },
{ "Linux", ELFOSABI_LINUX },
{ "Solaris", ELFOSABI_SOLARIS },
{ "SVR4", ELFOSABI_SYSV }
};
int
main(int argc, char **argv)
{
const char *strtype = "FreeBSD";
int type = ELFOSABI_FREEBSD;
int retval = 0;
int ch, change = 0, force = 0, listed = 0;
while ((ch = getopt(argc, argv, "f:lt:v")) != -1)
switch (ch) {
case 'f':
if (change)
errx(1, "f option incompatible with t option");
force = 1;
type = atoi(optarg);
if (errno == ERANGE || type < 0 || type > 255) {
warnx("invalid argument to option f: %s",
optarg);
usage();
}
break;
case 'l':
printelftypes();
listed = 1;
break;
case 'v':
/* does nothing */
break;
case 't':
if (force)
errx(1, "t option incompatible with f option");
change = 1;
strtype = optarg;
break;
default:
usage();
}
argc -= optind;
argv += optind;
if (!argc) {
if (listed)
exit(0);
else {
warnx("no file(s) specified");
usage();
}
}
if (!force && (type = elftype(strtype)) == -1) {
warnx("invalid ELF type '%s'", strtype);
printelftypes();
usage();
}
while (argc) {
int fd;
char buffer[EI_NIDENT];
if ((fd = open(argv[0], change || force ? O_RDWR : O_RDONLY, 0)) < 0) {
warn("error opening file %s", argv[0]);
retval = 1;
goto fail;
}
if (read(fd, buffer, EI_NIDENT) < EI_NIDENT) {
warnx("file '%s' too short", argv[0]);
retval = 1;
goto fail;
}
if (buffer[0] != ELFMAG0 || buffer[1] != ELFMAG1 ||
buffer[2] != ELFMAG2 || buffer[3] != ELFMAG3) {
warnx("file '%s' is not ELF format", argv[0]);
retval = 1;
goto fail;
}
if (!change && !force) {
fprintf(stdout,
"File '%s' is of brand '%s' (%u).\n",
argv[0], iselftype(buffer[EI_OSABI]),
buffer[EI_OSABI]);
if (!iselftype(type)) {
warnx("ELF ABI Brand '%u' is unknown",
type);
printelftypes();
}
}
else {
buffer[EI_OSABI] = type;
lseek(fd, 0, SEEK_SET);
if (write(fd, buffer, EI_NIDENT) != EI_NIDENT) {
warn("error writing %s %d", argv[0], fd);
retval = 1;
goto fail;
}
}
fail:
close(fd);
argc--;
argv++;
}
return retval;
}
static void
usage(void)
{
(void)fprintf(stderr,
"usage: brandelf [-lv] [-f ELF_ABI_number] [-t string] file ...\n");
exit(1);
}
static const char *
iselftype(int etype)
{
size_t elfwalk;
for (elfwalk = 0;
elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
elfwalk++)
if (etype == elftypes[elfwalk].value)
return elftypes[elfwalk].str;
return 0;
}
static int
elftype(const char *elfstrtype)
{
size_t elfwalk;
for (elfwalk = 0;
elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
elfwalk++)
if (strcasecmp(elfstrtype, elftypes[elfwalk].str) == 0)
return elftypes[elfwalk].value;
return -1;
}
static void
printelftypes(void)
{
size_t elfwalk;
fprintf(stderr, "known ELF types are: ");
for (elfwalk = 0;
elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
elfwalk++)
fprintf(stderr, "%s(%u) ", elftypes[elfwalk].str,
elftypes[elfwalk].value);
fprintf(stderr, "\n");
}

69
deploy/build-and-package.sh Executable file
View File

@ -0,0 +1,69 @@
#!/usr/bin/env bash
cd `dirname $0`/..
echo "Building Qt and PhantomJS with debugging symbols. If you have previously" \
"built without debugging symbols, you should run:"
echo
echo " $ git clean -xdff"
echo
# This incantation will cause Qt and WebKit and PhantomJS to all build in "release"
# mode, with compiler optimisations, but also with debug symbols. (We will strip the
# symbols in package.sh.)
CFLAGS=-g CXXFLAGS=-g ./build.sh --confirm --qt-config '-webkit-debug' --qmake-args "QMAKE_CFLAGS=-g QMAKE_CXXFLAGS=-g" || exit 1
# Package the release tarball
rm deploy/*.tar.bz2 2>/dev/null
./deploy/package.sh || exit 1
# Build the dump_syms program for dumping breakpad debugging symbols
if [[ $OSTYPE = darwin* ]]; then
pushd tools
../src/qt/bin/qmake dump-syms-mac.pro && make
popd
else
pushd src/breakpad
./configure && make || exit 1
popd
fi
# Dump and package the breakpad debugging symbols...
./tools/dump-symbols.sh
version=$(bin/phantomjs --version | sed 's/ /-/' | sed 's/[()]//g')
if [[ $OSTYPE = darwin* ]]; then
symbols="phantomjs-$version-macosx-symbols"
else
symbols="phantomjs-$version-linux-$(uname -m)-symbols"
fi
cp -r symbols/ $symbols
# The minidump_stackwalk program is architecture-specific, so copy the
# binary for later use. This means that e.g. a developer on x86_64 can
# analyse a crash dump produced by a i686 user.
#
# We don't yet have a process for building minidump_stackwalk on OS X
if [[ $OSTYPE != darwin* ]]; then
cp src/breakpad/src/processor/minidump_stackwalk $symbols
read -r -d '' README <<EOT
These are symbols files that can be used to analyse a crash dump
produced by the corresponding binary. To generate a crash report,
run:
./minidump_stackwalk /path/to/crash.dmp .
EOT
echo "$README" > $symbols/README
fi
tar -cjf deploy/$symbols.tar.bz2 $symbols
rm -r $symbols
echo "PhantomJS built and packaged:"
echo
cd deploy
ls -1 *.tar.bz2

View File

@ -1,118 +0,0 @@
#!/bin/bash
QT_VERSION=0
QT_FOLDER=""
COMPILE_JOBS=10
if [ "$1" = "--qt-4.8" ]
then
echo "Building Qt 4.8"
QT_VERSION=4.8
QT_FOLDER=Qt-$QT_VERSION
QT_URL=git://gitorious.org/qt/qt.git
echo "Cloning Qt from gitorious into $QT_FOLDER..."
if [ ! -d $QT_FOLDER ]
then
git clone $QT_URL $QT_FOLDER
pushd $QT_FOLDER
git checkout -b 4.8 origin/4.8
else
pushd $QT_FOLDER
git checkout -f
git clean -xdf
git checkout 4.8
fi
popd
else
echo "Building Qt 4.7"
QT_VERSION=4.7.4
QT_FOLDER=Qt-$QT_VERSION
QT_TARBALL=qt-everywhere-opensource-src-$QT_VERSION.tar.gz
# Tip: change this to local/shared mirror
QT_URL=http://get.qt.nokia.com/qt/source/$QT_TARBALL
# Step 1: Download Qt source tarball
# Note: only if it does not exist yet in the current directory
if [ ! -f $QT_TARBALL ]
then
echo "Downloading Qt $QT_VERSION from Nokia. Please wait..."
if ! curl -C - -O -S $QT_URL
then
echo
echo "Fatal error: fail to download from $QT_URL !"
exit 1
fi
fi
# Step 2: Extract Qt source
[ -d $QT_FOLDER ] && rm -rf $QT_FOLDER
echo "Extracting Qt $QT_VERSION source tarball..."
echo
tar xzf $QT_TARBALL
mv qt-everywhere-opensource-src-$QT_VERSION Qt-$QT_VERSION
fi
# Step 3: Build Qt
pushd $QT_FOLDER
EXTRA_FLAGS=""
if [ $QT_VERSION = 4.8 ] ; then
echo "Patching Qt 4.8"
patch -p1 < ../qt48_enable_debugger.patch
patch -p1 < ../qt48_fix_inspector.patch
patch -p1 < ../qt48_headless_and_pdf_fixes.patch
# Build in lighthose mode for an x-less build
if [ "$2" = "--headless" ] ; then
echo "Building 4.8 in qpa headless mode"
EXTRA_FLAGS="-qpa"
fi
else
echo "Patching Qt 4.7"
patch configure ../allow-static-qtwebkit.patch
# Qt 4.8 doesn't allow static builds of QtWebkit-2.2
EXTRA_FLAGS="-static"
fi
patch -p1 < ../qapplication_skip_qtmenu.patch
echo "Building Qt $QT_VERSION. Please wait..."
echo
./configure -opensource -confirm-license -release -webkit -graphicssystem raster -no-exceptions -no-dbus -no-glib -no-gstreamer -no-stl -no-xmlpatterns -no-phonon -no-multimedia -no-qt3support -no-opengl -no-openvg -no-svg -no-declarative -no-gtkstyle -no-xkb -no-xinput -no-xinerama -no-sm -no-cups -qt-libpng -qt-libjpeg -no-libmng -no-libtiff -D QT_NO_STYLE_CDE -D QT_NO_STYLE_CLEANLOOKS -D QT_NO_STYLE_MOTIF -D QT_NO_STYLE_PLASTIQUE -prefix $PWD -nomake demos -nomake examples -nomake tools -nomake docs -nomake translations $EXTRA_FLAGS
make -j$COMPILE_JOBS
popd
if [ $QT_VERSION != 4.8 ] ; then
# Extra step: copy JavaScriptCore/release, needed for jscore static lib
mkdir ../JavaScriptCore
cp -rp $QT_FOLDER/src/3rdparty/webkit/JavaScriptCore/release ../JavaScriptCore/
fi
# Step 4: Build PhantomJS
echo "Building PhantomJS. Please wait..."
echo
cd ..
[ -f Makefile ] && make distclean
deploy/$QT_FOLDER/bin/qmake
make -j$COMPILE_JOBS
# Step 5: Prepare for deployment
echo "Compressing PhantomJS executable..."
echo
strip bin/phantomjs
if [ `command -v upx` ]; then
upx -9 bin/phantomjs
else
echo "You don't have UPX. Consider installing it to reduce the executable size."
fi

View File

@ -1,72 +0,0 @@
#!/bin/bash
QT_VERSION=4.8.0
QT_FOLDER=Qt-$QT_VERSION
QT_TARBALL=qt-everywhere-opensource-src-$QT_VERSION.tar.gz
# Tip: change this to local/shared mirror
QT_URL=http://get.qt.nokia.com/qt/source/$QT_TARBALL
COMPILE_JOBS=4
# Step 1: Download Qt source tarball
# Note: only if it does not exist yet in the current directory
if [ ! -f $QT_TARBALL ]
then
echo "Downloading Qt $QT_VERSION from Nokia. Please wait..."
if ! curl -C - -O -S $QT_URL
then
echo
echo "Fatal error: fail to download from $QT_URL !"
exit 1
fi
fi
# Step 2: Extract Qt source
[ -d $QT_FOLDER ] && rm -rf $QT_FOLDER
echo "Extracting Qt $QT_VERSION source tarball..."
echo
tar xzf $QT_TARBALL
mv qt-everywhere-opensource-src-$QT_VERSION Qt-$QT_VERSION
# Step 3: Apply some patches
cd $QT_FOLDER
patch configure ../allow-static-qtwebkit.patch
patch -p1 < ../qapplication_skip_qtmenu.patch
rm -rf src/3rdparty/WebKit/qt/tests
# Step 4: Build Qt
echo "Building Qt $QT_VERSION. Please wait..."
echo
./configure -opensource -confirm-license -release -static -no-exceptions -no-stl -no-xmlpatterns -no-phonon -no-qt3support -no-opengl -no-declarative -qt-libpng -qt-libjpeg -no-libmng -no-libtiff -D QT_NO_STYLE_CDE -D QT_NO_STYLE_CLEANLOOKS -D QT_NO_STYLE_MOTIF -D QT_NO_STYLE_PLASTIQUE -cocoa -prefix $PWD -arch x86 -nomake demos -nomake examples -nomake tools
make -j$COMPILE_JOBS
cd ..
# Extra step to ensure the static libraries are found
cp -rp $QT_FOLDER/src/3rdparty/webkit/Source/JavaScriptCore/release/* $QT_FOLDER/lib
cp -rp $QT_FOLDER/src/3rdparty/webkit/Source/WebCore/release/* $QT_FOLDER/lib
# Step 5: Build PhantomJS
echo "Building PhantomJS. Please wait..."
echo
cd ..
[ -f Makefile ] && make distclean
deploy/$QT_FOLDER/bin/qmake
make -j$COMPILE_JOBS
# Step 6: Prepare for deployment
echo "Compressing PhantomJS executable..."
echo
strip bin/phantomjs
if [ `command -v upx` ]; then
upx -9 bin/phantomjs
else
echo "You don't have UPX. Consider installing it to reduce the executable size."
fi

120
deploy/package.sh Executable file
View File

@ -0,0 +1,120 @@
#!/usr/bin/env bash
#
# usage: just run this script (after having run build.sh)
# and deploy the created tarball to your target machine.
#
# It creates a phantomjs-$version folder and copies the binary,
# example, license etc. together with all shared library dependencies
# to that folder. Furthermore brandelf is used to make the lib
# and binary compatible with older unix/linux machines that don't
# know the new Linux ELF ABI.
#
cd $(dirname $0)
if [[ ! -f ../bin/phantomjs ]]; then
echo "phantomjs was not built yet, please run build.sh first"
exit 1
fi
if [[ "$1" = "--bundle-libs" ]]; then
bundle_libs=1
else
bundle_libs=0
fi
version=$(../bin/phantomjs --version | sed 's/ /-/' | sed 's/[()]//g')
src=..
echo "packaging phantomjs $version"
if [[ $OSTYPE = darwin* ]]; then
dest="phantomjs-$version-macosx"
else
dest="phantomjs-$version-linux-$(uname -m)"
fi
rm -Rf $dest{.tar.bz2,} &> /dev/null
mkdir -p $dest/bin
echo
echo -n "copying files..."
cp $src/bin/phantomjs $dest/bin
cp -r $src/{ChangeLog,examples,LICENSE.BSD,third-party.txt,README.md} $dest/
echo "done"
echo
phantomjs=$dest/bin/phantomjs
if [[ "$bundle_libs" = "1" ]]; then
mkdir -p $dest/lib
if [[ ! -f brandelf ]]; then
echo
echo "brandelf executable not found in current dir"
echo -n "compiling it now..."
g++ brandelf.c -o brandelf || exit 1
echo "done"
fi
libs=$(ldd $phantomjs | egrep -o "/[^ ]+ ")
echo -n "copying shared libs..."
libld=
for l in $libs; do
ll=$(basename $l)
cp $l $dest/lib/$ll
if [[ "$bundle_libs" = "1" ]]; then
# ensure OS ABI compatibility
./brandelf -t SVR4 $dest/lib/$ll
if [[ "$l" == *"ld-linux"* ]]; then
libld=$ll
fi
fi
done
echo "done"
echo
echo -n "writing run script..."
mv $phantomjs $phantomjs.bin
phantomjs=$phantomjs.bin
run=$dest/bin/phantomjs
echo '#!/bin/sh' >> $run
echo 'path=$(dirname $(dirname $(readlink -f $0)))' >> $run
echo 'export LD_LIBRARY_PATH=$path/lib' >> $run
echo 'exec $path/lib/'$libld' $phantomjs $@' >> $run
chmod +x $run
echo "done"
echo
fi
echo -n "stripping binary and libs..."
if [[ $OSTYPE = darwin* ]]; then
strip -x $phantomjs
else
strip -s $phantomjs
[[ -d $dest/lib ]] && strip -s $dest/lib/*
fi
echo "done"
echo
echo -n "compressing binary..."
if type upx >/dev/null 2>&1; then
upx -qqq -9 $phantomjs
echo "done"
else
echo "upx not found"
fi
echo
echo -n "creating archive..."
if [[ $OSTYPE = darwin* ]]; then
zip -r $dest.zip $dest
else
tar -cjf $dest{.tar.bz2,}
fi
echo "done"
echo

42
deploy/provision-vm.sh Executable file
View File

@ -0,0 +1,42 @@
#!/usr/bin/env bash
export PATH=$HOME/git/bin:$PATH
if type apt-get >/dev/null 2>&1; then
apt-get update
apt-get install -y build-essential git-core libssl-dev libfontconfig1-dev gdb binutils-gold
fi
if type yum >/dev/null 2>&1; then
yum -y update
yum -y install gcc gcc-c++ make openssl-devel freetype-devel fontconfig-devel
if type git >/dev/null 2>&1; then
echo "Git is already available."
else
yum -y install cpio expat-devel gettext-devel zlib-devel
echo "Downloading and building git..."
rm -rf git-*
wget -nv https://git-core.googlecode.com/files/git-1.8.0.3.tar.gz
tar -xzvf git-1.8.0.3.tar.gz
cd git-1.8.0.3
./configure --prefix=$HOME/git && make -j2 && make install
cd ..
sleep 3
fi
fi
if [[ ! -d phantomjs ]]; then
git clone git://github.com/ariya/phantomjs.git
fi
cd phantomjs
git fetch origin
git reset --hard
git checkout $1
cp /vagrant/build-and-package.sh deploy/
cp /vagrant/package.sh deploy/
deploy/build-and-package.sh
cp deploy/*.tar.bz2 /vagrant

View File

@ -1,19 +0,0 @@
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index ed9e9ce..ca35249 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -1253,11 +1253,14 @@ void qt_init(QApplicationPrivate *priv, int)
[newDelegate setReflectionDelegate:oldDelegate];
[cocoaApp setDelegate:newDelegate];
+// https://bugreports.qt.nokia.com/browse/QTBUG-5952
QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader = [[QT_MANGLE_NAMESPACE(QCocoaMenuLoader) alloc] init];
if ([NSBundle loadNibNamed:@"qt_menu" owner:qtMenuLoader] == false) {
+#if 0
qFatal("Qt internal error: qt_menu.nib could not be loaded. The .nib file"
" should be placed in QtGui.framework/Versions/Current/Resources/ "
" or in the resources directory of your application bundle.");
+#endif
}
[cocoaApp setMenu:[qtMenuLoader menu]];

View File

@ -1,35 +0,0 @@
diff --git a/src/3rdparty/webkit/Source/WebCore/inspector/front-end/Settings.js b/src/3rdparty/webkit/Source/WebCore/inspector/front-end/Settings.js
index 62bf84a..e830f85 100644
--- a/src/3rdparty/webkit/Source/WebCore/inspector/front-end/Settings.js
+++ b/src/3rdparty/webkit/Source/WebCore/inspector/front-end/Settings.js
@@ -40,7 +40,7 @@ var Preferences = {
showMissingLocalizedStrings: false,
samplingCPUProfiler: false,
showColorNicknames: true,
- debuggerAlwaysEnabled: false,
+ debuggerAlwaysEnabled: true,
profilerAlwaysEnabled: false,
onlineDetectionEnabled: true,
nativeInstrumentationEnabled: false,
@@ -58,7 +58,7 @@ WebInspector.Settings = function()
{
this.installApplicationSetting("colorFormat", "hex");
this.installApplicationSetting("consoleHistory", []);
- this.installApplicationSetting("debuggerEnabled", false);
+ this.installApplicationSetting("debuggerEnabled", true);
this.installApplicationSetting("domWordWrap", true);
this.installApplicationSetting("profilerEnabled", false);
this.installApplicationSetting("eventListenersFilter", "all");
diff --git a/src/3rdparty/webkit/Source/WebKit/qt/Api/qwebinspector.cpp b/src/3rdparty/webkit/Source/WebKit/qt/Api/qwebinspector.cpp
index 6706f2a..bec3d1c 100644
--- a/src/3rdparty/webkit/Source/WebKit/qt/Api/qwebinspector.cpp
+++ b/src/3rdparty/webkit/Source/WebKit/qt/Api/qwebinspector.cpp
@@ -161,7 +161,7 @@ void QWebInspector::showEvent(QShowEvent* event)
#if ENABLE(INSPECTOR)
// Allows QWebInspector::show() to init the inspector.
if (d->page)
- d->page->d->inspectorController()->show();
+ d->page->d->inspectorController()->showAndEnableDebugger();
#endif
}

View File

@ -1,268 +0,0 @@
diff --git a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
index 92b7d5c..c5e5bd5 100644
--- a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
+++ b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
@@ -22,7 +22,8 @@
#include "InspectorClientQt.h"
#include "InspectorController.h"
-#include "MD5.h"
+#include "Base64.h"
+#include "SHA1.h"
#include "Page.h"
#include "qwebpage.h"
#include "qwebpage_p.h"
@@ -44,43 +45,17 @@ namespace WebCore {
/*!
Computes the WebSocket handshake response given the two challenge numbers and key3.
*/
-static void generateWebSocketChallengeResponse(uint32_t number1, uint32_t number2, const unsigned char key3[8], unsigned char response[16])
+static QByteArray generateWebSocketChallengeResponse(const QByteArray& key)
{
- uint8_t challenge[16];
- qToBigEndian<qint32>(number1, &challenge[0]);
- qToBigEndian<qint32>(number2, &challenge[4]);
- memcpy(&challenge[8], key3, 8);
- MD5 md5;
- md5.addBytes(challenge, sizeof(challenge));
- Vector<uint8_t, 16> digest;
- md5.checksum(digest);
- memcpy(response, digest.data(), 16);
-}
-
-/*!
- Parses and returns a WebSocket challenge number according to the
- method specified in the WebSocket protocol.
-
- The field contains numeric digits interspersed with spaces and
- non-numeric digits. The protocol ignores the characters that are
- neither digits nor spaces. The digits are concatenated and
- interpreted as a long int. The result is this number divided by
- the number of spaces.
- */
-static quint32 parseWebSocketChallengeNumber(QString field)
-{
- QString nString;
- int numSpaces = 0;
- for (int i = 0; i < field.size(); i++) {
- QChar c = field[i];
- if (c == QLatin1Char(' '))
- numSpaces++;
- else if ((c >= QLatin1Char('0')) && (c <= QLatin1Char('9')))
- nString.append(c);
- }
- quint32 num = nString.toLong();
- quint32 result = (numSpaces ? (num / numSpaces) : num);
- return result;
+ SHA1 sha1;
+ Vector<uint8_t, 20> digest;
+ Vector<char> encoded;
+ QByteArray toHash("258EAFA5-E914-47DA-95CA-C5AB0DC85B11");
+ toHash.prepend(key);
+ sha1.addBytes((uint8_t*)toHash.data(), toHash.size());
+ sha1.computeHash(digest);
+ base64Encode((char*)digest.data(), digest.size(), encoded);
+ return QByteArray(encoded.data(), encoded.size());
}
static InspectorServerQt* s_inspectorServer;
@@ -194,7 +169,7 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
m_path = header.path();
m_contentType = header.contentType().toLatin1();
m_contentLength = header.contentLength();
- if (header.hasKey(QLatin1String("Upgrade")) && (header.value(QLatin1String("Upgrade")) == QLatin1String("WebSocket")))
+ if (header.hasKey(QLatin1String("Upgrade")) && (header.value(QLatin1String("Upgrade")) == QLatin1String("websocket")))
isWebSocket = true;
m_data.clear();
@@ -211,25 +186,19 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
// switch to websocket-style WebSocketService messaging
if (m_tcpConnection) {
m_tcpConnection->disconnect(SIGNAL(readyRead()));
- connect(m_tcpConnection, SIGNAL(readyRead()), SLOT(webSocketReadyRead()));
-
- QByteArray key3 = m_tcpConnection->read(8);
-
- quint32 number1 = parseWebSocketChallengeNumber(header.value(QLatin1String("Sec-WebSocket-Key1")));
- quint32 number2 = parseWebSocketChallengeNumber(header.value(QLatin1String("Sec-WebSocket-Key2")));
-
- char responseData[16];
- generateWebSocketChallengeResponse(number1, number2, (unsigned char*)key3.data(), (unsigned char*)responseData);
- QByteArray response(responseData, sizeof(responseData));
+ connect(m_tcpConnection, SIGNAL(readyRead()), SLOT(webSocketReadyRead()), Qt::QueuedConnection);
+
+ QByteArray key = header.value(QLatin1String("Sec-WebSocket-Key")).toLatin1();
+ QString accept = QString::fromLatin1(generateWebSocketChallengeResponse(key));
QHttpResponseHeader responseHeader(101, QLatin1String("WebSocket Protocol Handshake"), 1, 1);
responseHeader.setValue(QLatin1String("Upgrade"), header.value(QLatin1String("Upgrade")));
responseHeader.setValue(QLatin1String("Connection"), header.value(QLatin1String("Connection")));
- responseHeader.setValue(QLatin1String("Sec-WebSocket-Origin"), header.value(QLatin1String("Origin")));
- responseHeader.setValue(QLatin1String("Sec-WebSocket-Location"), (QLatin1String("ws://") + header.value(QLatin1String("Host")) + m_path));
- responseHeader.setContentLength(response.size());
+ responseHeader.setValue(QLatin1String("Sec-WebSocket-Accept"), accept);
+ // responseHeader.setValue(QLatin1String("Sec-WebSocket-Origin"), header.value(QLatin1String("Sec-WebSocket-Origin")));
+ // responseHeader.setValue(QLatin1String("Sec-WebSocket-Location"), (QLatin1String("ws://") + header.value(QLatin1String("Host")) + m_path));
m_tcpConnection->write(responseHeader.toString().toLatin1());
- m_tcpConnection->write(response);
+ //m_tcpConnection->write(response);
m_tcpConnection->flush();
if ((words.size() == 4)
@@ -308,26 +277,54 @@ void InspectorServerRequestHandlerQt::tcpConnectionDisconnected()
m_tcpConnection = 0;
}
-int InspectorServerRequestHandlerQt::webSocketSend(QByteArray payload)
+int InspectorServerRequestHandlerQt::webSocketSend(const QString& message)
{
- Q_ASSERT(m_tcpConnection);
- m_tcpConnection->putChar(0x00);
- int nBytes = m_tcpConnection->write(payload);
- m_tcpConnection->putChar(0xFF);
- m_tcpConnection->flush();
- return nBytes;
+ QByteArray payload = message.toUtf8();
+ return webSocketSend(payload.data(), payload.size());
}
int InspectorServerRequestHandlerQt::webSocketSend(const char* data, size_t length)
{
Q_ASSERT(m_tcpConnection);
- m_tcpConnection->putChar(0x00);
+ m_tcpConnection->putChar(0x81);
+ if (length <= 125)
+ m_tcpConnection->putChar(static_cast<uint8_t>(length));
+ else if (length <= pow(2,16)) {
+ m_tcpConnection->putChar(126);
+ quint16 length16 = qToBigEndian<quint16>(static_cast<quint16>(length));
+ m_tcpConnection->write(reinterpret_cast<char*>(&length16), 2);
+ } else {
+ m_tcpConnection->putChar(127);
+ quint64 length64 = qToBigEndian<quint64>(static_cast<quint64>(length));
+ m_tcpConnection->write(reinterpret_cast<char*>(&length64), 8);
+ }
int nBytes = m_tcpConnection->write(data, length);
- m_tcpConnection->putChar(0xFF);
m_tcpConnection->flush();
return nBytes;
}
+static QByteArray applyMask(const QByteArray& payload, const QByteArray& maskingKey)
+{
+ Q_ASSERT(maskingKey.size() == 4);
+ QByteArray unmaskedPayload;
+ for (int i = 0; i < payload.size(); ++i) {
+ char unmaskedByte = payload[i] ^ maskingKey[i % 4];
+ unmaskedPayload.append(unmaskedByte);
+ }
+ return unmaskedPayload;
+}
+
+#define BYTETOBINARYPATTERN "%d%d%d%d%d%d%d%d"
+#define BYTETOBINARY(byte) \
+ (byte & 0x80 ? 1 : 0), \
+ (byte & 0x40 ? 1 : 0), \
+ (byte & 0x20 ? 1 : 0), \
+ (byte & 0x10 ? 1 : 0), \
+ (byte & 0x08 ? 1 : 0), \
+ (byte & 0x04 ? 1 : 0), \
+ (byte & 0x02 ? 1 : 0), \
+ (byte & 0x01 ? 1 : 0)
+
void InspectorServerRequestHandlerQt::webSocketReadyRead()
{
Q_ASSERT(m_tcpConnection);
@@ -336,38 +333,49 @@ void InspectorServerRequestHandlerQt::webSocketReadyRead()
QByteArray content = m_tcpConnection->read(m_tcpConnection->bytesAvailable());
m_data.append(content);
while (m_data.size() > 0) {
- // first byte in websocket frame should be 0
- Q_ASSERT(!m_data[0]);
+ bool isMasked = m_data[1] & 0x80;
+ quint64 payloadLen = m_data[1] & 0x7F;
+ int pos = 2;
- // Start of WebSocket frame is indicated by 0
- if (m_data[0]) {
- qCritical() << "webSocketReadyRead: unknown frame type" << m_data[0];
- m_data.clear();
- m_tcpConnection->close();
- return;
+ if (payloadLen == 126) {
+ payloadLen = qFromBigEndian<quint16>(*reinterpret_cast<quint16*>(m_data.mid(pos, 2).data()));
+ pos = 4;
+ } else if (payloadLen == 127) {
+ payloadLen = qFromBigEndian<quint64>(*reinterpret_cast<quint64*>(m_data.mid(pos, 8).data()));
+ pos = 8;
}
- // End of WebSocket frame indicated by 0xff.
- int pos = m_data.indexOf(0xff, 1);
- if (pos < 1)
- return;
-
- // After above checks, length will be >= 0.
- size_t length = pos - 1;
- if (length <= 0)
- return;
-
- QByteArray payload = m_data.mid(1, length);
+ QByteArray payload;
+ if (isMasked) {
+ QByteArray maskingKey = m_data.mid(pos, 4);
+ pos += 4;
+ payload = applyMask(m_data.mid(pos, payloadLen), maskingKey);
+ } else {
+ payload = m_data.mid(pos, payloadLen);
+ }
+ // Handle fragmentation
+ if ((m_data[0] & 0x80) == 0) { // Non-last fragmented payload
+ m_fragmentedPayload.append(payload);
+
+ m_data = m_data.mid(pos + payloadLen);
+ continue;
+ } else {
+ if ((m_data[0] & 0x0F) == 0) { // Last fragment
+ m_fragmentedPayload.append(payload);
+ payload = m_fragmentedPayload;
+ m_fragmentedPayload.clear();
+ }
+ }
+
+ // Remove this WebSocket message from m_data (payload, start-of-frame byte, end-of-frame byte).
+ m_data = m_data.mid(pos + payloadLen);
#if ENABLE(INSPECTOR)
if (m_inspectorClient) {
InspectorController* inspectorController = m_inspectorClient->m_inspectedWebPage->d->page->inspectorController();
inspectorController->dispatchMessageFromFrontend(QString::fromUtf8(payload));
}
#endif
-
- // Remove this WebSocket message from m_data (payload, start-of-frame byte, end-of-frame byte).
- m_data = m_data.mid(length + 2);
}
}
diff --git a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h
index 922b63e..e1265b9 100644
--- a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h
+++ b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h
@@ -83,7 +83,7 @@ public:
InspectorServerRequestHandlerQt(QTcpSocket *tcpConnection, InspectorServerQt *server);
virtual ~InspectorServerRequestHandlerQt();
- virtual int webSocketSend(QByteArray payload);
+ virtual int webSocketSend(const QString& message);
virtual int webSocketSend(const char *payload, size_t length);
private slots:
@@ -100,6 +100,7 @@ private:
int m_contentLength;
bool m_endOfHeaders;
QByteArray m_data;
+ QByteArray m_fragmentedPayload;
InspectorClientQt* m_inspectorClient;
void handleInspectorRequest(QStringList words);

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
if phantom.args.length is 0
console.log 'Try to pass some args when invoking this script!'
else
for arg, i in phantom.args
console.log i + ': ' + arg
phantom.exit()

View File

@ -1,7 +1,8 @@
if (phantom.args.length === 0) {
var system = require('system');
if (system.args.length === 1) {
console.log('Try to pass some args when invoking this script!');
} else {
phantom.args.forEach(function (arg, i) {
system.args.forEach(function (arg, i) {
console.log(i + ': ' + arg);
});
}

View File

@ -0,0 +1,27 @@
var spawn = require("child_process").spawn
var execFile = require("child_process").execFile
var child = spawn("ls", ["-lF", "/rooot"])
child.stdout.on("data", function (data) {
console.log("spawnSTDOUT:", JSON.stringify(data))
})
child.stderr.on("data", function (data) {
console.log("spawnSTDERR:", JSON.stringify(data))
})
child.on("exit", function (code) {
console.log("spawnEXIT:", code)
})
//child.kill("SIGKILL")
execFile("ls", ["-lF", "/usr"], null, function (err, stdout, stderr) {
console.log("execFileSTDOUT:", JSON.stringify(stdout))
console.log("execFileSTDERR:", JSON.stringify(stderr))
})
setTimeout(function () {
phantom.exit(0)
}, 2000)

View File

@ -1,46 +0,0 @@
page = require('webpage').create()
page.viewportSize = { width: 400, height : 400 }
page.content = '<html><body><canvas id="surface"></canvas></body></html>'
page.evaluate ->
el = document.getElementById 'surface'
context = el.getContext '2d'
width = window.innerWidth
height = window.innerHeight
cx = width / 2
cy = height / 2
radius = width / 2.3
i = 0
el.width = width
el.height = height
imageData = context.createImageData(width, height)
pixels = imageData.data
for y in [0...height]
for x in [0...width]
i = i + 4
rx = x - cx
ry = y - cy
d = rx * rx + ry * ry
if d < radius * radius
hue = 6 * (Math.atan2(ry, rx) + Math.PI) / (2 * Math.PI)
sat = Math.sqrt(d) / radius
g = Math.floor(hue)
f = hue - g
u = 255 * (1 - sat)
v = 255 * (1 - sat * f)
w = 255 * (1 - sat * (1 - f))
pixels[i] = [255, v, u, u, w, 255, 255][g]
pixels[i + 1] = [w, 255, 255, v, u, u, w][g]
pixels[i + 2] = [u, u, w, 255, 255, v, u][g]
pixels[i + 3] = 255
context.putImageData imageData, 0, 0
document.body.style.backgroundColor = 'white'
document.body.style.margin = '0px'
page.render('colorwheel.png')
phantom.exit()

View File

@ -1,8 +0,0 @@
t = 10
interval = setInterval ->
if t > 0
console.log t--
else
console.log 'BLAST OFF!'
phantom.exit()
, 1000

View File

@ -1,40 +0,0 @@
page = require('webpage').create()
page.onInitialized = ->
page.evaluate ->
userAgent = window.navigator.userAgent
platform = window.navigator.platform
window.navigator =
appCodeName: 'Mozilla'
appName: 'Netscape'
cookieEnabled: false
sniffed: false
window.navigator.__defineGetter__ 'userAgent', ->
window.navigator.sniffed = true
userAgent
window.navigator.__defineGetter__ 'platform', ->
window.navigator.sniffed = true
platform
if phantom.args.length is 0
console.log 'Usage: unsniff.js <some URL>'
phantom.exit()
else
address = phantom.args[0]
console.log 'Checking ' + address + '...'
page.open address, (status) ->
if status isnt 'success'
console.log 'FAIL to load the address'
else
window.setTimeout ->
sniffed = page.evaluate(->
navigator.sniffed
)
if sniffed
console.log 'The page tried to sniff the user agent.'
else
console.log 'The page did not try to sniff the user agent.'
phantom.exit()
, 1500

View File

@ -1,6 +1,7 @@
// Detect if a web page sniffs the user agent or not.
var page = require('webpage').create(),
system = require('system'),
sniffed,
address;
@ -31,15 +32,16 @@ page.onInitialized = function () {
});
};
if (phantom.args.length === 0) {
console.log('Usage: unsniff.js <some URL>');
phantom.exit();
if (system.args.length === 1) {
console.log('Usage: detectsniff.js <some URL>');
phantom.exit(1);
} else {
address = phantom.args[0];
address = system.args[1];
console.log('Checking ' + address + '...');
page.open(address, function (status) {
if (status !== 'success') {
console.log('FAIL to load the address');
phantom.exit();
} else {
window.setTimeout(function () {
sniffed = page.evaluate(function () {

View File

@ -1,29 +0,0 @@
# Get driving direction using Google Directions API.
page = require('webpage').create()
if phantom.args.length < 2
console.log 'Usage: direction.js origin destination'
console.log 'Example: direction.js "San Diego" "Palo Alto"'
phantom.exit(1)
else
origin = phantom.args[0]
dest = phantom.args[1]
page.open encodeURI('http://maps.googleapis.com/maps/api/directions/xml?origin=' + origin +
'&destination=' + dest + '&units=imperial&mode=driving&sensor=false'),
(status) ->
if status isnt 'success'
console.log 'Unable to access network'
else
steps = page.content.match(/<html_instructions>(.*)<\/html_instructions>/ig)
if not steps
console.log 'No data available for ' + origin + ' to ' + dest
else
for ins in steps
ins = ins.replace(/\&lt;/ig, '<').replace(/\&gt;/ig, '>')
ins = ins.replace(/\<div/ig, '\n<div')
ins = ins.replace(/<.*?>/g, '')
console.log(ins)
console.log ''
console.log page.content.match(/<copyrights>.*<\/copyrights>/ig).join('').replace(/<.*?>/g, '')
phantom.exit()

View File

@ -1,15 +1,16 @@
// Get driving direction using Google Directions API.
var page = require('webpage').create(),
system = require('system'),
origin, dest, steps;
if (phantom.args.length < 2) {
if (system.args.length < 3) {
console.log('Usage: direction.js origin destination');
console.log('Example: direction.js "San Diego" "Palo Alto"');
phantom.exit(1);
} else {
origin = phantom.args[0];
dest = phantom.args[1];
origin = system.args[1];
dest = system.args[2];
page.open(encodeURI('http://maps.googleapis.com/maps/api/directions/xml?origin=' + origin +
'&destination=' + dest + '&units=imperial&mode=driving&sensor=false'), function (status) {
if (status !== 'success') {

View File

@ -1,19 +0,0 @@
# echoToFile.coffee - Write in a given file all the parameters passed on the CLI
fs = require 'fs'
if phantom.args.length < 2
console.log "Usage: echoToFile.js DESTINATION_FILE <arguments to echo...>"
phantom.exit()
else
content = ""
f = null
i = 1
while i < phantom.args.length
content += phantom.args[i] + (if i == phantom.args.length - 1 then "" else " ")
++i
try
f = fs.open(phantom.args[0], "w")
f.writeLine content
catch e
console.log e
phantom.exit()

View File

@ -1,20 +1,21 @@
// echoToFile.js - Write in a given file all the parameters passed on the CLI
var fs = require('fs');
var fs = require('fs'),
system = require('system');
if (phantom.args.length < 2) {
if (system.args.length < 3) {
console.log("Usage: echoToFile.js DESTINATION_FILE <arguments to echo...>");
phantom.exit();
phantom.exit(1);
} else {
var content = '',
f = null;
for ( i= 1; i < phantom.args.length; ++i ) {
content += phantom.args[i] + (i === phantom.args.length-1 ? '' : ' ');
f = null,
i;
for ( i= 2; i < system.args.length; ++i ) {
content += system.args[i] + (i === system.args.length-1 ? '' : ' ');
}
try {
f = fs.open(phantom.args[0], "w");
f.writeLine(content);
} catch (e) {
fs.write(system.args[1], content, 'w');
} catch(e) {
console.log(e);
}

View File

@ -1,8 +0,0 @@
fibs = [0, 1]
f = ->
console.log fibs[fibs.length - 1]
fibs.push fibs[fibs.length - 1] + fibs[fibs.length - 2]
if fibs.length > 10
window.clearInterval ticker
phantom.exit()
ticker = window.setInterval(f, 300)

View File

@ -1,54 +0,0 @@
# List following and followers from several accounts
users= [
'sencha'
'aconran'
'adityabansod'
'ambisinister'
'arnebech'
'ariyahidayat'
'arthurakay'
'bmoeskau'
'darrellmeyer'
'davidfoelber'
'DavidKaneda'
'donovanerba'
'edspencer'
'evantrimboli'
'ExtAnimal'
'jamieavins'
'jarrednicholls'
'jayrobinson'
'lojjic'
'luckymethod'
'merrells'
'mmullany'
'philogb'
'philstrong'
'rdougan'
'SubtleGradient'
'__ted__'
'tmaintz'
'WesleyMoy'
'whereisthysting'
]
follow = (user, callback) ->
page = require('webpage').create()
page.open 'http://mobile.twitter.com/' + user, (status) ->
if status is 'fail'
console.log user + ': ?'
else
data = page.evaluate -> document.querySelector('div.timeline-following').innerText
console.log user + ': ' + data
callback.apply()
process = () ->
if (users.length > 0)
user = users[0]
users.splice(0, 1)
follow(user, process)
else
phantom.exit()
process()

View File

@ -1,35 +1,13 @@
// List following and followers from several accounts
var users = ['sencha',
'aconran',
'adityabansod',
'ambisinister',
'arnebech',
var users = ['PhantomJS',
'ariyahidayat',
'arthurakay',
'bmoeskau',
'darrellmeyer',
'davidfoelber',
'DavidKaneda',
'donovanerba',
'edspencer',
'evantrimboli',
'ExtAnimal',
'jamieavins',
'jarrednicholls',
'jayrobinson',
'lojjic',
'luckymethod',
'merrells',
'mmullany',
'philogb',
'philstrong',
'rdougan',
'SubtleGradient',
'__ted__',
'tmaintz',
'WesleyMoy',
'whereisthysting'];
'detronizator',
'KDABQt',
'lfranchi',
'jonleighton',
'_jamesmgreene',
'Vitalliumm'];
function follow(user, callback) {
var page = require('webpage').create();
@ -38,10 +16,11 @@ function follow(user, callback) {
console.log(user + ': ?');
} else {
var data = page.evaluate(function () {
return document.querySelector('div.timeline-following').innerText;
return document.querySelector('div.profile td.stat.stat-last div.statnum').innerText;
});
console.log(user + ': ' + data);
}
page.close();
callback.apply();
});
}

View File

@ -1,2 +0,0 @@
console.log 'Hello, world!'
phantom.exit()

View File

@ -1,19 +0,0 @@
# Upload an image to imagebin.org
page = require('webpage').create()
if phantom.args.length isnt 1
console.log 'Usage: imagebin.coffee filename'
phantom.exit()
else
fname = phantom.args[0]
page.open 'http://imagebin.org/index.php?page=add', ->
page.uploadFile 'input[name=image]', fname
page.evaluate ->
document.querySelector('input[name=nickname]').value = 'phantom'
document.querySelector('input[name=disclaimer_agree]').click()
document.querySelector('form').submit()
window.setTimeout ->
phantom.exit()
, 3000

View File

@ -1,13 +1,14 @@
// Upload an image to imagebin.org
var page = require('webpage').create(),
fname;
system = require('system'),
fname;
if (phantom.args.length !== 1) {
if (system.args.length !== 2) {
console.log('Usage: imagebin.js filename');
phantom.exit();
phantom.exit(1);
} else {
fname = phantom.args[0];
fname = system.args[1];
page.open("http://imagebin.org/index.php?page=add", function () {
page.uploadFile('input[name=image]', fname);
page.evaluate(function () {

View File

@ -1,23 +0,0 @@
# Use 'page.injectJs()' to load the script itself in the Page context
if phantom?
page = require('webpage').create()
# Route "console.log()" calls from within the Page context to the main
# Phantom context (i.e. current "this")
page.onConsoleMessage = (msg) -> console.log(msg)
page.onAlert = (msg) -> console.log(msg)
console.log "* Script running in the Phantom context."
console.log "* Script will 'inject' itself in a page..."
page.open "about:blank", (status) ->
if status is "success"
if page.injectJs("injectme.coffee")
console.log "... done injecting itself!"
else
console.log "... fail! Check the $PWD?!"
phantom.exit()
else
alert "* Script running in the Page context."

View File

@ -1,13 +0,0 @@
# Give the estimated location based on the IP address.
window.cb = (data) ->
loc = data.city
if data.region_name.length > 0
loc = loc + ', ' + data.region_name
console.log 'IP address: ' + data.ip
console.log 'Estimated location: ' + loc
phantom.exit()
el = document.createElement 'script'
el.src = 'http://freegeoip.net/json/?callback=window.cb'
document.body.appendChild el

View File

@ -1,17 +0,0 @@
page = require('webpage').create()
if phantom.args.length is 0
console.log 'Usage: loadspeed.js <some URL>'
phantom.exit()
else
t = Date.now()
address = phantom.args[0]
page.open address, (status) ->
if status isnt 'success'
console.log('FAIL to load the address')
else
t = Date.now() - t
console.log('Page title is ' + page.evaluate( (-> document.title) ))
console.log('Loading time ' + t + ' msec')
phantom.exit()

View File

@ -1,12 +1,13 @@
var page = require('webpage').create(),
system = require('system'),
t, address;
if (phantom.args.length === 0) {
if (system.args.length === 1) {
console.log('Usage: loadspeed.js <some URL>');
phantom.exit();
phantom.exit(1);
} else {
t = Date.now();
address = phantom.args[0];
address = system.args[1];
page.open(address, function (status) {
if (status !== 'success') {
console.log('FAIL to load the address');

View File

@ -0,0 +1,25 @@
var page = require('webpage').create(),
system = require('system');
if (system.args.length < 2) {
console.log('Usage: loadurlwithoutcss.js URL');
phantom.exit();
}
var address = system.args[1];
page.onResourceRequested = function(requestData, request) {
if ((/http:\/\/.+?\.css/gi).test(requestData['url']) || requestData.headers['Content-Type'] == 'text/css') {
console.log('The url of the request is matching. Aborting: ' + requestData['url']);
request.abort();
}
};
page.open(address, function(status) {
if (status === 'success') {
phantom.exit();
} else {
console.log('Unable to load the address!');
phantom.exit();
}
});

File diff suppressed because it is too large Load Diff

4
examples/module.js Normal file
View File

@ -0,0 +1,4 @@
var universe = require('./universe');
universe.start();
console.log('The answer is' + universe.answer);
phantom.exit();

View File

@ -1,13 +0,0 @@
# List movies from kids-in-mind.com
window.cbfunc = (data) ->
globaldata = data
list = data.query.results.movie
for item in list
console.log item.title + ' [' + item.rating.MPAA.content + ']'
phantom.exit()
el = document.createElement 'script'
el.src =
"http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20movies.kids-in-mind&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=window.cbfunc"
document.body.appendChild el

View File

@ -1,17 +0,0 @@
page = require('webpage').create()
address = phantom.args[0]
if phantom.args.length is 0
console.log 'Usage: netlog.coffee <some URL>'
phantom.exit()
else
page.onResourceRequested = (req) ->
console.log 'requested ' + JSON.stringify(req, undefined, 4)
page.onResourceReceived = (res) ->
console.log 'received ' + JSON.stringify(res, undefined, 4)
page.open address, (status) ->
if status isnt 'success'
console.log 'FAIL to load the address'
phantom.exit()

View File

@ -1,10 +1,12 @@
var page = require('webpage').create(),
address = phantom.args[0];
system = require('system'),
address;
if (phantom.args.length === 0) {
if (system.args.length === 1) {
console.log('Usage: netlog.js <some URL>');
phantom.exit();
phantom.exit(1);
} else {
address = system.args[1];
page.onResourceRequested = function (req) {
console.log('requested: ' + JSON.stringify(req, undefined, 4));

View File

@ -1,109 +0,0 @@
if not Date::toISOString
Date::toISOString = ->
pad = (n) ->
if n < 10 then '0' + n else n
ms = (n) ->
if n < 10 then '00' + n else (if n < 100 then '0' + n else n)
@getFullYear() + '-' +
pad(@getMonth() + 1) + '-' +
pad(@getDate()) + 'T' +
pad(@getHours()) + ':' +
pad(@getMinutes()) + ':' +
pad(@getSeconds()) + '.' +
ms(@getMilliseconds()) + 'Z'
createHAR = (address, title, startTime, resources) ->
entries = []
resources.forEach (resource) ->
request = resource.request
startReply = resource.startReply
endReply = resource.endReply
if not request or not startReply or not endReply
return
entries.push
startedDateTime: request.time.toISOString()
time: endReply.time - request.time
request:
method: request.method
url: request.url
httpVersion: 'HTTP/1.1'
cookies: []
headers: request.headers
queryString: []
headersSize: -1
bodySize: -1
response:
status: endReply.status
statusText: endReply.statusText
httpVersion: 'HTTP/1.1'
cookies: []
headers: endReply.headers
redirectURL: ''
headersSize: -1
bodySize: startReply.bodySize
content:
size: startReply.bodySize
mimeType: endReply.contentType
cache: {}
timings:
blocked: 0
dns: -1
connect: -1
send: 0
wait: startReply.time - request.time
receive: endReply.time - startReply.time
ssl: -1
log:
version: '1.2'
creator:
name: 'PhantomJS'
version: phantom.version.major + '.' + phantom.version.minor + '.' + phantom.version.patch
pages: [
startedDateTime: startTime.toISOString()
id: address
title: title
pageTimings: {}
]
entries: entries
page = require('webpage').create()
if phantom.args.length is 0
console.log 'Usage: netsniff.js <some URL>'
phantom.exit()
else
page.address = phantom.args[0]
page.resources = []
page.onLoadStarted = ->
page.startTime = new Date()
page.onResourceRequested = (req) ->
page.resources[req.id] =
request: req
startReply: null
endReply: null
page.onResourceReceived = (res) ->
if res.stage is 'start'
page.resources[res.id].startReply = res
if res.stage is 'end'
page.resources[res.id].endReply = res
page.open page.address, (status) ->
if status isnt 'success'
console.log 'FAIL to load the address'
else
page.title = page.evaluate ->
document.title
har = createHAR page.address, page.title, page.startTime, page.resources
console.log JSON.stringify har, undefined, 4
phantom.exit()

View File

@ -25,6 +25,12 @@ function createHAR(address, title, startTime, resources)
return;
}
// Exclude Data URI from HAR file because
// they aren't included in specification
if (request.url.match(/(^data:image\/.*)/i)) {
return;
}
entries.push({
startedDateTime: request.time.toISOString(),
time: endReply.time - request.time,
@ -61,7 +67,8 @@ function createHAR(address, title, startTime, resources)
wait: startReply.time - request.time,
receive: endReply.time - startReply.time,
ssl: -1
}
},
pageref: address
});
});
@ -77,21 +84,24 @@ function createHAR(address, title, startTime, resources)
startedDateTime: startTime.toISOString(),
id: address,
title: title,
pageTimings: {}
pageTimings: {
onLoad: page.endTime - page.startTime
}
}],
entries: entries
}
};
}
var page = require('webpage').create();
var page = require('webpage').create(),
system = require('system');
if (phantom.args.length === 0) {
if (system.args.length === 1) {
console.log('Usage: netsniff.js <some URL>');
phantom.exit();
phantom.exit(1);
} else {
page.address = phantom.args[0];
page.address = system.args[1];
page.resources = [];
page.onLoadStarted = function () {
@ -119,13 +129,15 @@ if (phantom.args.length === 0) {
var har;
if (status !== 'success') {
console.log('FAIL to load the address');
phantom.exit(1);
} else {
page.endTime = new Date();
page.title = page.evaluate(function () {
return document.title;
});
har = createHAR(page.address, page.title, page.startTime, page.resources);
console.log(JSON.stringify(har, undefined, 4));
phantom.exit();
}
phantom.exit();
});
}

View File

@ -0,0 +1,24 @@
var page = require('webpage').create(),
system = require('system'),
host, port, address;
if (system.args.length < 4) {
console.log('Usage: openurlwithproxy.js <proxyHost> <proxyPort> <URL>');
phantom.exit(1);
} else {
host = system.args[1];
port = system.args[2];
address = system.args[3];
phantom.setProxy(host, port, 'manual', '', '');
page.open(address, function (status) {
if (status !== 'success') {
console.log('FAIL to load the address "' +
address + '" using proxy "' + host + ':' + port + '"');
} else {
console.log('Page title is ' + page.evaluate(function () {
return document.title;
}));
}
phantom.exit();
});
}

View File

@ -1,12 +0,0 @@
helloWorld = () -> console.log phantom.outputEncoding + ": こんにちは、世界!"
console.log "Using default encoding..."
helloWorld()
console.log "\nUsing other encodings..."
for enc in ["euc-jp", "sjis", "utf8", "System"]
do (enc) ->
phantom.outputEncoding = enc
helloWorld()
phantom.exit()

146
examples/page_events.js Normal file
View File

@ -0,0 +1,146 @@
// The purpose of this is to show how and when events fire, considering 5 steps
// happening as follows:
//
// 1. Load URL
// 2. Load same URL, but adding an internal FRAGMENT to it
// 3. Click on an internal Link, that points to another internal FRAGMENT
// 4. Click on an external Link, that will send the page somewhere else
// 5. Close page
//
// Take particular care when going through the output, to understand when
// things happen (and in which order). Particularly, notice what DOESN'T
// happen during step 3.
//
// If invoked with "-v" it will print out the Page Resources as they are
// Requested and Received.
//
// NOTE.1: The "onConsoleMessage/onAlert/onPrompt/onConfirm" events are
// registered but not used here. This is left for you to have fun with.
// NOTE.2: This script is not here to teach you ANY JavaScript. It's aweful!
// NOTE.3: Main audience for this are people new to PhantomJS.
var sys = require("system"),
page = require("webpage").create(),
logResources = false,
step1url = "http://en.wikipedia.org/wiki/DOM_events",
step2url = "http://en.wikipedia.org/wiki/DOM_events#Event_flow";
if (sys.args.length > 1 && sys.args[1] === "-v") {
logResources = true;
}
function printArgs() {
var i, ilen;
for (i = 0, ilen = arguments.length; i < ilen; ++i) {
console.log(" arguments[" + i + "] = " + JSON.stringify(arguments[i]));
}
console.log("");
}
////////////////////////////////////////////////////////////////////////////////
page.onInitialized = function() {
console.log("page.onInitialized");
printArgs.apply(this, arguments);
};
page.onLoadStarted = function() {
console.log("page.onLoadStarted");
printArgs.apply(this, arguments);
};
page.onLoadFinished = function() {
console.log("page.onLoadFinished");
printArgs.apply(this, arguments);
};
page.onUrlChanged = function() {
console.log("page.onUrlChanged");
printArgs.apply(this, arguments);
};
page.onNavigationRequested = function() {
console.log("page.onNavigationRequested");
printArgs.apply(this, arguments);
};
page.onRepaintRequested = function() {
console.log("page.onRepaintRequested");
printArgs.apply(this, arguments);
};
if (logResources === true) {
page.onResourceRequested = function() {
console.log("page.onResourceRequested");
printArgs.apply(this, arguments);
};
page.onResourceReceived = function() {
console.log("page.onResourceReceived");
printArgs.apply(this, arguments);
};
}
page.onClosing = function() {
console.log("page.onClosing");
printArgs.apply(this, arguments);
};
// window.console.log(msg);
page.onConsoleMessage = function() {
console.log("page.onConsoleMessage");
printArgs.apply(this, arguments);
};
// window.alert(msg);
page.onAlert = function() {
console.log("page.onAlert");
printArgs.apply(this, arguments);
};
// var confirmed = window.confirm(msg);
page.onConfirm = function() {
console.log("page.onConfirm");
printArgs.apply(this, arguments);
};
// var user_value = window.prompt(msg, default_value);
page.onPrompt = function() {
console.log("page.onPrompt");
printArgs.apply(this, arguments);
};
////////////////////////////////////////////////////////////////////////////////
setTimeout(function() {
console.log("");
console.log("### STEP 1: Load '" + step1url + "'");
page.open(step1url);
}, 0);
setTimeout(function() {
console.log("");
console.log("### STEP 2: Load '" + step2url + "' (load same URL plus FRAGMENT)");
page.open(step2url);
}, 5000);
setTimeout(function() {
console.log("");
console.log("### STEP 3: Click on page internal link (aka FRAGMENT)");
page.evaluate(function() {
var ev = document.createEvent("MouseEvents");
ev.initEvent("click", true, true);
document.querySelector("a[href='#Event_object']").dispatchEvent(ev);
});
}, 10000);
setTimeout(function() {
console.log("");
console.log("### STEP 4: Click on page external link");
page.evaluate(function() {
var ev = document.createEvent("MouseEvents");
ev.initEvent("click", true, true);
document.querySelector("a[title='JavaScript']").dispatchEvent(ev);
});
}, 15000);
setTimeout(function() {
console.log("");
console.log("### STEP 5: Close page and shutdown (with a delay)");
page.close();
setTimeout(function(){
phantom.exit();
}, 100);
}, 20000);

17
examples/pagecallback.js Normal file
View File

@ -0,0 +1,17 @@
var p = require("webpage").create();
p.onConsoleMessage = function(msg) { console.log(msg); };
// Calls to "callPhantom" within the page 'p' arrive here
p.onCallback = function(msg) {
console.log("Received by the 'phantom' main context: "+msg);
return "Hello there, I'm coming to you from the 'phantom' context instead";
};
p.evaluate(function() {
// Return-value of the "onCallback" handler arrive here
var callbackResponse = window.callPhantom("Hello, I'm coming to you from the 'page' context");
console.log("Received by the 'page' context: "+callbackResponse);
});
phantom.exit();

View File

@ -1,13 +0,0 @@
# Read the Phantom webpage '#intro' element text using jQuery and "includeJs"
page = require('webpage').create()
page.onConsoleMessage = (msg) -> console.log msg
page.open "http://www.phantomjs.org", (status) ->
if status is "success"
page.includeJs "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", ->
page.evaluate ->
console.log "$(\"#intro\").text() -> " + $("#intro").text()
phantom.exit()

View File

@ -10,7 +10,7 @@ page.open("http://www.phantomjs.org", function(status) {
if ( status === "success" ) {
page.includeJs("http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", function() {
page.evaluate(function() {
console.log("$(\"#intro\").text() -> " + $("#intro").text());
console.log("$(\".explanation\").text() -> " + $(".explanation").text());
});
phantom.exit();
});

View File

@ -1,18 +0,0 @@
# Find pizza in Mountain View using Yelp
page = require('webpage').create()
url = 'http://lite.yelp.com/search?find_desc=pizza&find_loc=94040&find_submit=Search'
page.open url,
(status) ->
if status isnt 'success'
console.log 'Unable to access network'
else
results = page.evaluate ->
pizza = []
list = document.querySelectorAll 'span.address'
for item in list
pizza.push(item.innerText)
return pizza
console.log results.join('\n')
phantom.exit()

View File

@ -8,7 +8,7 @@ page.open(url, function (status) {
console.log('Unable to access network');
} else {
var results = page.evaluate(function() {
var list = document.querySelectorAll('span.address'), pizza = [], i;
var list = document.querySelectorAll('address'), pizza = [], i;
for (i = 0; i < list.length; i++) {
pizza.push(list[i].innerText);
}

View File

@ -1,12 +0,0 @@
# Example using HTTP POST operation
page = require('webpage').create()
server = 'http://posttestserver.com/post.php?dump'
data = 'universe=expanding&answer=42'
page.open server, 'post', data, (status) ->
if status isnt 'success'
console.log 'Unable to post!'
else
console.log page.content
phantom.exit()

18
examples/postjson.js Normal file
View File

@ -0,0 +1,18 @@
// Example using HTTP POST operation
var page = require('webpage').create(),
server = 'http://posttestserver.com/post.php?dump',
data = '{"universe": "expanding", "answer": 42}';
var headers = {
"Content-Type": "application/json"
}
page.open(server, 'post', data, headers, function (status) {
if (status !== 'success') {
console.log('Unable to post!');
} else {
console.log(page.content);
}
phantom.exit();
});

34
examples/postserver.js Normal file
View File

@ -0,0 +1,34 @@
// Example using HTTP POST operation
var page = require('webpage').create(),
server = require('webserver').create(),
system = require('system'),
data = 'universe=expanding&answer=42';
if (system.args.length !== 2) {
console.log('Usage: postserver.js <portnumber>');
phantom.exit(1);
}
var port = system.args[1];
service = server.listen(port, function (request, response) {
console.log('Request received at ' + new Date());
response.statusCode = 200;
response.headers = {
'Cache': 'no-cache',
'Content-Type': 'text/plain;charset=utf-8'
};
response.write(JSON.stringify(request, null, 4));
response.close();
});
page.open('http://localhost:' + port + '/', 'post', data, function (status) {
if (status !== 'success') {
console.log('Unable to post!');
} else {
console.log(page.plainText);
}
phantom.exit();
});

10
examples/printenv.js Normal file
View File

@ -0,0 +1,10 @@
var system = require('system'),
env = system.env,
key;
for (key in env) {
if (env.hasOwnProperty(key)) {
console.log(key + '=' + env[key]);
}
}
phantom.exit();

View File

@ -0,0 +1,89 @@
var page = require('webpage').create(),
system = require('system');
function someCallback(pageNum, numPages) {
return "<h1> someCallback: " + pageNum + " / " + numPages + "</h1>";
}
if (system.args.length < 3) {
console.log('Usage: printheaderfooter.js URL filename');
phantom.exit(1);
} else {
var address = system.args[1];
var output = system.args[2];
page.viewportSize = { width: 600, height: 600 };
page.paperSize = {
format: 'A4',
margin: "1cm",
/* default header/footer for pages that don't have custom overwrites (see below) */
header: {
height: "1cm",
contents: phantom.callback(function(pageNum, numPages) {
if (pageNum == 1) {
return "";
}
return "<h1>Header <span style='float:right'>" + pageNum + " / " + numPages + "</span></h1>";
})
},
footer: {
height: "1cm",
contents: phantom.callback(function(pageNum, numPages) {
if (pageNum == numPages) {
return "";
}
return "<h1>Footer <span style='float:right'>" + pageNum + " / " + numPages + "</span></h1>";
})
}
};
page.open(address, function (status) {
if (status !== 'success') {
console.log('Unable to load the address!');
} else {
/* check whether the loaded page overwrites the header/footer setting,
i.e. whether a PhantomJSPriting object exists. Use that then instead
of our defaults above.
example:
<html>
<head>
<script type="text/javascript">
var PhantomJSPrinting = {
header: {
height: "1cm",
contents: function(pageNum, numPages) { return pageNum + "/" + numPages; }
},
footer: {
height: "1cm",
contents: function(pageNum, numPages) { return pageNum + "/" + numPages; }
}
};
</script>
</head>
<body><h1>asdfadsf</h1><p>asdfadsfycvx</p></body>
</html>
*/
if (page.evaluate(function(){return typeof PhantomJSPrinting == "object";})) {
paperSize = page.paperSize;
paperSize.header.height = page.evaluate(function() {
return PhantomJSPrinting.header.height;
});
paperSize.header.contents = phantom.callback(function(pageNum, numPages) {
return page.evaluate(function(pageNum, numPages){return PhantomJSPrinting.header.contents(pageNum, numPages);}, pageNum, numPages);
});
paperSize.footer.height = page.evaluate(function() {
return PhantomJSPrinting.footer.height;
});
paperSize.footer.contents = phantom.callback(function(pageNum, numPages) {
return page.evaluate(function(pageNum, numPages){return PhantomJSPrinting.footer.contents(pageNum, numPages);}, pageNum, numPages);
});
page.paperSize = paperSize;
console.log(page.paperSize.header.height);
console.log(page.paperSize.footer.height);
}
window.setTimeout(function () {
page.render(output);
phantom.exit();
}, 200);
}
});
}

35
examples/printmargins.js Normal file
View File

@ -0,0 +1,35 @@
var page = require('webpage').create(),
system = require('system');
if (system.args.length < 7) {
console.log('Usage: printmargins.js URL filename LEFT TOP RIGHT BOTTOM');
console.log(' margin examples: "1cm", "10px", "7mm", "5in"');
phantom.exit(1);
} else {
var address = system.args[1];
var output = system.args[2];
var marginLeft = system.args[3];
var marginTop = system.args[4];
var marginRight = system.args[5];
var marginBottom = system.args[6];
page.viewportSize = { width: 600, height: 600 };
page.paperSize = {
format: 'A4',
margin: {
left: marginLeft,
top: marginTop,
right: marginRight,
bottom: marginBottom
}
};
page.open(address, function (status) {
if (status !== 'success') {
console.log('Unable to load the address!');
} else {
window.setTimeout(function () {
page.render(output);
phantom.exit();
}, 200);
}
});
}

View File

@ -1,22 +0,0 @@
page = require('webpage').create()
if phantom.args.length < 2 or phantom.args.length > 3
console.log 'Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat]'
console.log ' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"'
phantom.exit()
else
address = phantom.args[0]
output = phantom.args[1]
page.viewportSize = { width: 600, height: 600 }
if phantom.args.length is 3 and phantom.args[1].substr(-4) is ".pdf"
size = phantom.args[2].split '*'
if size.length is 2
page.paperSize = { width: size[0], height: size[1], border: '0px' }
else
page.paperSize = { format: phantom.args[2], orientation: 'portrait', border: '1cm' }
page.open address, (status) ->
if status isnt 'success'
console.log 'Unable to load the address!'
phantom.exit()
else
window.setTimeout (-> page.render output; phantom.exit()), 200

View File

@ -1,22 +1,43 @@
var page = require('webpage').create(),
system = require('system'),
address, output, size;
if (phantom.args.length < 2 || phantom.args.length > 3) {
console.log('Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat]');
if (system.args.length < 3 || system.args.length > 5) {
console.log('Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat] [zoom]');
console.log(' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"');
phantom.exit();
console.log(' image (png/jpg output) examples: "1920px" entire page, window width 1920px');
console.log(' "800px*600px" window, clipped to 800x600');
phantom.exit(1);
} else {
address = phantom.args[0];
output = phantom.args[1];
address = system.args[1];
output = system.args[2];
page.viewportSize = { width: 600, height: 600 };
if (phantom.args.length === 3 && phantom.args[1].substr(-4) === ".pdf") {
size = phantom.args[2].split('*');
page.paperSize = size.length === 2 ? { width: size[0], height: size[1], border: '0px' }
: { format: phantom.args[2], orientation: 'portrait', border: '1cm' };
if (system.args.length > 3 && system.args[2].substr(-4) === ".pdf") {
size = system.args[3].split('*');
page.paperSize = size.length === 2 ? { width: size[0], height: size[1], margin: '0px' }
: { format: system.args[3], orientation: 'portrait', margin: '1cm' };
} else if (system.args.length > 3 && system.args[3].substr(-2) === "px") {
size = system.args[3].split('*');
if (size.length === 2) {
pageWidth = parseInt(size[0], 10);
pageHeight = parseInt(size[1], 10);
page.viewportSize = { width: pageWidth, height: pageHeight };
page.clipRect = { top: 0, left: 0, width: pageWidth, height: pageHeight };
} else {
console.log("size:", system.args[3]);
pageWidth = parseInt(system.args[3], 10);
pageHeight = parseInt(pageWidth * 3/4, 10); // it's as good an assumption as any
console.log ("pageHeight:",pageHeight);
page.viewportSize = { width: pageWidth, height: pageHeight };
}
}
if (system.args.length > 4) {
page.zoomFactor = system.args[4];
}
page.open(address, function (status) {
if (status !== 'success') {
console.log('Unable to load the address!');
phantom.exit(1);
} else {
window.setTimeout(function () {
page.render(output);

View File

@ -1,48 +0,0 @@
# Render Multiple URLs to file
# FIXME: For now it is fine with pure domain names: don't think it would work with paths and stuff like that
# Extend the Array Prototype with a 'foreach'
Array.prototype.forEach = (action) ->
for i, j in this
action j, i, _len
# Render a given url to a given file
# @param url URL to render
# @param file File to render to
# @param callback Callback function
renderUrlToFile = (url, file, callback) ->
page = require('webpage').create()
page.viewportSize = { width: 800, height : 600 }
page.settings.userAgent = 'Phantom.js bot'
page.open url, (status) ->
if status isnt 'success'
console.log "Unable to render '#{url}'"
else
page.render file
delete page
callback url, file
# Read the passed args
if phantom.args.length > 0
arrayOfUrls = phantom.args
else
# Default (no args passed)
console.log 'Usage: phantomjs render_multi_url.coffee [domain.name1, domain.name2, ...]'
arrayOfUrls = [
'www.google.com',
'www.bbc.co.uk',
'www.phantomjs.org'
]
# For each URL
arrayOfUrls.forEach (pos, url, total) ->
file_name = "./#{url}.png"
# Render to a file
renderUrlToFile "http://#{url}", file_name, (url, file) ->
console.log "Rendered '#{url}' at '#{file}'"
if pos is total - 1
# Close Phantom if it's the last URL
phantom.exit()

View File

@ -1,60 +1,73 @@
// Render Multiple URLs to file
// FIXME: For now it is fine with pure domain names: don't think it would work with paths and stuff like that
// Extend the Array Prototype with a 'foreach'
Array.prototype.forEach = function (action) {
var i, len;
for ( i = 0, len = this.length; i < len; ++i ) {
action(i, this[i], len);
}
var RenderUrlsToFile, arrayOfUrls, system;
system = require("system");
/*
Render given urls
@param array of URLs to render
@param callbackPerUrl Function called after finishing each URL, including the last URL
@param callbackFinal Function called after finishing everything
*/
RenderUrlsToFile = function(urls, callbackPerUrl, callbackFinal) {
var getFilename, next, page, retrieve, urlIndex, webpage;
urlIndex = 0;
webpage = require("webpage");
page = null;
getFilename = function() {
return "rendermulti-" + urlIndex + ".png";
};
next = function(status, url, file) {
page.close();
callbackPerUrl(status, url, file);
return retrieve();
};
retrieve = function() {
var url;
if (urls.length > 0) {
url = urls.shift();
urlIndex++;
page = webpage.create();
page.viewportSize = {
width: 800,
height: 600
};
page.settings.userAgent = "Phantom.js bot";
return page.open("http://" + url, function(status) {
var file;
file = getFilename();
if (status === "success") {
return window.setTimeout((function() {
page.render(file);
return next(status, url, file);
}), 200);
} else {
return next(status, url, file);
}
});
} else {
return callbackFinal();
}
};
return retrieve();
};
/**
* Render a given url to a given file
* @param url URL to render
* @param file File to render to
* @param callback Callback function
*/
function renderUrlToFile(url, file, callback) {
var page = require('webpage').create();
page.viewportSize = { width: 800, height : 600 };
page.settings.userAgent = "Phantom.js bot";
page.open(url, function(status){
if ( status !== "success") {
console.log("Unable to render '"+url+"'");
} else {
page.render(file);
}
delete page;
callback(url, file);
});
}
arrayOfUrls = null;
// Read the passed args
var arrayOfUrls;
if ( phantom.args.length > 0 ) {
arrayOfUrls = phantom.args;
if (system.args.length > 1) {
arrayOfUrls = Array.prototype.slice.call(system.args, 1);
} else {
// Default (no args passed)
console.log("Usage: phantomjs render_multi_url.js [domain.name1, domain.name2, ...]");
arrayOfUrls = [
'www.google.com',
'www.bbc.co.uk',
'www.phantomjs.org'
];
arrayOfUrls = ["www.google.com", "www.bbc.co.uk", "www.phantomjs.org"];
}
// For each URL
arrayOfUrls.forEach(function(pos, url, total){
var file_name = "./" + url + ".png";
// Render to a file
renderUrlToFile("http://"+url, file_name, function(url, file){
console.log("Rendered '"+url+"' at '"+file+"'");
if ( pos === total-1 ) {
// Close Phantom if it's the last URL
phantom.exit();
}
});
RenderUrlsToFile(arrayOfUrls, (function(status, url, file) {
if (status !== "success") {
return console.log("Unable to render '" + url + "'");
} else {
return console.log("Rendered '" + url + "' at '" + file + "'");
}
}), function() {
return phantom.exit();
});

View File

@ -1,59 +0,0 @@
##
# Wait until the test condition is true or a timeout occurs. Useful for waiting
# on a server response or for a ui change (fadeIn, etc.) to occur.
#
# @param testFx javascript condition that evaluates to a boolean,
# it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
# as a callback function.
# @param onReady what to do when testFx condition is fulfilled,
# it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
# as a callback function.
# @param timeOutMillis the max amount of time to wait. If not specified, 3 sec is used.
##
waitFor = (testFx, onReady, timeOutMillis=3000) ->
start = new Date().getTime()
condition = false
f = ->
if (new Date().getTime() - start < timeOutMillis) and not condition
# If not time-out yet and condition not yet fulfilled
condition = (if typeof testFx is 'string' then eval testFx else testFx()) #< defensive code
else
if not condition
# If condition still not fulfilled (timeout but condition is 'false')
console.log "'waitFor()' timeout"
phantom.exit(1)
else
# Condition fulfilled (timeout and/or condition is 'true')
console.log "'waitFor()' finished in #{new Date().getTime() - start}ms."
if typeof onReady is 'string' then eval onReady else onReady() #< Do what it's supposed to do once the condition is fulfilled
clearInterval interval #< Stop this interval
interval = setInterval f, 100 #< repeat check every 100ms
if phantom.args.length isnt 1
console.log 'Usage: run-jasmine.coffee URL'
phantom.exit()
page = require('webpage').create()
# Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this")
page.onConsoleMessage = (msg) ->
console.log msg
page.open phantom.args[0], (status) ->
if status isnt 'success'
console.log 'Unable to access network'
phantom.exit()
else
waitFor ->
page.evaluate ->
if document.body.querySelector '.finished-at'
return true
return false
, ->
page.evaluate ->
console.log document.body.querySelector('.description').innerText
list = document.body.querySelectorAll('.failed > .description, .failed > .messages > .resultMessage')
for el in list
console.log el.innerText
phantom.exit()

View File

@ -1,3 +1,5 @@
var system = require('system');
/**
* Wait until the test condition is true or a timeout occurs. Useful for waiting
* on a server response or for a ui change (fadeIn, etc.) to occur.
@ -34,9 +36,9 @@ function waitFor(testFx, onReady, timeOutMillis) {
};
if (phantom.args.length === 0 || phantom.args.length > 2) {
if (system.args.length !== 2) {
console.log('Usage: run-jasmine.js URL');
phantom.exit();
phantom.exit(1);
}
var page = require('webpage').create();
@ -46,32 +48,44 @@ page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.open(phantom.args[0], function(status){
page.open(system.args[1], function(status){
if (status !== "success") {
console.log("Unable to access network");
phantom.exit();
console.log("Unable to open " + system.args[1]);
phantom.exit(1);
} else {
waitFor(function(){
return page.evaluate(function(){
if (document.body.querySelector('.finished-at')) {
return true;
}
return false;
return document.body.querySelector('.symbolSummary .pending') === null
});
}, function(){
page.evaluate(function(){
console.log(document.body.querySelector('.description').innerText);
list = document.body.querySelectorAll('div.jasmine_reporter > div.suite.failed');
for (i = 0; i < list.length; ++i) {
el = list[i];
desc = el.querySelectorAll('.description');
var exitCode = page.evaluate(function(){
try {
console.log('');
for (j = 0; j < desc.length; ++j) {
console.log(desc[j].innerText);
console.log(document.body.querySelector('.description').innerText);
var list = document.body.querySelectorAll('.results > #details > .specDetail.failed');
if (list && list.length > 0) {
console.log('');
console.log(list.length + ' test(s) FAILED:');
for (i = 0; i < list.length; ++i) {
var el = list[i],
desc = el.querySelector('.description'),
msg = el.querySelector('.resultMessage.fail');
console.log('');
console.log(desc.innerText);
console.log(msg.innerText);
console.log('');
}
return 1;
} else {
console.log(document.body.querySelector('.alert > .passingAlert.bar').innerText);
return 0;
}
} catch (ex) {
console.log(ex);
return 1;
}
});
phantom.exit();
phantom.exit(exitCode);
});
}
});

92
examples/run-jasmine2.js Normal file
View File

@ -0,0 +1,92 @@
var system = require('system');
/**
* Wait until the test condition is true or a timeout occurs. Useful for waiting
* on a server response or for a ui change (fadeIn, etc.) to occur.
*
* @param testFx javascript condition that evaluates to a boolean,
* it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
* as a callback function.
* @param onReady what to do when testFx condition is fulfilled,
* it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
* as a callback function.
* @param timeOutMillis the max amount of time to wait. If not specified, 3 sec is used.
*/
function waitFor(testFx, onReady, timeOutMillis) {
var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 3001, //< Default Max Timeout is 3s
start = new Date().getTime(),
condition = false,
interval = setInterval(function() {
if ( (new Date().getTime() - start < maxtimeOutMillis) && !condition ) {
// If not time-out yet and condition not yet fulfilled
condition = (typeof(testFx) === "string" ? eval(testFx) : testFx()); //< defensive code
} else {
if(!condition) {
// If condition still not fulfilled (timeout but condition is 'false')
console.log("'waitFor()' timeout");
phantom.exit(1);
} else {
// Condition fulfilled (timeout and/or condition is 'true')
console.log("'waitFor()' finished in " + (new Date().getTime() - start) + "ms.");
typeof(onReady) === "string" ? eval(onReady) : onReady(); //< Do what it's supposed to do once the condition is fulfilled
clearInterval(interval); //< Stop this interval
}
}
}, 100); //< repeat check every 100ms
};
if (system.args.length !== 2) {
console.log('Usage: run-jasmine.js URL');
phantom.exit(1);
}
var page = require('webpage').create();
// Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this")
page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.open(system.args[1], function(status){
if (status !== "success") {
console.log("Unable to access network");
phantom.exit();
} else {
waitFor(function(){
return page.evaluate(function(){
return document.body.querySelector('.symbolSummary .pending') === null
});
}, function(){
var exitCode = page.evaluate(function(){
console.log('');
var el = document.body.querySelector('.banner');
var banner = el.querySelector('.title').innerText + " " +
el.querySelector('.version').innerText + " " +
el.querySelector('.duration').innerText;
console.log(banner);
var list = document.body.querySelectorAll('.results > .failures > .spec-detail.failed');
if (list && list.length > 0) {
console.log('');
console.log(list.length + ' test(s) FAILED:');
for (i = 0; i < list.length; ++i) {
var el = list[i],
desc = el.querySelector('.description'),
msg = el.querySelector('.messages > .result-message');
console.log('');
console.log(desc.innerText);
console.log(msg.innerText);
console.log('');
}
return 1;
} else {
console.log(document.body.querySelector('.alert > .bar.passed').innerText);
return 0;
}
});
phantom.exit(exitCode);
});
}
});

View File

@ -1,62 +0,0 @@
##
# Wait until the test condition is true or a timeout occurs. Useful for waiting
# on a server response or for a ui change (fadeIn, etc.) to occur.
#
# @param testFx javascript condition that evaluates to a boolean,
# it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
# as a callback function.
# @param onReady what to do when testFx condition is fulfilled,
# it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
# as a callback function.
# @param timeOutMillis the max amount of time to wait. If not specified, 3 sec is used.
##
waitFor = (testFx, onReady, timeOutMillis=3000) ->
start = new Date().getTime()
condition = false
f = ->
if (new Date().getTime() - start < timeOutMillis) and not condition
# If not time-out yet and condition not yet fulfilled
condition = (if typeof testFx is 'string' then eval testFx else testFx()) #< defensive code
else
if not condition
# If condition still not fulfilled (timeout but condition is 'false')
console.log "'waitFor()' timeout"
phantom.exit(1)
else
# Condition fulfilled (timeout and/or condition is 'true')
console.log "'waitFor()' finished in #{new Date().getTime() - start}ms."
if typeof onReady is 'string' then eval onReady else onReady() #< Do what it's supposed to do once the condition is fulfilled
clearInterval interval #< Stop this interval
interval = setInterval f, 100 #< repeat check every 100ms
if phantom.args.length isnt 1
console.log 'Usage: run-qunit.coffee URL'
phantom.exit(1)
page = require('webpage').create()
# Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this")
page.onConsoleMessage = (msg) ->
console.log msg
page.open phantom.args[0], (status) ->
if status isnt 'success'
console.log 'Unable to access network'
phantom.exit(1)
else
waitFor ->
page.evaluate ->
el = document.getElementById 'qunit-testresult'
if el and el.innerText.match 'completed'
return true
return false
, ->
failedNum = page.evaluate ->
el = document.getElementById 'qunit-testresult'
console.log el.innerText
try
return el.getElementsByClassName('failed')[0].innerHTML
catch e
return 10000
phantom.exit if parseInt(failedNum, 10) > 0 then 1 else 0

View File

@ -1,3 +1,5 @@
var system = require('system');
/**
* Wait until the test condition is true or a timeout occurs. Useful for waiting
* on a server response or for a ui change (fadeIn, etc.) to occur.
@ -34,7 +36,7 @@ function waitFor(testFx, onReady, timeOutMillis) {
};
if (phantom.args.length === 0 || phantom.args.length > 2) {
if (system.args.length !== 2) {
console.log('Usage: run-qunit.js URL');
phantom.exit(1);
}
@ -46,7 +48,7 @@ page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.open(phantom.args[0], function(status){
page.open(system.args[1], function(status){
if (status !== "success") {
console.log("Unable to access network");
phantom.exit(1);

View File

@ -1,15 +0,0 @@
# List all the files in a Tree of Directories
if phantom.args.length != 1
console.log "Usage: phantomjs scandir.js DIRECTORY_TO_SCAN"
phantom.exit()
scanDirectory = (path) ->
fs = require 'fs'
if fs.exists(path) and fs.isFile(path)
console.log path
else if fs.isDirectory(path)
fs.list(path).forEach (e) ->
scanDirectory path + "/" + e if e != "." and e != ".."
scanDirectory phantom.args[0]
phantom.exit()

View File

@ -1,8 +1,9 @@
// List all the files in a Tree of Directories
var system = require('system');
if (phantom.args.length !== 1) {
if (system.args.length !== 2) {
console.log("Usage: phantomjs scandir.js DIRECTORY_TO_SCAN");
phantom.exit();
phantom.exit(1);
}
var scanDirectory = function (path) {
@ -17,5 +18,5 @@ var scanDirectory = function (path) {
});
}
};
scanDirectory(phantom.args[0]);
scanDirectory(system.args[1]);
phantom.exit();

View File

@ -1,17 +0,0 @@
# Show BBC seasonal food list.
window.cbfunc = (data) ->
list = data.query.results.results.result
names = ['January', 'February', 'March',
'April', 'May', 'June',
'July', 'August', 'September',
'October', 'November', 'December']
for item in list
console.log [item.name.replace(/\s/ig, ' '), ':',
names[item.atItsBestUntil], 'to',
names[item.atItsBestFrom]].join(' ')
phantom.exit()
el = document.createElement 'script'
el.src = 'http://query.yahooapis.com/v1/public/yql?q=SELECT%20*%20FROM%20bbc.goodfood.seasonal%3B&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=window.cbfunc'
document.body.appendChild el

View File

@ -1,28 +1,16 @@
var page = require('webpage').create();
var server = require('webserver').create();
var system = require('system');
var host, port;
if (phantom.args.length !== 1) {
if (system.args.length !== 2) {
console.log('Usage: server.js <some port>');
phantom.exit();
phantom.exit(1);
} else {
port = phantom.args[0];
port = system.args[1];
var listening = server.listen(port, function (request, response) {
console.log("GOT HTTP REQUEST");
console.log("request.url = " + request.url);
console.log("request.queryString = " + request.queryString);
console.log("request.method = " + request.method);
console.log("request.httpVersion = " + request.httpVersion);
console.log("request.statusCode = " + request.statusCode);
console.log("request.isSSL = " + request.isSSL);
console.log("request.remoteIP = " + request.remoteIP);
console.log("request.remotePort = " + request.remotePort);
console.log("request.remoteUser = " + request.remoteUser);
console.log("request.headers = " + request.headers);
for(var i = 0; i < request.headers; ++i) {
console.log("request.headerName(" + i + ") = " + request.headerName(i));
console.log("request.headerValue(" + i + ") = " + request.headerValue(i));
}
console.log(JSON.stringify(request, null, 4));
// we set the headers here
response.statusCode = 200;
@ -34,17 +22,20 @@ if (phantom.args.length !== 1) {
response.write("<html><head><title>YES!</title></head>");
// note: writeBody can be called multiple times
response.write("<body><p>pretty cool :)</body></html>");
response.close();
});
if (!listening) {
console.log("could not create web server listening on port " + port);
phantom.exit();
}
var url = "http://localhost:" + port + "/foo/bar.php?asdf=true";
console.log("SENDING REQUEST TO:");
console.log(url);
page.open(url, function (status) {
if (status !== 'success') {
console.log('FAIL to load the address');
} else {
console.log("GOT REPLY FROM SERVER:");
console.log(page.content);
}
phantom.exit();

View File

@ -0,0 +1,34 @@
var port, server, service,
system = require('system');
if (system.args.length !== 2) {
console.log('Usage: serverkeepalive.js <portnumber>');
phantom.exit(1);
} else {
port = system.args[1];
server = require('webserver').create();
service = server.listen(port, { keepAlive: true }, function (request, response) {
console.log('Request at ' + new Date());
console.log(JSON.stringify(request, null, 4));
var body = JSON.stringify(request, null, 4);
response.statusCode = 200;
response.headers = {
'Cache': 'no-cache',
'Content-Type': 'text/plain',
'Connection': 'Keep-Alive',
'Keep-Alive': 'timeout=5, max=100',
'Content-Length': body.length
};
response.write(body);
response.close();
});
if (service) {
console.log('Web server running on port ' + port);
} else {
console.log('Error: Could not create web server listening on port ' + port);
phantom.exit();
}
}

View File

@ -1,35 +0,0 @@
if phantom.args.length is 0
console.log "Usage: simpleserver.js <portnumber>"
phantom.exit()
else
port = phantom.args[0]
server = require("webserver").create()
service = server.listen(port, (request, response) ->
console.log "Request at " + new Date()
console.log JSON.stringify(request, null, 4)
response.statusCode = 200
response.headers =
Cache: "no-cache"
"Content-Type": "text/html"
response.write "<html>"
response.write "<head>"
response.write "<title>Hello, world!</title>"
response.write "</head>"
response.write "<body>"
response.write "<p>This is from PhantomJS web server.</p>"
response.write "<p>Request data:</p>"
response.write "<pre>"
response.write JSON.stringify(request, null, 4)
response.write "</pre>"
response.write "</body>"
response.write "</html>"
)
if service
console.log "Web server running on port " + port
else
console.log "Error: Could not create web server listening on port " + port
phantom.exit()

View File

@ -1,10 +1,11 @@
var port, server, service;
var port, server, service,
system = require('system');
if (phantom.args.length !== 1) {
if (system.args.length !== 2) {
console.log('Usage: simpleserver.js <portnumber>');
phantom.exit();
phantom.exit(1);
} else {
port = phantom.args[0];
port = system.args[1];
server = require('webserver').create();
service = server.listen(port, function (request, response) {
@ -29,6 +30,7 @@ if (phantom.args.length !== 1) {
response.write('</pre>');
response.write('</body>');
response.write('</html>');
response.close();
});
if (service) {

View File

@ -1,17 +0,0 @@
###
Sort integers from the command line in a very ridiculous way: leveraging timeouts :P
###
if phantom.args < 1
console.log "Usage: phantomjs sleepsort.js PUT YOUR INTEGERS HERE SEPARATED BY SPACES"
phantom.exit()
else
sortedCount = 0
for int in phantom.args
setTimeout ((j) ->
->
console.log j
++sortedCount
phantom.exit() if sortedCount is phantom.args.length)(int),
int

View File

@ -1,4 +1,5 @@
// sleepsort.js - Sort integers from the commandline in a very ridiculous way: leveraging timeouts :P
var system = require('system');
function sleepSort(array, callback) {
var sortedCount = 0,
@ -14,11 +15,11 @@ function sleepSort(array, callback) {
}
}
if ( phantom.args < 1 ) {
if ( system.args.length < 2 ) {
console.log("Usage: phantomjs sleepsort.js PUT YOUR INTEGERS HERE SEPARATED BY SPACES");
phantom.exit();
phantom.exit(1);
} else {
sleepSort(phantom.args, function() {
sleepSort(system.args.slice(1), function() {
phantom.exit();
});
}
}

View File

@ -0,0 +1,18 @@
var system = require('system');
system.stdout.write('Hello, system.stdout.write!');
system.stdout.writeLine('\nHello, system.stdout.writeLine!');
system.stderr.write('Hello, system.stderr.write!');
system.stderr.writeLine('\nHello, system.stderr.writeLine!');
system.stdout.writeLine('system.stdin.readLine(): ');
var line = system.stdin.readLine();
system.stdout.writeLine(JSON.stringify(line));
// This is essentially a `readAll`
system.stdout.writeLine('system.stdin.read(5): (ctrl+D to end)');
var input = system.stdin.read(5);
system.stdout.writeLine(JSON.stringify(input));
phantom.exit(0);

View File

@ -1,17 +0,0 @@
page = require('webpage').create()
page.viewportSize = { width: 320, height: 480 }
page.open 'http://news.google.com/news/i/section?&topic=t',
(status) ->
if status isnt 'success'
console.log 'Unable to access the network!'
else
page.evaluate ->
body = document.body
body.style.backgroundColor = '#fff'
body.querySelector('div#title-block').style.display = 'none'
body.querySelector('form#edition-picker-form')
.parentElement.parentElement.style.display = 'none'
page.render 'technews.png'
phantom.exit()

View File

@ -1,30 +0,0 @@
# Get twitter status for given account (or for the default one, "sencha")
page = require('webpage').create()
twitterId = 'sencha' #< default value
# Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this")
page.onConsoleMessage = (msg) ->
console.log msg
# Print usage message, if no twitter ID is passed
if phantom.args.length < 1
console.log 'Usage: tweets.coffee [twitter ID]'
else
twitterId = phantom.args[0]
# Heading
console.log "*** Latest tweets from @#{twitterId} ***\n"
# Open Twitter Mobile and, onPageLoad, do...
page.open encodeURI("http://mobile.twitter.com/#{twitterId}"), (status) ->
# Check for page load success
if status isnt 'success'
console.log 'Unable to access network'
else
# Execute some DOM inspection within the page context
page.evaluate ->
list = document.querySelectorAll 'span.status'
for i, j in list
console.log "#{j + 1}: #{i.innerHTML.replace /<.*?>/g, ''}"
phantom.exit()

View File

@ -1,7 +1,8 @@
// Get twitter status for given account (or for the default one, "sencha")
// Get twitter status for given account (or for the default one, "PhantomJS")
var page = require('webpage').create(),
twitterId = "sencha"; //< default value
system = require('system'),
twitterId = "PhantomJS"; //< default value
// Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this")
page.onConsoleMessage = function(msg) {
@ -9,10 +10,10 @@ page.onConsoleMessage = function(msg) {
};
// Print usage message, if no twitter ID is passed
if (phantom.args.length < 1) {
if (system.args.length < 2) {
console.log("Usage: tweets.js [twitter ID]");
} else {
twitterId = phantom.args[0];
twitterId = system.args[1];
}
// Heading
@ -26,9 +27,9 @@ page.open(encodeURI("http://mobile.twitter.com/" + twitterId), function (status)
} else {
// Execute some DOM inspection within the page context
page.evaluate(function() {
var list = document.querySelectorAll('span.status');
var list = document.querySelectorAll('div.tweet-text');
for (var i = 0; i < list.length; ++i) {
console.log((i + 1) + ": " + list[i].innerHTML.replace(/<.*?>/g, ''));
console.log((i + 1) + ": " + list[i].innerText);
}
});
}

10
examples/universe.js Normal file
View File

@ -0,0 +1,10 @@
// This is to be used by "module.js" (and "module.coffee") example(s).
// There should NOT be a "universe.coffee" as only 1 of the 2 would
// ever be loaded unless the file extension was specified.
exports.answer = 42;
exports.start = function () {
console.log('Starting the universe....');
}

View File

@ -1,18 +0,0 @@
# Modify global object at the page initialization.
# In this example, effectively Math.random() always returns 0.42.
page = require('webpage').create()
page.onInitialized = ->
page.evaluate ->
Math.random = ->
42 / 100
page.open "http://ariya.github.com/js/random/", (status) ->
if status != "success"
console.log "Network error."
else
console.log page.evaluate(->
document.getElementById("numbers").textContent
)
phantom.exit()

View File

@ -1,11 +0,0 @@
page = require('webpage').create()
console.log 'The default user agent is ' + page.settings.userAgent
page.settings.userAgent = 'SpecialAgent'
page.open 'http://www.httpuseragent.org', (status) ->
if status isnt 'success'
console.log 'Unable to access network'
else
console.log page.evaluate -> document.getElementById('myagent').innerText
phantom.exit()

View File

@ -1,5 +0,0 @@
console.log 'using PhantomJS version ' +
phantom.version.major + '.' +
phantom.version.minor + '.' +
phantom.version.patch
phantom.exit()

Some files were not shown because too many files have changed in this diff Show More