Commit Graph

1194 Commits (f386f7d48470a442e7ce7a89fc8cb4ca7daea5af)

Author SHA1 Message Date
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
Eivind Uggedal 38c3f862b3 Do not attempt to compile PhantomJS if the Qt compile failed.
http://code.google.com/p/phantomjs/issues/detail?id=226
2012-06-14 23:38:51 -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
Ariya Hidayat 37003332ac Merge pull request #267 from jonleighton/breakpad
Add a few more missing Makefiles.
2012-06-14 00:30:12 -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
Ariya Hidayat cd65c63af1 Merge pull request #263 from jonleighton/breakpad
Compile the breakpad client in directly.
2012-06-12 07:24:34 -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 fb7a5191f9 Merge pull request #261 from b-long/patch-1
Switched link for GhostDriver, since GitHub page appears to be missing.
2012-06-09 14:33:21 -07:00
Ariya Hidayat 293865ceeb Merge remote-tracking branch 'jonleighton/breakpad' 2012-06-08 11:15:32 +02:00
Jon Leighton 1b53adec2b Tweak the linux deploy script.
* Use exec to replace the bootstrap shell script
* Name the bootstrap shell script `phantomjs` so that invocation is no
  different

http://code.google.com/p/phantomjs/issues/detail?id=413
2012-06-08 11:10:56 +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
b.long ffb57958d2 Switched link for GhostDriver, since GitHub page appears to be missing. 2012-06-07 17:47:22 -03: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
Ariya Hidayat 7448af2f69 Merge pull request #254 from jonleighton/static_inspector
Fix remote inspector + static build.
2012-06-03 06:10:13 -07: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 ca60a58596 Fix a wrong module require in imagebin example.
http://code.google.com/p/phantomjs/issues/detail?id=536
http://code.google.com/p/phantomjs/issues/detail?id=276
2012-05-17 23:41:33 -07:00
Brikou CARRE 1125b86e72 Fixed missing exit code when errornous.
http://code.google.com/p/phantomjs/issues/detail?id=544
2012-05-17 23:35:02 -07: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 bf029ae65a Properly handle fourth CLI parameter in rasterize.js example.
After the change to system.args which has the app as first element,
the rasterize example was not properly adapted. Due to that, one
could not pass a size parameter to it anymore, resulting in PDFs
without page breaks.

ISSUE: 523 (http://code.google.com/p/phantomjs/issues/detail?id=523)
2012-05-02 15:31:46 +02:00
Milian Wolff b3d74c9a6c Extend printheaderfooter.js example documentation
The comment now explains how to delegate the header/footer setup
to the loaded HTML page by giving an explicit HTML example that
defines the required PhantomJSPrinting object

ISSUE: 512 (http://code.google.com/p/phantomjs/issues/detail?id=512)
2012-04-30 16:52:28 +07:00
Milian Wolff e185a5c2b6 Improve package-linux-dynamic.sh to create a quasi-static phantomjs.
The script now copies all required shared libraries found via ldd
to the deployment folder.

Furthermore, a run-script is created that runs the phantomjs binary
through the copied build-host's ld-linux.so to ensure all symbols
are properly resolved.

Last but not least, we now include a very slightly modified brandelf.c
from FreeBSD. This version can be compiled on Linux machines and is
used to change the ELF ABI of the binary and libs in the deployment
folder, such that they all use the old SYSV OS ABI for compatibility.

Usage:
$ package-linux-dynamic.sh
$ scp phantomjs-$version.tar.bz2 yourhost
$ ssh yourhost
$ tar -xf phantomjs-$version.tar.bz2
$ ./phantomjs-$version/phantomjs.sh

CC ISSUE: 413 (http://code.google.com/p/phantomjs/issues/detail?id=413)

(proper static build would still be desirable eventually if possible)
2012-04-25 19:36:00 +02:00
Milian Wolff 2c4e7b6a7e Properly pass --qt-config value from build.sh to src/qt/preconfig.sh.
This way one can properly cross-compile PhantomJS for different
platforms e.g. by passing --qt-config '-platform ...' to build.sh.

ISSUE: 507 (http://code.google.com/p/phantomjs/issues/detail?id=507)
2012-04-20 13:38:11 +02:00
Milian Wolff 3a84eb6d16 Reuse number of jobs configured in MAKEFLAGS env var if available
Especially on machines that are connected to a compile farm, the
MAKEFLAGS env var is usually set to configure the default number
of jobs that should be used. This way, one can just call the
PhantomJS build script without passing the number of jobs every
time.

ISSUE: 503 (http://code.google.com/p/phantomjs/issues/detail?id=503)
2012-04-18 14:19:43 +02:00
Ariya Hidayat d937e6e05a Fixed minor typo in README.md.
Thanks to Alessandro for spotting it.
2012-04-16 17:11:05 -07:00
Ariya Hidayat edc93dc8d0 Build system: do not assume 4 parallel jobs on Linux.
Try to grab the number of CPU cores from /proc/cpuinfo and use it as
the number of parallel make jobs (limit to 8 as a safety measure).

http://code.google.com/p/phantomjs/issues/detail?id=454
2012-04-15 18:21:02 -07:00
Ariya Hidayat 5a46423d28 Improve README.md regarding the contributors.
http://code.google.com/p/phantomjs/issues/detail?id=419
2012-04-15 11:27:22 -07: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