From 7b07c1af87a241ce4a5e552132c2f4877a4cf1ba Mon Sep 17 00:00:00 2001 From: Tomohiro Hosaka Date: Wed, 16 Jan 2019 14:14:43 +0900 Subject: [PATCH 1/3] add t/99-cookie_file.t. make sure cookie_file is not saved. The cause is next. https://github.com/detro/ghostdriver/commit/e4014102cdf77d8cba2574ac4d8c74b612d12532#diff-10fa903ea8e32a976743fb107ac3ee1dR500 --- t/99-cookie_file.t | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 t/99-cookie_file.t diff --git a/t/99-cookie_file.t b/t/99-cookie_file.t new file mode 100644 index 0000000..c7aa459 --- /dev/null +++ b/t/99-cookie_file.t @@ -0,0 +1,12 @@ +#!perl -w +use strict; +use Test::More tests => 1; +use File::Temp; +use WWW::Mechanize::PhantomJS; + +my $tmp = File::Temp->new; +my $mech = WWW::Mechanize::PhantomJS->new( + cookie_file => $tmp->filename, +); +$mech->get_local('99-cookie_file.html'); +ok -s $tmp->filename > 0, "cookie_file saved."; From 133b3b58cdb506c3746b1a54981c515c4241d84b Mon Sep 17 00:00:00 2001 From: Tomohiro Hosaka Date: Wed, 16 Jan 2019 15:13:37 +0900 Subject: [PATCH 2/3] comment out "session-specific CookieJar" at ghostdriver/session.js --- lib/WWW/Mechanize/PhantomJS/ghostdriver/session.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/WWW/Mechanize/PhantomJS/ghostdriver/session.js b/lib/WWW/Mechanize/PhantomJS/ghostdriver/session.js index f579917..9cb4ef4 100644 --- a/lib/WWW/Mechanize/PhantomJS/ghostdriver/session.js +++ b/lib/WWW/Mechanize/PhantomJS/ghostdriver/session.js @@ -413,7 +413,7 @@ ghostdriver.Session = function(desiredCapabilities) { // decorate the new Window/Page newPage = _decorateNewWindow(newPage); // set session-specific CookieJar - newPage.cookieJar = _cookieJar; + // newPage.cookieJar = _cookieJar; // store the Window/Page by WindowHandle _windows[newPage.windowHandle] = newPage; }, @@ -657,7 +657,7 @@ ghostdriver.Session = function(desiredCapabilities) { // Decorate it with listeners and helpers page = _decorateNewWindow(page); // set session-specific CookieJar - page.cookieJar = _cookieJar; + // page.cookieJar = _cookieJar; // Make the new Window, the Current Window _currentWindowHandle = page.windowHandle; // Store by WindowHandle @@ -789,7 +789,7 @@ ghostdriver.Session = function(desiredCapabilities) { } // Release CookieJar resources - _cookieJar.close(); + // _cookieJar.close(); }, _getLog = function (type) { From f3a01cc1e3ea2da3e433907390bc47edb56eed70 Mon Sep 17 00:00:00 2001 From: Tomohiro Hosaka Date: Wed, 16 Jan 2019 17:14:02 +0900 Subject: [PATCH 3/3] add t/99-cookie_file.html --- t/99-cookie_file.html | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 t/99-cookie_file.html diff --git a/t/99-cookie_file.html b/t/99-cookie_file.html new file mode 100644 index 0000000..7fe41bb --- /dev/null +++ b/t/99-cookie_file.html @@ -0,0 +1,3 @@ +