Commit Graph

744 Commits (master)

Author SHA1 Message Date
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
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 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 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 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
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 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
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
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
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
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
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
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
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
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
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 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 1e8b0a7336 WebServer: make sure status code is used for writeHead() function.
http://code.google.com/p/phantomjs/issues/detail?id=115
2011-12-21 07:59:39 -08:00
Ariya Hidayat f7675b1627 Clean-up of header includes in webserver.cpp. 2011-12-20 08:24:08 -08:00
Ariya Hidayat 7c07bd43d2 Include --proxy-type option in the usage.
http://code.google.com/p/phantomjs/issues/detail?id=266
2011-12-20 08:11:21 -08:00
Ariya Hidayat 5528c046db Some API changes in the WebServer module.
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
2011-12-19 18:38:21 -08:00
Ariya Hidayat f3277bc5e9 Explicitly disable directory listing in the web server.
This is for security, as leaking the directory structure is likely not
the use case of PhantomJS built-in server.

http://code.google.com/p/phantomjs/issues/detail?id=115
2011-12-19 18:01:19 -08:00
Ariya Hidayat 446abdbd7e Fix wrong exit code (regression).
http://code.google.com/p/phantomjs/issues/detail?id=294
2011-12-19 17:53:39 -08:00
Ariya Hidayat 471e12a375 JSLint fix: Combine all variable declarations. 2011-12-19 17:52:53 -08:00
Ariya Hidayat d5bc2b8192 Update CoffeeScript compiler to version 1.2.
http://code.google.com/p/phantomjs/issues/detail?id=312
2011-12-19 17:51:45 -08:00
Danny Wang 15ac9ab291 fixed TypeError when call e.url in page.onResourceRequested handler
http://code.google.com/p/phantomjs/issues/detail?id=305
2011-12-13 16:39:09 +08:00
Paul Tsier b10dc130ce Call qRegisterMetaType on mongoose types 2011-12-11 18:54:35 -08:00
Ariya Hidayat 3c0957834c used QUrl::fromEncoded() and QUrl::toEncoded() instead of QUrl(string) and QUrl::toString() when converting urls
Patch by Danny Wang: https://github.com/ariya/phantomjs/pull/183

http://code.google.com/p/phantomjs/issues/detail?id=301
2011-12-11 14:32:00 -08:00
Jon Leighton 38269c7b35 Workaround Qt 4.8 segfault 2011-12-06 20:25:52 +00:00
Ariya Hidayat ac95479424 Merge pull request #166 from jgornick/add-socks5-proxy
Added ability to specify SOCKS5 proxy type.

