Commit Graph

38 Commits (master)

Author SHA1 Message Date
Vitaliy Filippov cef6c84e00 Make qphantom platform plugin static and adjust build scripts 2015-02-15 12:39:07 +03:00
Vitaliy Filippov f37c7e29e0 Remove QT source and make phantomjs compile with unmodified QT, fix binary encoding of web response 2015-02-07 01:48:33 +03:00
Zack Weinberg 858972e7ef Convert Utils into a namespace and remove dead code.
Post-cleanup for #12236.
2014-08-28 11:42:09 -04:00
Zack Weinberg 2ab57b875e Improve handling of crash dumps (issue #12236).
* If the environment variable PHANTOMJS_DISABLE_CRASH_DUMPS
   is set to any value, do not initialize Breakpad.

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

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

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

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

 * Generally less repetitive code.  (Still way too many #ifdefs.)
2014-08-28 11:41:50 -04:00
Zack Weinberg 5b5e63af23 Better Qt version check.
* Allow any patchlevel of Qt 5.3.x.
 * Do it in the master .pro file instead of main.cpp; this makes the build
   fail immediately rather than after compiling a bunch of stuff.

Part of issue #12467.
2014-08-19 07:20:48 -07:00
Milian Wolff 4bf75c50b0 Simplify Env code by reusing QProcessEnvironment.
This gets rid of the custom parse code and slims down the API.

https://github.com/ariya/phantomjs/issues/12424
2014-08-15 21:49:46 -07:00
Vitaliy Slobodin cf12fc4a23 Long live PhantomJS 2!
https://github.com/ariya/phantomjs/issues/10448
2014-07-27 07:47:34 -07:00
Vitaliy Slobodin 6a01a8dece Upgrade to Qt 4.8.5
https://github.com/ariya/phantomjs/issues/11452
2013-10-19 07:52:31 -07:00
execjosh f8a905c8b0 Link with text codec plugins on mac and linux
Fixes [#10249](https://github.com/ariya/phantomjs/issues/10249)
2013-04-22 22:35:56 -07:00
Jon Leighton eb3c9caa6e Upgrade to Qt 4.8.4
http://code.google.com/p/phantomjs/issues/detail?id=918
2012-12-12 21:42:45 -08:00
Jon Leighton 66ab9a1113 Fix memory leak on linux
We were previously adding the certificates on each instantiation of
NetworkAccessManager, causing memory consumption to grow unbounded.

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

https://code.google.com/p/phantomjs/issues/detail?id=882
2012-12-12 21:25:26 -08:00
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
Vitaliy Slobodin af49821cf4 Render ICO images on Windows.
ICO images are not rendered on Windows due to missing ICO plugin.

Issue: http://code.google.com/p/phantomjs/issues/detail?id=779
2012-09-17 10:46:49 +04:00
Ariya Hidayat 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
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 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
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
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
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
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
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
Jon Leighton 8f7ee0ecd8 Integrate Google Breakpad crash reporter. Linux only for now. 2012-06-05 23:08:16 +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 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 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 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
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 195bb7238c Only support Qt >= 4.7.
http://code.google.com/p/phantomjs/issues/detail?id=272
2011-12-23 21:18:14 -08:00
Ivan De Marino d8d88a3894 Added "Copyright..." line to files on which I worked on.
I tried to also add/remove based on the git history.
2011-08-31 16:29:40 +01:00
Ariya Hidayat f25a7a66e5 Bump the Qt requirement to version >= 4.6.
Also, remove code branch for Qt 4.5.
2011-06-26 21:51:30 -07:00
Ariya Hidayat 78856f8d51 Fix a regression where exit() function does not work.
http://code.google.com/p/phantomjs/issues/detail?id=119
2011-06-17 17:43:47 -07:00
Ivan De Marino bd18d7c838 More work on "injectJs"
* "injectJs()" now supports ".coffee" input
* "injectJs()" is now available for the "phantom" object as well
* CSConverter is now a singleton embedded in the Utils static class
* The code used by "injectJs()" is now centralised in the Utils static class
2011-06-10 17:08:46 +01:00
Ariya Hidayat d15e097815 Refactor most of functionalities to WebPage object.
This breaks all examples (will be fixed slowly). Some features, e.g.
file upload, are also still regressed.
2011-05-25 10:49:35 -07:00
Ivan De Marino c616205620 Added a Qt Message Handler (finally). 2011-04-08 15:49:20 +01:00
Ivan De Marino a45b8e8401 Major refactoring of the CPP code into separate classes.
This doesn't add ANY new feature: it's aimed only at separating code into
more manageable pieces.

Maybe it's not perfect yet, but it's a start.
2011-04-08 14:30:50 +01:00