phantomjs/test
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
..
fixtures Error.stack returns a string to match V8/Node.js 2012-06-10 21:28:46 +01:00
lib Add require() tests and comment buggy test in fs-spec-03.js 2012-07-12 23:14:12 -07:00
node_modules Add require() tests and comment buggy test in fs-spec-03.js 2012-07-12 23:14:12 -07:00
require Remove old module tests 2012-07-12 23:14:12 -07:00
webpage-spec-frames Adding the ability to switch between frames. 2012-06-15 00:07:53 -07:00
dummy.js Add require() tests and comment buggy test in fs-spec-03.js 2012-07-12 23:14:12 -07:00
fs-spec-01.js Adding property "page.ownsPages". 2012-09-04 09:49:24 -07:00
fs-spec-02.js Added "touch(path)" to the FS API 2011-09-01 00:34:55 +01:00
fs-spec-03.js Fixed an annoying FileSytem test that was wrongly designed (by me). 2012-07-13 09:52:35 -07:00
fs-spec-04.js Filesystem API: completed the "Tests" API group from CommonJS/Filesystem definition. 2011-08-08 23:42:11 +01:00
module_spec.js Fix indentation to 4 spaces in new require() tests 2012-07-12 23:14:12 -07:00
phantom-spec.js Redesign the Cookies API 2012-09-07 00:03:03 -07:00
process_spec.js Add require() tests and comment buggy test in fs-spec-03.js 2012-07-12 23:14:12 -07:00
run-tests.js Merge phantomjs-nodify's require() and fix tests 2012-07-12 23:14:12 -07:00
system-spec.js Add 'isSSLSupported' to the system module. 2012-09-03 06:50:34 -07:00
webpage-spec.js Redesign the Cookies API (part 2) 2012-09-18 08:42:13 +01:00
webserver-spec.js Option to pass "headers" when using "open()" on "webpage" module. 2012-03-23 11:48:16 +00:00