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
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
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
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
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
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
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.
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
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).
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.
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.
* 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)
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)
* 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.
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.