Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js

Issue 2623063003: DevTools: Fix getCookies to report for all resources (Closed)
Patch Set: rebase master Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js b/third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js
index 118b790caf17b8b40b0319b7bd598ef44427c787..3a0f35825a7d35474ede246905575c73f4ff55e7 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js
@@ -365,28 +365,19 @@ SDK.Cookie.Type = {
SDK.Cookies = {};
/**
+ * @param {!SDK.Target} target
+ * @param {!Array.<string>} urls
* @param {function(!Array.<!SDK.Cookie>)} callback
*/
-SDK.Cookies.getCookiesAsync = function(callback) {
- var allCookies = [];
- /**
- * @param {!SDK.Target} target
- * @param {?Protocol.Error} error
- * @param {!Array.<!Protocol.Network.Cookie>} cookies
- */
- function mycallback(target, error, cookies) {
- if (error) {
- console.error(error);
- return;
+SDK.Cookies.getCookiesAsync = function(target, urls, callback) {
+ target.networkAgent().getCookies(urls, (err, cookies) => {
+ if (err) {
+ console.error(err);
+ return callback([]);
}
- for (var i = 0; i < cookies.length; ++i)
- allCookies.push(SDK.Cookies._parseProtocolCookie(target, cookies[i]));
- }
- var barrier = new CallbackBarrier();
- for (var target of SDK.targetManager.targets(SDK.Target.Capability.Network))
- target.networkAgent().getCookies(barrier.createCallback(mycallback.bind(null, target)));
- barrier.callWhenDone(callback.bind(null, allCookies));
+ callback(cookies.map(cookie => SDK.Cookies._parseProtocolCookie(target, cookie)));
+ });
};
/**
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698