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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/audits/AuditRules.js

Issue 2623063003: DevTools: Fix getCookies to report for all resources (Closed)
Patch Set: audit and line length fixes 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 function resultCallback(receivedCookies) { 1307 function resultCallback(receivedCookies) {
1308 if (progress.isCanceled()) { 1308 if (progress.isCanceled()) {
1309 callback(result); 1309 callback(result);
1310 return; 1310 return;
1311 } 1311 }
1312 1312
1313 self.processCookies(receivedCookies, requests, result); 1313 self.processCookies(receivedCookies, requests, result);
1314 callback(result); 1314 callback(result);
1315 } 1315 }
1316 1316
1317 SDK.Cookies.getCookiesAsync(resultCallback); 1317 const nonDataUrls = requests.map(r => r.url()).filter(url => url && !/^data: /.test(url));
pfeldman 2017/01/13 02:17:34 Use ParsedURL to figure out url type.
phulce 2017/01/18 00:52:34 Done.
1318 SDK.Cookies.getCookiesAsync(target, nonDataUrls, resultCallback);
1318 } 1319 }
1319 1320
1320 mapResourceCookies(requestsByDomain, allCookies, callback) { 1321 mapResourceCookies(requestsByDomain, allCookies, callback) {
1321 for (var i = 0; i < allCookies.length; ++i) { 1322 for (var i = 0; i < allCookies.length; ++i) {
1322 for (var requestDomain in requestsByDomain) { 1323 for (var requestDomain in requestsByDomain) {
1323 if (SDK.Cookies.cookieDomainMatchesResourceDomain(allCookies[i].domain() , requestDomain)) 1324 if (SDK.Cookies.cookieDomainMatchesResourceDomain(allCookies[i].domain() , requestDomain))
1324 this._callbackForResourceCookiePairs(requestsByDomain[requestDomain], allCookies[i], callback); 1325 this._callbackForResourceCookiePairs(requestsByDomain[requestDomain], allCookies[i], callback);
1325 } 1326 }
1326 } 1327 }
1327 } 1328 }
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 1483
1483 /** 1484 /**
1484 * @param {!Object<string, number>} matchingResourceData 1485 * @param {!Object<string, number>} matchingResourceData
1485 * @param {!SDK.NetworkRequest} request 1486 * @param {!SDK.NetworkRequest} request
1486 * @param {!SDK.Cookie} cookie 1487 * @param {!SDK.Cookie} cookie
1487 */ 1488 */
1488 _collectorCallback(matchingResourceData, request, cookie) { 1489 _collectorCallback(matchingResourceData, request, cookie) {
1489 matchingResourceData[request.url()] = (matchingResourceData[request.url()] | | 0) + cookie.size(); 1490 matchingResourceData[request.url()] = (matchingResourceData[request.url()] | | 0) + cookie.size();
1490 } 1491 }
1491 }; 1492 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698