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
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).
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)
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
commit c373ac4d17
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 bf24d4d1ec
Author: Danny Wang <wangyang0123@gmail.com>
Date: Tue Apr 10 08:54:55 2012 +0800
fixed defects in evaluate() pointed out by detro
commit 0bb8cff780
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
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 dd5fab4778
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 4113995113
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 e45673486e
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.
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)
Trying to match http://nodejs.org/docs/latest/api/http.html.
For the server response:
* Change writeBody to write
* Change writeHeaders to writeHead
For the request object, 'headers' is now an object containing all
key-value pairs of the actual HTTP headers.
'queryString' is folded into 'url' key.
Non-standard keys in the request: isSSL, remotePort, remoteIP,
remoteUser, are disabled in the mean-time (will be revisited after 1.4
release).
Implementation-wise, the request object is now a simple key-value pair
using QVariant, as opposed to the heavy QObject instance.
http://code.google.com/p/phantomjs/issues/detail?id=115
If Phantom.exit() is called inside the handler for loadFinished(), we
end up in a situation that QWebPage is deleting itself during a signal
emission. This used to be OK in QtWebKit 2.0 (Qt 4.7) but is not OK for
QtWebKit 2.2 (upcoming Qt 4.8).
http://code.google.com/p/phantomjs/issues/detail?id=251
Patch by Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>.
Tests Japanese (Shift_JIS, EUC-JP, ISO-2022-JP) and Chinese
(Big5, GBK). Easy to extend with more data.
It will currently fail with static builds of PhantomJS, but
pass with dynamic ones.
It now looks like in this example:
page.sendEvent('mousedown', 42, 217);
Other available events are 'mouseup', 'mousemove', and 'click'. They modelled
after the DOM events.
Unit tests are included.
http://code.google.com/p/phantomjs/issues/detail?id=234
* This is the last API
* I added tests accordingly
* Test could be improved with a proper recursive comparison
* Or, if we introduce "phantom.exec", we could just run a "diff -rq" :)
* Tests for this new API are also provided
* The 'fs.size()' method is implemented with a shim in 'bootstrap.js' to cover the exception throwing behaviour