| OLD | NEW |
| 1 WebInspector.AuditsPanel=function() | 1 WebInspector.AuditsPanel=function() |
| 2 {WebInspector.Panel.call(this,"audits");this.registerRequiredCSS("panelEnablerVi
ew.css");this.registerRequiredCSS("auditsPanel.css");this.createSidebarViewWithT
ree();this.auditsTreeElement=new WebInspector.SidebarSectionTreeElement("",{},tr
ue);this.sidebarTree.appendChild(this.auditsTreeElement);this.auditsTreeElement.
listItemElement.addStyleClass("hidden");this.auditsItemTreeElement=new WebInspec
tor.AuditsSidebarTreeElement(this);this.auditsTreeElement.appendChild(this.audit
sItemTreeElement);this.auditResultsTreeElement=new WebInspector.SidebarSectionTr
eeElement(WebInspector.UIString("RESULTS"),{},true);this.sidebarTree.appendChild
(this.auditResultsTreeElement);this.auditResultsTreeElement.expand();this.clearR
esultsButton=new WebInspector.StatusBarButton(WebInspector.UIString("Clear audit
results."),"clear-status-bar-item");this.clearResultsButton.addEventListener("c
lick",this._clearButtonClicked,this);this.viewsContainerElement=this.splitView.m
ainElement;this._constructCategories();this._auditController=new WebInspector.Au
ditController(this);this._launcherView=new WebInspector.AuditLauncherView(this._
auditController);for(var id in this.categoriesById) | 2 {WebInspector.Panel.call(this,"audits");this.registerRequiredCSS("panelEnablerVi
ew.css");this.registerRequiredCSS("auditsPanel.css");this.createSidebarViewWithT
ree();this.auditsTreeElement=new WebInspector.SidebarSectionTreeElement("",{},tr
ue);this.sidebarTree.appendChild(this.auditsTreeElement);this.auditsTreeElement.
listItemElement.addStyleClass("hidden");this.auditsItemTreeElement=new WebInspec
tor.AuditsSidebarTreeElement(this);this.auditsTreeElement.appendChild(this.audit
sItemTreeElement);this.auditResultsTreeElement=new WebInspector.SidebarSectionTr
eeElement(WebInspector.UIString("RESULTS"),{},true);this.sidebarTree.appendChild
(this.auditResultsTreeElement);this.auditResultsTreeElement.expand();this.clearR
esultsButton=new WebInspector.StatusBarButton(WebInspector.UIString("Clear audit
results."),"clear-status-bar-item");this.clearResultsButton.addEventListener("c
lick",this._clearButtonClicked,this);this.viewsContainerElement=this.splitView.m
ainElement;this._constructCategories();this._auditController=new WebInspector.Au
ditController(this);this._launcherView=new WebInspector.AuditLauncherView(this._
auditController);for(var id in this.categoriesById) |
| 3 this._launcherView.addCategory(this.categoriesById[id]);} | 3 this._launcherView.addCategory(this.categoriesById[id]);} |
| 4 WebInspector.AuditsPanel.prototype={get statusBarItems() | 4 WebInspector.AuditsPanel.prototype={get statusBarItems() |
| 5 {return[this.clearResultsButton.element];},get categoriesById() | 5 {return[this.clearResultsButton.element];},get categoriesById() |
| 6 {return this._auditCategoriesById;},addCategory:function(category) | 6 {return this._auditCategoriesById;},addCategory:function(category) |
| 7 {this.categoriesById[category.id]=category;this._launcherView.addCategory(catego
ry);},getCategory:function(id) | 7 {this.categoriesById[category.id]=category;this._launcherView.addCategory(catego
ry);},getCategory:function(id) |
| 8 {return this.categoriesById[id];},_constructCategories:function() | 8 {return this.categoriesById[id];},_constructCategories:function() |
| 9 {this._auditCategoriesById={};for(var categoryCtorID in WebInspector.AuditCatego
ries){var auditCategory=new WebInspector.AuditCategories[categoryCtorID]();audit
Category._id=categoryCtorID;this.categoriesById[categoryCtorID]=auditCategory;}}
,auditFinishedCallback:function(mainResourceURL,results) | 9 {this._auditCategoriesById={};for(var categoryCtorID in WebInspector.AuditCatego
ries){var auditCategory=new WebInspector.AuditCategories[categoryCtorID]();audit
Category._id=categoryCtorID;this.categoriesById[categoryCtorID]=auditCategory;}}
,auditFinishedCallback:function(mainResourceURL,results) |
| 10 {var children=this.auditResultsTreeElement.children;var ordinal=1;for(var i=0;i<
children.length;++i){if(children[i].mainResourceURL===mainResourceURL) | 10 {var children=this.auditResultsTreeElement.children;var ordinal=1;for(var i=0;i<
children.length;++i){if(children[i].mainResourceURL===mainResourceURL) |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 function onDocumentAvailable(root) | 374 function onDocumentAvailable(root) |
| 375 {if(progress.isCanceled()) | 375 {if(progress.isCanceled()) |
| 376 return;WebInspector.domAgent.querySelectorAll(root.id,"body style",inlineStylesR
eceived.bind(null,root));} | 376 return;WebInspector.domAgent.querySelectorAll(root.id,"body style",inlineStylesR
eceived.bind(null,root));} |
| 377 WebInspector.domAgent.requestDocument(onDocumentAvailable);},__proto__:WebInspec
tor.AuditRule.prototype} | 377 WebInspector.domAgent.requestDocument(onDocumentAvailable);},__proto__:WebInspec
tor.AuditRule.prototype} |
| 378 WebInspector.AuditRules.StylesScriptsOrderRule=function() | 378 WebInspector.AuditRules.StylesScriptsOrderRule=function() |
| 379 {WebInspector.AuditRule.call(this,"page-stylescriptorder","Optimize the order of
styles and scripts");} | 379 {WebInspector.AuditRule.call(this,"page-stylescriptorder","Optimize the order of
styles and scripts");} |
| 380 WebInspector.AuditRules.StylesScriptsOrderRule.prototype={doRun:function(request
s,result,callback,progress) | 380 WebInspector.AuditRules.StylesScriptsOrderRule.prototype={doRun:function(request
s,result,callback,progress) |
| 381 {function evalCallback(resultValue) | 381 {function evalCallback(resultValue) |
| 382 {if(progress.isCanceled()) | 382 {if(progress.isCanceled()) |
| 383 return;if(!resultValue) | 383 return;if(!resultValue) |
| 384 return callback(null);var lateCssUrls=resultValue[0];var cssBeforeInlineCount=re
sultValue[1];var entry=result.addChild("The following external CSS files were in
cluded after an external JavaScript file in the document head. To ensure CSS fil
es are downloaded in parallel, always include external CSS before external JavaS
cript.",true);entry.addURLs(lateCssUrls);result.violationCount+=lateCssUrls.leng
th;if(cssBeforeInlineCount){result.addChild(String.sprintf(" %d inline script bl
ock%s found in the head between an external CSS file and another resource. To al
low parallel downloading, move the inline script before the external CSS file, o
r after the next resource.",cssBeforeInlineCount,cssBeforeInlineCount>1?"s were"
:" was"));result.violationCount+=cssBeforeInlineCount;} | 384 return callback(null);var lateCssUrls=resultValue[0];var cssBeforeInlineCount=re
sultValue[1];if(lateCssUrls.length){var entry=result.addChild("The following ext
ernal CSS files were included after an external JavaScript file in the document
head. To ensure CSS files are downloaded in parallel, always include external CS
S before external JavaScript.",true);entry.addURLs(lateCssUrls);result.violation
Count+=lateCssUrls.length;} |
| 385 if(cssBeforeInlineCount){result.addChild(String.sprintf(" %d inline script block
%s found in the head between an external CSS file and another resource. To allow
parallel downloading, move the inline script before the external CSS file, or a
fter the next resource.",cssBeforeInlineCount,cssBeforeInlineCount>1?"s were":"
was"));result.violationCount+=cssBeforeInlineCount;} |
| 385 callback(result);} | 386 callback(result);} |
| 386 function cssBeforeInlineReceived(lateStyleIds,nodeIds) | 387 function cssBeforeInlineReceived(lateStyleIds,nodeIds) |
| 387 {if(progress.isCanceled()) | 388 {if(progress.isCanceled()) |
| 388 return;if(!nodeIds) | 389 return;if(!nodeIds) |
| 389 return;var cssBeforeInlineCount=nodeIds.length;var result=null;if(lateStyleIds.l
ength||cssBeforeInlineCount){var lateStyleUrls=[];for(var i=0;i<lateStyleIds.len
gth;++i){var lateStyleNode=WebInspector.domAgent.nodeForId(lateStyleIds[i]);var
completeHref=WebInspector.ParsedURL.completeURL(lateStyleNode.ownerDocument.base
URL,lateStyleNode.getAttribute("href"));lateStyleUrls.push(completeHref||"<empty
>");} | 390 return;var cssBeforeInlineCount=nodeIds.length;var result=null;if(lateStyleIds.l
ength||cssBeforeInlineCount){var lateStyleUrls=[];for(var i=0;i<lateStyleIds.len
gth;++i){var lateStyleNode=WebInspector.domAgent.nodeForId(lateStyleIds[i]);var
completeHref=WebInspector.ParsedURL.completeURL(lateStyleNode.ownerDocument.base
URL,lateStyleNode.getAttribute("href"));lateStyleUrls.push(completeHref||"<empty
>");} |
| 390 result=[lateStyleUrls,cssBeforeInlineCount];} | 391 result=[lateStyleUrls,cssBeforeInlineCount];} |
| 391 evalCallback(result);} | 392 evalCallback(result);} |
| 392 function lateStylesReceived(root,nodeIds) | 393 function lateStylesReceived(root,nodeIds) |
| 393 {if(progress.isCanceled()) | 394 {if(progress.isCanceled()) |
| 394 return;if(!nodeIds) | 395 return;if(!nodeIds) |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 if(bigAvgCookieDomains.length){var entry=result.addChild(String.sprintf("The fol
lowing domains have an average cookie size in excess of %d bytes. Reducing the s
ize of cookies for these domains can reduce the time it takes to send requests."
,this._avgBytesThreshold),true);entry.addURLs(bigAvgCookieDomains);result.violat
ionCount+=bigAvgCookieDomains.length;}},__proto__:WebInspector.AuditRules.Cookie
RuleBase.prototype} | 468 if(bigAvgCookieDomains.length){var entry=result.addChild(String.sprintf("The fol
lowing domains have an average cookie size in excess of %d bytes. Reducing the s
ize of cookies for these domains can reduce the time it takes to send requests."
,this._avgBytesThreshold),true);entry.addURLs(bigAvgCookieDomains);result.violat
ionCount+=bigAvgCookieDomains.length;}},__proto__:WebInspector.AuditRules.Cookie
RuleBase.prototype} |
| 468 WebInspector.AuditRules.StaticCookielessRule=function(minResources) | 469 WebInspector.AuditRules.StaticCookielessRule=function(minResources) |
| 469 {WebInspector.AuditRules.CookieRuleBase.call(this,"http-staticcookieless","Serve
static content from a cookieless domain");this._minResources=minResources;} | 470 {WebInspector.AuditRules.CookieRuleBase.call(this,"http-staticcookieless","Serve
static content from a cookieless domain");this._minResources=minResources;} |
| 470 WebInspector.AuditRules.StaticCookielessRule.prototype={processCookies:function(
allCookies,requests,result) | 471 WebInspector.AuditRules.StaticCookielessRule.prototype={processCookies:function(
allCookies,requests,result) |
| 471 {var domainToResourcesMap=WebInspector.AuditRules.getDomainToResourcesMap(reques
ts,[WebInspector.resourceTypes.Stylesheet,WebInspector.resourceTypes.Image],true
);var totalStaticResources=0;for(var domain in domainToResourcesMap) | 472 {var domainToResourcesMap=WebInspector.AuditRules.getDomainToResourcesMap(reques
ts,[WebInspector.resourceTypes.Stylesheet,WebInspector.resourceTypes.Image],true
);var totalStaticResources=0;for(var domain in domainToResourcesMap) |
| 472 totalStaticResources+=domainToResourcesMap[domain].length;if(totalStaticResource
s<this._minResources) | 473 totalStaticResources+=domainToResourcesMap[domain].length;if(totalStaticResource
s<this._minResources) |
| 473 return;var matchingResourceData={};this.mapResourceCookies(domainToResourcesMap,
allCookies,this._collectorCallback.bind(this,matchingResourceData));var badUrls=
[];var cookieBytes=0;for(var url in matchingResourceData){badUrls.push(url);cook
ieBytes+=matchingResourceData[url]} | 474 return;var matchingResourceData={};this.mapResourceCookies(domainToResourcesMap,
allCookies,this._collectorCallback.bind(this,matchingResourceData));var badUrls=
[];var cookieBytes=0;for(var url in matchingResourceData){badUrls.push(url);cook
ieBytes+=matchingResourceData[url]} |
| 474 if(badUrls.length<this._minResources) | 475 if(badUrls.length<this._minResources) |
| 475 return;var entry=result.addChild(String.sprintf("%s of cookies were sent with th
e following static resources. Serve these static resources from a domain that do
es not set cookies:",Number.bytesToString(cookieBytes)),true);entry.addURLs(badU
rls);result.violationCount=badUrls.length;},_collectorCallback:function(matching
ResourceData,request,cookie) | 476 return;var entry=result.addChild(String.sprintf("%s of cookies were sent with th
e following static resources. Serve these static resources from a domain that do
es not set cookies:",Number.bytesToString(cookieBytes)),true);entry.addURLs(badU
rls);result.violationCount=badUrls.length;},_collectorCallback:function(matching
ResourceData,request,cookie) |
| 476 {matchingResourceData[request.url]=(matchingResourceData[request.url]||0)+cookie
.size();},__proto__:WebInspector.AuditRules.CookieRuleBase.prototype}; | 477 {matchingResourceData[request.url]=(matchingResourceData[request.url]||0)+cookie
.size();},__proto__:WebInspector.AuditRules.CookieRuleBase.prototype}; |
| OLD | NEW |