WebKit Bugzilla
Attachment 349496 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-20180911172911.patch (text/plain), 5.76 KB, created by
Matt Baker
on 2018-09-11 17:29:14 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Matt Baker
Created:
2018-09-11 17:29:14 PDT
Size:
5.76 KB
patch
obsolete
>Subversion Revision: 235920 >diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index beed0a4f970191c6ced6780d773552b2ca4fdea2..dbb47b67a89c7e55e458e93d00e788092891fffe 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,34 @@ >+2018-09-11 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!). >+ >+ Cleanup the Cookie model class to use getters instead of public variables, >+ and use it throughout the CookiesStorageContentView instead of raw payload data. >+ >+ * UserInterface/Models/Cookie.js: >+ (WI.Cookie): >+ (WI.Cookie.prototype.get type): >+ (WI.Cookie.prototype.get name): >+ (WI.Cookie.prototype.get value): >+ (WI.Cookie.prototype.get rawHeader): >+ (WI.Cookie.prototype.get expires): >+ (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): >+ >+ * UserInterface/Views/CookieStorageContentView.js: >+ (WI.CookieStorageContentView.prototype.update): >+ (WI.CookieStorageContentView.prototype._rebuildTable): >+ > 2018-09-11 Joseph Pecoraro <pecoraro@apple.com> > > Web Inspector: Fix typo "vritualized" >diff --git a/Source/WebInspectorUI/UserInterface/Models/Cookie.js b/Source/WebInspectorUI/UserInterface/Models/Cookie.js >index 46729426955016bd806d200d9124fcbb4498db4e..19ccd7e17f8cec307bf8fc596f4ec0718ccfa5c3 100644 >--- a/Source/WebInspectorUI/UserInterface/Models/Cookie.js >+++ b/Source/WebInspectorUI/UserInterface/Models/Cookie.js >@@ -39,24 +39,38 @@ 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 = this._name.length + this._value.length; >+ >+ 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; > } > } > > // Public > >+ get type() { return this._type; } >+ get name() { return this._name; } >+ get value() { return this._value; } >+ get rawHeader() { return this._rawHeader; } >+ get expires() { return this._expires; } >+ 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; } >+ > expirationDate(requestSentDate) > { > if (this.maxAge) { >@@ -69,6 +83,14 @@ WI.Cookie = class Cookie > > // Static > >+ static fromPayload(payload) >+ { >+ console.assert(payload.session || payload.expires instanceof Date); >+ let expires = payload.session ? null : new Date(payload.expires); >+ >+ return new WI.Cookie(WI.Cookie.Type.Response, payload.name, payload.value, payload.raw, expires, payload.maxAge, payload.path, payload.domain, payload.secure, payload.httpOnly, payload.sameSite); >+ } >+ > // RFC 6265 defines the HTTP Cookie and Set-Cookie header fields: > // https://www.ietf.org/rfc/rfc6265.txt > >diff --git a/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js b/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js >index 0f6f62716fc53ffc63bcadd24786b77c006e91fd..0f85217c460fa5639fd45232b64fffaab5c79c94 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); >@@ -144,7 +144,7 @@ WI.CookieStorageContentView = class CookieStorageContentView extends WI.ContentV > }; > > if (cookie.type !== WI.CookieType.Request) >- data["expires"] = cookie.session ? WI.UIString("Session") : new Date(cookie.expires).toLocaleString(); >+ data["expires"] = cookie.expires ? new Date(cookie.expires).toLocaleString() : WI.UIString("Session"); > > var node = new WI.DataGridNode(data); > node.cookie = cookie;
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