http://code.google.com/p/phantomjs/issues/detail?id=266
2011-11-21 20:47:56 -08:00
Jon Leighton 717c4af108 Explicitly link to libdl 2011-11-21 18:12:23 +00:00
Leo Franchi fbdbcd7f69 Minor fixes 2011-11-15 19:11:42 -05:00
Leo Franchi 610fb41922 Add support for remotely debugging a script.
This adds a new parameter --remote-debugger-port=<port>. When set,
phantomjs is operating in debug mode and will expose a webkit remote
debugger on the desired port. It can be attached to from any WebKit
browser on the given port and debugged.
2011-11-15 19:02:06 -05:00
Milian Wolff bd2052631f basic unit testing for WebServer.listen 2011-11-15 13:45:11 +01:00
Milian Wolff 5eaf705955 basic unit test for webserver 2011-11-15 13:45:11 +01:00
Milian Wolff 667c585424 don't deadlock, could happen on error
i.e. if we tried to listen to an already used port, the error
was propagated in the main thread and the blockingqueuedconnection
would deadlock. not anymore
2011-11-15 13:45:11 +01:00
Milian Wolff 36e8a3e87c cleanup api 2011-11-15 13:45:11 +01:00
Milian Wolff e5a35d6416 some API dox 2011-11-15 13:45:11 +01:00
Milian Wolff 6376ff0cb9 --debug 2011-11-15 13:45:11 +01:00
Milian Wolff a6bde751a9 extend WebServerResponse API 2011-11-15 13:45:11 +01:00
Milian Wolff 705eda8823 add read-properties to WebServerRequest 2011-11-15 13:45:11 +01:00
Milian Wolff 245eec551f make it possible to access the request headers 2011-11-15 13:45:11 +01:00
Milian Wolff f30bfa9fb7 extend WebServerRequest API 2011-11-15 13:45:11 +01:00
Milian Wolff 0abdc7f9ed very basic response + request handling for WebServer
the api is very limited but already makes the server.js example
do something useful with the server
2011-11-15 13:45:11 +01:00
Milian Wolff 73705e484b first work towards a WebServer
this is the minimal server that gets properly embedded into
the phantomjs space but the .listen api is missing actually
useful options (incoming request and ability to write to client)
2011-11-15 13:44:47 +01:00
Milian Wolff c3179c3dee move mongoose dir, use same setup like in gif folder 2011-11-15 13:38:01 +01:00
Aditya Ivaturi feed6fdc72 From now on including mongoose directly in the project 2011-11-15 13:38:01 +01:00
Aditya Ivaturi 2e43d7da15 Modified name of the shared lib generated 2011-11-15 13:38:01 +01:00
unknown 2b21135119 Fixed the make command for mingw 2011-11-15 13:38:01 +01:00
Aditya Ivaturi 71ffff002f Adding mongoose code & commented out parts in Makefile to skip the exe generation 2011-11-15 13:38:01 +01:00
Joe Gornick cd9f40b22d Merge branch 'master' of git://github.com/ariya/phantomjs into add-socks5-proxy 2011-11-08 23:23:28 -06:00
Joe Gornick d91c5af9b2 Added ability to specify SOCKS5 proxy type. 2011-11-08 21:58:48 -06:00
Ariya Hidayat f1b03e84d9 Bump the unstable version to 1.4. 2011-10-29 11:18:50 -05:00
Ariya Hidayat f18fd5372f Fix regression of onInitialized.
As suggested by Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>,
there is no need to use queued connection for initialized() slot.

http://code.google.com/p/phantomjs/issues/detail?id=264
2011-10-25 09:48:27 -05:00
Ivan De Marino 19b32cff0a Refactored and Centralised how we handle the loading of resource files.
* Some code reuse
* Centralised in Utils the loading of resource files
* It is safe to assume, when loading a resource file, that IT'S THERE and IT'S READABLE
* ALSO, I removed the unused 'shims' (we forgot them in there :P)
2011-10-16 20:35:21 +01:00
Ariya Hidayat fe20c0987d Avoid deleting a QWebPage inside its own signal emission.
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>.
2011-10-05 17:26:46 -07:00
Ariya Hidayat eb255817c5 Revert support for getting body of requests or responses.
This is causing a serious regression. For details, check out the
following issues:

http://code.google.com/p/phantomjs/issues/detail?id=158
http://code.google.com/p/phantomjs/issues/detail?id=238
2011-09-20 23:05:34 -07:00
Ariya Hidayat 2d0e4fc57c Fix copy paste mistake for HTTP authentication.
http://code.google.com/p/phantomjs/issues/detail?id=45
2011-09-16 17:36:27 -07:00
Ariya Hidayat 76de868075 Make HTTP authentication as page settings.
http://code.google.com/p/phantomjs/issues/detail?id=45
2011-09-16 17:34:02 -07:00
Ariya Hidayat 4544b129c9 Improve the API for mouse events.
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
2011-09-16 07:15:21 -07:00
Ariya Hidayat df93935d52 about:blank also needs document.head.
This makes it similar to what a typical web browser does.

http://code.google.com/p/phantomjs/issues/detail?id=235
2011-09-16 07:14:38 -07:00
Ariya Hidayat 5449251a6c Unify the name to 'cookiesFile' everywhere.
http://code.google.com/p/phantomjs/issues/detail?id=91
http://code.google.com/p/phantomjs/issues/detail?id=180
2011-09-15 09:40:22 -07:00