Commit Graph

21 Commits (master)

Author SHA1 Message Date
Ariya Hidayat 48fabe0646 Remove CoffeeScript support.
https://github.com/ariya/phantomjs/issues/12410
2014-07-30 01:29:21 -07:00
Joseph Rollinson 244cf251cd Adds support for multiple Cookie Jars.
Previously, there was a single global cookie jar shared between all web pages.
Now, one can have separate cookie jars for different web pages.

Makes CookieJar a normal class, not a singleton.
Moves many public CookieJar methods to public slots.
Adds default cookie jar to Phantom.
Adds the CookieJar module that provides access to cookie jars in javascript.
Adds cookie jar module tests.

Usage:
var jar = require('cookiejar').create();
var webpage = require('webpage').create();
webpage.cookieJar = jar;
...
webpage.close();
jar.close();

JS API changes:
Webpage:
    var jar = page.cookieJar; -- assigns 'jar' the given webpage's cookie jar.
    page.cookiejar = jar; -- sets 'jar' as the given webpage's cookie jar.
CookieJar:
    var jar = require('cookiejar').create(path)
        creates a cookie jar with persistent storage at the given file path
        (path not mandatory).
    var cookies = jar.cookies; -- assign's 'jar' the list of cookies in the
        cookie jar.
    jar.cookies = [c1, c2]; -- sets the cookie jar's cookies as the ones in the
        list.
    jar.addCookie(cookie) -- adds cookie 'cookie' to the cookie jar.

https://github.com/ariya/phantomjs/issues/11417
2014-01-10 16:12:39 -08:00
execjosh f52044cd31 Emulate spawn and execFile from node.js's child_process module
This is a rudimentary implementation of the following methods
from [node.js's `child_process` module][1]:

 *  `spawn`
 *  `execFile`

The examples are relevant only for *nix operating systems...

The following methods are Not Yet Implemented™:

 *  `exec`
 *  `fork`

[1]: http://nodejs.org/docs/v0.8.16/api/child_process.html

http://code.google.com/p/phantomjs/issues/detail?id=219
2012-12-29 01:03:08 +09: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
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
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
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
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
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 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
Ariya Hidayat b6102d7f6e Refactoring on the module implementation.
This is mostly based on Ivan's work, see
https://github.com/ariya/phantomjs/pull/153

http://code.google.com/p/phantomjs/issues/detail?id=47
2011-09-11 01:04:53 -07:00
Ariya Hidayat 2b83a52251 Implement require('webpage').
This is mostly based on Ivan's work, see
https://github.com/ariya/phantomjs/pull/153

window.WebPage still works, it is not recommended and will be
deprecated.

http://code.google.com/p/phantomjs/issues/detail?id=47
2011-09-08 17:32:31 -07:00
Ariya Hidayat 6a79ea7e6d Implement require('fs').
This is mostly based on Ivan's work, see
https://github.com/ariya/phantomjs/pull/153

http://code.google.com/p/phantomjs/issues/detail?id=47
2011-09-08 10:00:07 -07:00
Ivan De Marino 8c15c80b14 Renamed "fs-shim.js" to "fileystem-shim.js" to ensure name consistency. 2011-09-04 21:26:11 +01:00
Ivan De Marino 3401dd9f78 Refactored the JS Shims to be isolated in their own file.
Also, refactored some "too cautious" code to load the shim.

PS I don't grasp 100% the point of "Terminal". Wouldn't qDebug() be enough? What am I missing?
2011-08-31 23:19:17 +01:00
execjosh 26f7185bf6 Implement JSON config loader 2011-08-30 00:43:41 +09:00
Ariya Hidayat f5e070d444 Store bootstrap code in its own file. 2011-05-26 02:18:09 -07:00
Ivan De Marino f86bc38bc1 Separated the "usage" instructions in a text file, embedded as "resource".
Also:
* I added a couple of "qFatal" where it makes sense.
* Usage now mentions the fact that the input files that finish by ".coffee" are also acceptable
2011-03-24 22:43:49 +00:00
Ariya Hidayat 158362ed16 Start to implement support for CoffeeScript. 2011-03-02 00:59:07 -08:00
Ariya Hidayat 03297410cd Attach the icon the application main widget. 2010-12-26 23:56:44 -08:00