Commit Graph

744 Commits (master)

Author SHA1 Message Date
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 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
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 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 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
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
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
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
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 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
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
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
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
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 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
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 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
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 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
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
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 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 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
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 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 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 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
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
Ivan De Marino 7409ec62d0 Bumping version to "1.7.0 (development)" 2012-07-03 22:50:11 +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
Ivan De Marino 5ad891c2f3 Forgot to update completions for renderBase64 2012-06-24 19:40:41 -07: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
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
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
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
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
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 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
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
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
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 293865ceeb Merge remote-tracking branch 'jonleighton/breakpad' 2012-06-08 11:15:32 +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
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
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 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 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 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 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 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
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
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 173157555e Get ready for 1.5.0. 2012-03-19 23:47:04 -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 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 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 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
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