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

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

Issue 2627073003: [Devtools] Fixed url in Audits and added doctypes (Closed)
Patch Set: fixed audits 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 processedResources[0].push(request); 592 processedResources[0].push(request);
593 } 593 }
594 return processedResources; 594 return processedResources;
595 } 595 }
596 596
597 execCheck(messageText, requestCheckFunction, requests, result) { 597 execCheck(messageText, requestCheckFunction, requests, result) {
598 var requestCount = requests.length; 598 var requestCount = requests.length;
599 var urls = []; 599 var urls = [];
600 for (var i = 0; i < requestCount; ++i) { 600 for (var i = 0; i < requestCount; ++i) {
601 if (requestCheckFunction.call(this, requests[i])) 601 if (requestCheckFunction.call(this, requests[i]))
602 urls.push(requests[i].url); 602 urls.push(requests[i].url());
603 } 603 }
604 if (urls.length) { 604 if (urls.length) {
605 var entry = result.addChild(messageText, true); 605 var entry = result.addChild(messageText, true);
606 entry.addURLs(urls); 606 entry.addURLs(urls);
607 result.violationCount += urls.length; 607 result.violationCount += urls.length;
608 } 608 }
609 } 609 }
610 610
611 /** 611 /**
612 * @param {!SDK.NetworkRequest} request 612 * @param {!SDK.NetworkRequest} request
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 * @override 736 * @override
737 */ 737 */
738 handleNonCacheableResources(requests, result) { 738 handleNonCacheableResources(requests, result) {
739 if (requests.length) { 739 if (requests.length) {
740 var entry = result.addChild( 740 var entry = result.addChild(
741 Common.UIString( 741 Common.UIString(
742 'The following resources are explicitly non-cacheable. Consider ma king them cacheable if possible:'), 742 'The following resources are explicitly non-cacheable. Consider ma king them cacheable if possible:'),
743 true); 743 true);
744 result.violationCount += requests.length; 744 result.violationCount += requests.length;
745 for (var i = 0; i < requests.length; ++i) 745 for (var i = 0; i < requests.length; ++i)
746 entry.addURL(requests[i].url); 746 entry.addURL(requests[i].url());
747 } 747 }
748 } 748 }
749 749
750 runChecks(requests, result, callback) { 750 runChecks(requests, result, callback) {
751 this.execCheck( 751 this.execCheck(
752 Common.UIString( 752 Common.UIString(
753 'The following resources are missing a cache expiration. Resources t hat do not specify an expiration may not be cached by browsers:'), 753 'The following resources are missing a cache expiration. Resources t hat do not specify an expiration may not be cached by browsers:'),
754 this._missingExpirationCheck, requests, result); 754 this._missingExpirationCheck, requests, result);
755 this.execCheck( 755 this.execCheck(
756 Common.UIString( 756 Common.UIString(
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 if (SDK.Cookies.cookieDomainMatchesResourceDomain(allCookies[i].domain() , requestDomain)) 1323 if (SDK.Cookies.cookieDomainMatchesResourceDomain(allCookies[i].domain() , requestDomain))
1324 this._callbackForResourceCookiePairs(requestsByDomain[requestDomain], allCookies[i], callback); 1324 this._callbackForResourceCookiePairs(requestsByDomain[requestDomain], allCookies[i], callback);
1325 } 1325 }
1326 } 1326 }
1327 } 1327 }
1328 1328
1329 _callbackForResourceCookiePairs(requests, cookie, callback) { 1329 _callbackForResourceCookiePairs(requests, cookie, callback) {
1330 if (!requests) 1330 if (!requests)
1331 return; 1331 return;
1332 for (var i = 0; i < requests.length; ++i) { 1332 for (var i = 0; i < requests.length; ++i) {
1333 if (SDK.Cookies.cookieMatchesResourceURL(cookie, requests[i].url)) 1333 if (SDK.Cookies.cookieMatchesResourceURL(cookie, requests[i].url()))
1334 callback(requests[i], cookie); 1334 callback(requests[i], cookie);
1335 } 1335 }
1336 } 1336 }
1337 }; 1337 };
1338 1338
1339 /** 1339 /**
1340 * @unrestricted 1340 * @unrestricted
1341 */ 1341 */
1342 Audits.AuditRules.CookieSizeRule = class extends Audits.AuditRules.CookieRuleBas e { 1342 Audits.AuditRules.CookieSizeRule = class extends Audits.AuditRules.CookieRuleBas e {
1343 constructor(avgBytesThreshold) { 1343 constructor(avgBytesThreshold) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 1482
1483 /** 1483 /**
1484 * @param {!Object<string, number>} matchingResourceData 1484 * @param {!Object<string, number>} matchingResourceData
1485 * @param {!SDK.NetworkRequest} request 1485 * @param {!SDK.NetworkRequest} request
1486 * @param {!SDK.Cookie} cookie 1486 * @param {!SDK.Cookie} cookie
1487 */ 1487 */
1488 _collectorCallback(matchingResourceData, request, cookie) { 1488 _collectorCallback(matchingResourceData, request, cookie) {
1489 matchingResourceData[request.url()] = (matchingResourceData[request.url()] | | 0) + cookie.size(); 1489 matchingResourceData[request.url()] = (matchingResourceData[request.url()] | | 0) + cookie.size();
1490 } 1490 }
1491 }; 1491 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698