From c164da5a388b54c61e221b707ca3b7186b883259 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 19 Jun 2015 14:18:22 +0800 Subject: [PATCH] Make cookie aligns to Chrome's. --- atom/browser/api/atom_api_cookies.cc | 2 +- docs/api/browser-window.md | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/atom/browser/api/atom_api_cookies.cc b/atom/browser/api/atom_api_cookies.cc index 6f59cd25bbe1..4a0060efa537 100644 --- a/atom/browser/api/atom_api_cookies.cc +++ b/atom/browser/api/atom_api_cookies.cc @@ -161,8 +161,8 @@ struct Converter { mate::Dictionary dict(isolate, v8::Object::New(isolate)); dict.Set("name", val.Name()); dict.Set("value", val.Value()); - dict.Set("source", val.Source()); dict.Set("domain", val.Domain()); + dict.Set("host_only", net::cookie_util::DomainIsHostOnly(val.Domain())); dict.Set("path", val.Path()); dict.Set("secure", val.IsSecure()); dict.Set("http_only", val.IsHttpOnly()); diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 01298ce4dea4..2c41200da2bd 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -1069,7 +1069,20 @@ win.webContents.on('did-finish-load', function() { * `session` Boolean - Filters out session or persistent cookies. * `callback` Function - function(error, cookies) * `error` Error - * `cookies` Array - array of cookie objects. + * `cookies` Array - array of `cookie` objects. + * `cookie` - Object + * `name` String - The name of the cookie + * `value` String - The value of the cookie + * `domain` String - The domain of the cookie + * `host_only` String - Whether the cookie is a host-only cookie + * `path` String - The path of the cookie + * `secure` Boolean - Whether the cookie is marked as Secure (typically HTTPS) + * `http_only` Boolean - Whether the cookie is marked as HttpOnly + * `session` Boolean - Whether the cookie is a session cookie or a persistent + * cookie with an expiration date. + * `expirationDate` Double - (Option) The expiration date of the cookie as + the number of seconds since the UNIX epoch. Not provided for session cookies. + ### WebContents.session.cookies.set(details, callback)