Port the tests of the cookiejar module.

https://github.com/ariya/phantomjs/issues/12439