WebKit Bugzilla
Attachment 349608 Details for
Bug 189533
: Web Inspector: Cookies view should use model objects instead of raw payload data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189533-20180912181254.patch (text/plain), 6.79 KB, created by
Matt Baker
on 2018-09-12 18:12:59 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Matt Baker
Created:
2018-09-12 18:12:59 PDT
Size:
6.79 KB
patch
obsolete
>Subversion Revision: 235945 >diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index c071c6546cb507041306a3b6318f5edc6c096e4f..77b373737b755c8fdff7ec9e20a951717e42b06d 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,34 @@ >+2018-09-12 Matt Baker <mattbaker@apple.com> >+ >+ Web Inspector: Cookies view should use model objects instead of raw payload data >+ https://bugs.webkit.org/show_bug.cgi?id=189533 >+ <rdar://problem/44364183> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UserInterface/Models/Cookie.js: >+ (WI.Cookie.prototype.get type): >+ (WI.Cookie.prototype.get name): >+ (WI.Cookie.prototype.get value): >+ (WI.Cookie.prototype.get raw): >+ (WI.Cookie.prototype.get expires): >+ (WI.Cookie.prototype.get session): >+ (WI.Cookie.prototype.get size): >+ (WI.Cookie.prototype.get maxAge): >+ (WI.Cookie.prototype.get path): >+ (WI.Cookie.prototype.get domain): >+ (WI.Cookie.prototype.get secure): >+ (WI.Cookie.prototype.get httpOnly): >+ (WI.Cookie.prototype.get sameSite): >+ (WI.Cookie.fromPayload): >+ (WI.Cookie.prototype.expirationDate): >+ (WI.Cookie): >+ Some cleanup: added fromPayload, calculate size if missing, and use >+ getters instead of direct properties. >+ >+ * UserInterface/Views/CookieStorageContentView.js: >+ (WI.CookieStorageContentView.prototype.update): >+ > 2018-09-12 Joseph Pecoraro <pecoraro@apple.com> > > Web Inspector: fix test case failures in js-isLikelyStackTrace.html >diff --git a/Source/WebInspectorUI/UserInterface/Models/Cookie.js b/Source/WebInspectorUI/UserInterface/Models/Cookie.js >index 46729426955016bd806d200d9124fcbb4498db4e..4e2dc50b4a2619c7c8ae4dd37242cd0bc59f2497 100644 >--- a/Source/WebInspectorUI/UserInterface/Models/Cookie.js >+++ b/Source/WebInspectorUI/UserInterface/Models/Cookie.js >@@ -25,13 +25,15 @@ > > WI.Cookie = class Cookie > { >- constructor(type, name, value, raw, expires, maxAge, path, domain, secure, httpOnly, sameSite) >+ constructor(type, name, value, {raw, session, expires, size, maxAge, path, domain, secure, httpOnly, sameSite} = {}) > { > console.assert(Object.values(WI.Cookie.Type).includes(type)); > console.assert(typeof name === "string"); > console.assert(typeof value === "string"); > console.assert(!raw || typeof raw === "string"); > console.assert(!expires || expires instanceof Date); >+ console.assert(!session || !expires); >+ console.assert(!size || typeof size === "number"); > console.assert(!maxAge || typeof maxAge === "number"); > console.assert(!path || typeof path === "string"); > console.assert(!domain || typeof domain === "string"); >@@ -39,36 +41,52 @@ WI.Cookie = class Cookie > console.assert(!httpOnly || typeof httpOnly === "boolean"); > console.assert(!sameSite || Object.values(WI.Cookie.SameSiteType).includes(sameSite)); > >- this.type = type; >- this.name = name || ""; >- this.value = value || ""; >- >- if (this.type === WI.Cookie.Type.Response) { >- this.rawHeader = raw || ""; >- this.expires = expires || null; >- this.maxAge = maxAge || null; >- this.path = path || null; >- this.domain = domain || null; >- this.secure = secure || false; >- this.httpOnly = httpOnly || false; >- this.sameSite = sameSite || WI.Cookie.SameSiteType.None; >+ this._type = type; >+ this._name = name || ""; >+ this._value = value || ""; >+ this._size = size || this._name.length + this._value.length; >+ >+ if (this._type === WI.Cookie.Type.Response) { >+ this._raw = raw || ""; >+ this._expires = expires || null; >+ this._session = !this._expires; >+ this._maxAge = maxAge || null; >+ this._path = path || null; >+ this._domain = domain || null; >+ this._secure = secure || false; >+ this._httpOnly = httpOnly || false; >+ this._sameSite = sameSite || WI.Cookie.SameSiteType.None; > } > } > > // Public > >- expirationDate(requestSentDate) >+ get type() { return this._type; } >+ get name() { return this._name; } >+ get value() { return this._value; } >+ get raw() { return this._raw; } >+ get expires() { return this._expires; } >+ get session() { return this._session; } >+ get size() { return this._size; } >+ get maxAge() { return this._maxAge; } >+ get path() { return this._path; } >+ get domain() { return this._domain; } >+ get secure() { return this._secure; } >+ get httpOnly() { return this._httpOnly; } >+ get sameSite() { return this._sameSite; } >+ >+ // Static >+ >+ static fromPayload(payload) > { >- if (this.maxAge) { >- let startDate = requestSentDate || new Date; >- return new Date(startDate.getTime() + (this.maxAge * 1000)); >- } >+ let expires; >+ if (!payload.session && payload.expires) >+ expires = new Date(payload.expires); > >- return this.expires; >+ let {raw, size, maxAge, path, domain, secure, httpOnly, sameSite} = payload; >+ return new WI.Cookie(WI.Cookie.Type.Response, payload.name, payload.value, {raw, expires, size, maxAge, path, domain, secure, httpOnly, sameSite}); > } > >- // Static >- > // RFC 6265 defines the HTTP Cookie and Set-Cookie header fields: > // https://www.ietf.org/rfc/rfc6265.txt > >@@ -214,6 +232,16 @@ WI.Cookie = class Cookie > > return new WI.Cookie(WI.Cookie.Type.Response, name, value, header, expires, maxAge, path, domain, secure, httpOnly, sameSite); > } >+ >+ expirationDate(requestSentDate) >+ { >+ if (this.maxAge) { >+ let startDate = requestSentDate || new Date; >+ return new Date(startDate.getTime() + (this.maxAge * 1000)); >+ } >+ >+ return this.expires; >+ } > }; > > WI.Cookie.Type = { >diff --git a/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js b/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js >index 0f6f62716fc53ffc63bcadd24786b77c006e91fd..4ebf50808da679fbb28f8122667a8ace0f3c37b6 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js >@@ -47,7 +47,7 @@ WI.CookieStorageContentView = class CookieStorageContentView extends WI.ContentV > update() > { > PageAgent.getCookies().then((payload) => { >- this._cookies = this._filterCookies(payload.cookies); >+ this._cookies = this._filterCookies(payload.cookies.map(WI.Cookie.fromPayload)); > this._rebuildTable(); > }).catch((error) => { > console.error("Could not fetch cookies: ", error);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189533
:
349496
|
349518
|
349608
|
349617
|
349632
|
349633
|
354298
|
356635
|
356679
|
356690
|
356691
|
356697
|
357293