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.splitView.mainElement.addStyleClass("vbox");this.auditsTreeElement=ne
w WebInspector.SidebarSectionTreeElement("",{},true);this.sidebarTree.appendChil
d(this.auditsTreeElement);this.auditsTreeElement.listItemElement.addStyleClass("
hidden");this.auditsItemTreeElement=new WebInspector.AuditsSidebarTreeElement(th
is);this.auditsTreeElement.appendChild(this.auditsItemTreeElement);this.auditRes
ultsTreeElement=new WebInspector.SidebarSectionTreeElement(WebInspector.UIString
("RESULTS"),{},true);this.sidebarTree.appendChild(this.auditResultsTreeElement);
this.auditResultsTreeElement.expand();this.viewsContainerElement=this.splitView.
mainElement;this._constructCategories();this._auditController=new WebInspector.A
uditController(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={canSearch:function() |
5 {return[this.clearResultsButton.element];},get categoriesById() | 5 {return false;},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) |
11 ordinal++;} | 11 ordinal++;} |
12 var resultTreeElement=new WebInspector.AuditResultSidebarTreeElement(this,result
s,mainResourceURL,ordinal);this.auditResultsTreeElement.appendChild(resultTreeEl
ement);resultTreeElement.revealAndSelect();},showResults:function(categoryResult
s) | 12 var resultTreeElement=new WebInspector.AuditResultSidebarTreeElement(this,result
s,mainResourceURL,ordinal);this.auditResultsTreeElement.appendChild(resultTreeEl
ement);resultTreeElement.revealAndSelect();},showResults:function(categoryResult
s) |
13 {if(!categoryResults._resultView) | 13 {if(!categoryResults._resultView) |
14 categoryResults._resultView=new WebInspector.AuditResultView(categoryResults);th
is.visibleView=categoryResults._resultView;},showLauncherView:function() | 14 categoryResults._resultView=new WebInspector.AuditResultView(categoryResults);th
is.visibleView=categoryResults._resultView;},showLauncherView:function() |
15 {this.visibleView=this._launcherView;},get visibleView() | 15 {this.visibleView=this._launcherView;},get visibleView() |
16 {return this._visibleView;},set visibleView(x) | 16 {return this._visibleView;},set visibleView(x) |
17 {if(this._visibleView===x) | 17 {if(this._visibleView===x) |
18 return;if(this._visibleView) | 18 return;if(this._visibleView) |
19 this._visibleView.detach();this._visibleView=x;if(x) | 19 this._visibleView.detach();this._visibleView=x;if(x) |
20 x.show(this.viewsContainerElement);},wasShown:function() | 20 x.show(this.viewsContainerElement);},wasShown:function() |
21 {WebInspector.Panel.prototype.wasShown.call(this);if(!this._visibleView) | 21 {WebInspector.Panel.prototype.wasShown.call(this);if(!this._visibleView) |
22 this.auditsItemTreeElement.select();},_clearButtonClicked:function() | 22 this.auditsItemTreeElement.select();},clearResults:function() |
23 {this.auditsItemTreeElement.revealAndSelect();this.auditResultsTreeElement.remov
eChildren();},__proto__:WebInspector.Panel.prototype} | 23 {this.auditsItemTreeElement.revealAndSelect();this.auditResultsTreeElement.remov
eChildren();},__proto__:WebInspector.Panel.prototype} |
24 WebInspector.AuditCategory=function(displayName) | 24 WebInspector.AuditCategory=function(displayName) |
25 {this._displayName=displayName;this._rules=[];} | 25 {this._displayName=displayName;this._rules=[];} |
26 WebInspector.AuditCategory.prototype={get id() | 26 WebInspector.AuditCategory.prototype={get id() |
27 {return this._id;},get displayName() | 27 {return this._id;},get displayName() |
28 {return this._displayName;},addRule:function(rule,severity) | 28 {return this._displayName;},addRule:function(rule,severity) |
29 {rule.severity=severity;this._rules.push(rule);},run:function(requests,ruleResul
tCallback,categoryDoneCallback,progress) | 29 {rule.severity=severity;this._rules.push(rule);},run:function(requests,ruleResul
tCallback,categoryDoneCallback,progress) |
30 {this._ensureInitialized();var remainingRulesCount=this._rules.length;progress.s
etTotalWork(remainingRulesCount);function callbackWrapper(result) | 30 {this._ensureInitialized();var remainingRulesCount=this._rules.length;progress.s
etTotalWork(remainingRulesCount);function callbackWrapper(result) |
31 {ruleResultCallback(result);progress.worked();if(!--remainingRulesCount) | 31 {ruleResultCallback(result);progress.worked();if(!--remainingRulesCount) |
32 categoryDoneCallback();} | 32 categoryDoneCallback();} |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 {this._auditsPanel.auditFinishedCallback(mainResourceURL,results);if(!this._prog
ress.isCanceled()) | 100 {this._auditsPanel.auditFinishedCallback(mainResourceURL,results);if(!this._prog
ress.isCanceled()) |
101 launcherCallback();},initiateAudit:function(categoryIds,progress,runImmediately,
startedCallback,finishedCallback) | 101 launcherCallback();},initiateAudit:function(categoryIds,progress,runImmediately,
startedCallback,finishedCallback) |
102 {if(!categoryIds||!categoryIds.length) | 102 {if(!categoryIds||!categoryIds.length) |
103 return;this._progress=progress;var categories=[];for(var i=0;i<categoryIds.lengt
h;++i) | 103 return;this._progress=progress;var categories=[];for(var i=0;i<categoryIds.lengt
h;++i) |
104 categories.push(this._auditsPanel.categoriesById[categoryIds[i]]);function start
AuditWhenResourcesReady() | 104 categories.push(this._auditsPanel.categoriesById[categoryIds[i]]);function start
AuditWhenResourcesReady() |
105 {startedCallback();this._executeAudit(categories,this._auditFinishedCallback.bin
d(this,finishedCallback));} | 105 {startedCallback();this._executeAudit(categories,this._auditFinishedCallback.bin
d(this,finishedCallback));} |
106 if(runImmediately) | 106 if(runImmediately) |
107 startAuditWhenResourcesReady.call(this);else | 107 startAuditWhenResourcesReady.call(this);else |
108 this._reloadResources(startAuditWhenResourcesReady.bind(this));WebInspector.user
Metrics.AuditsStarted.record();},_reloadResources:function(callback) | 108 this._reloadResources(startAuditWhenResourcesReady.bind(this));WebInspector.user
Metrics.AuditsStarted.record();},_reloadResources:function(callback) |
109 {this._pageReloadCallback=callback;PageAgent.reload(false);},_didMainResourceLoa
d:function() | 109 {this._pageReloadCallback=callback;PageAgent.reload(false);},_didMainResourceLoa
d:function() |
110 {if(this._pageReloadCallback){var callback=this._pageReloadCallback;delete this.
_pageReloadCallback;callback();}}};WebInspector.AuditFormatters=function() | 110 {if(this._pageReloadCallback){var callback=this._pageReloadCallback;delete this.
_pageReloadCallback;callback();}},clearResults:function() |
| 111 {this._auditsPanel.clearResults();}};WebInspector.AuditFormatters=function() |
111 {} | 112 {} |
112 WebInspector.AuditFormatters.Registry={text:function(text) | 113 WebInspector.AuditFormatters.Registry={text:function(text) |
113 {return document.createTextNode(text);},snippet:function(snippetText) | 114 {return document.createTextNode(text);},snippet:function(snippetText) |
114 {var div=document.createElement("div");div.textContent=snippetText;div.className
="source-code";return div;},concat:function() | 115 {var div=document.createElement("div");div.textContent=snippetText;div.className
="source-code";return div;},concat:function() |
115 {var parent=document.createElement("span");for(var arg=0;arg<arguments.length;++
arg) | 116 {var parent=document.createElement("span");for(var arg=0;arg<arguments.length;++
arg) |
116 parent.appendChild(WebInspector.auditFormatters.apply(arguments[arg]));return pa
rent;},url:function(url,displayText,allowExternalNavigation) | 117 parent.appendChild(WebInspector.auditFormatters.apply(arguments[arg]));return pa
rent;},url:function(url,displayText,allowExternalNavigation) |
117 {var a=document.createElement("a");a.href=sanitizeHref(url);a.title=url;a.textCo
ntent=displayText||url;if(allowExternalNavigation) | 118 {var a=document.createElement("a");a.href=sanitizeHref(url);a.title=url;a.textCo
ntent=displayText||url;if(allowExternalNavigation) |
118 a.target="_blank";return a;},resourceLink:function(url,line) | 119 a.target="_blank";return a;},resourceLink:function(url,line) |
119 {return WebInspector.linkifyResourceAsNode(url,line,"console-message-url webkit-
html-resource-link");}};WebInspector.AuditFormatters.prototype={apply:function(v
alue) | 120 {return WebInspector.linkifyResourceAsNode(url,line,"console-message-url webkit-
html-resource-link");}};WebInspector.AuditFormatters.prototype={apply:function(v
alue) |
120 {var formatter;var type=typeof value;var args;switch(type){case"string":case"boo
lean":case"number":formatter=WebInspector.AuditFormatters.Registry.text;args=[va
lue.toString()];break;case"object":if(value instanceof Node) | 121 {var formatter;var type=typeof value;var args;switch(type){case"string":case"boo
lean":case"number":formatter=WebInspector.AuditFormatters.Registry.text;args=[va
lue.toString()];break;case"object":if(value instanceof Node) |
(...skipping 20 matching lines...) Expand all Loading... |
141 return;this._auditRunning=auditRunning;this._updateButton();this._toggleUICompon
ents(this._auditRunning);if(this._auditRunning) | 142 return;this._auditRunning=auditRunning;this._updateButton();this._toggleUICompon
ents(this._auditRunning);if(this._auditRunning) |
142 this._startAudit();else | 143 this._startAudit();else |
143 this._stopAudit();},_startAudit:function() | 144 this._stopAudit();},_startAudit:function() |
144 {var catIds=[];for(var category=0;category<this._sortedCategories.length;++categ
ory){if(this._sortedCategories[category]._checkboxElement.checked) | 145 {var catIds=[];for(var category=0;category<this._sortedCategories.length;++categ
ory){if(this._sortedCategories[category]._checkboxElement.checked) |
145 catIds.push(this._sortedCategories[category].id);} | 146 catIds.push(this._sortedCategories[category].id);} |
146 this._resetResourceCount();this._progressIndicator=new WebInspector.ProgressIndi
cator();this._buttonContainerElement.appendChild(this._progressIndicator.element
);this._displayResourceLoadingProgress=true;function onAuditStarted() | 147 this._resetResourceCount();this._progressIndicator=new WebInspector.ProgressIndi
cator();this._buttonContainerElement.appendChild(this._progressIndicator.element
);this._displayResourceLoadingProgress=true;function onAuditStarted() |
147 {this._displayResourceLoadingProgress=false;} | 148 {this._displayResourceLoadingProgress=false;} |
148 this._auditController.initiateAudit(catIds,this._progressIndicator,this._auditPr
esentStateElement.checked,onAuditStarted.bind(this),this._setAuditRunning.bind(t
his,false));},_stopAudit:function() | 149 this._auditController.initiateAudit(catIds,this._progressIndicator,this._auditPr
esentStateElement.checked,onAuditStarted.bind(this),this._setAuditRunning.bind(t
his,false));},_stopAudit:function() |
149 {this._displayResourceLoadingProgress=false;this._progressIndicator.cancel();thi
s._progressIndicator.done();delete this._progressIndicator;},_toggleUIComponents
:function(disable) | 150 {this._displayResourceLoadingProgress=false;this._progressIndicator.cancel();thi
s._progressIndicator.done();delete this._progressIndicator;},_toggleUIComponents
:function(disable) |
150 {this._selectAllCheckboxElement.disabled=disable;this._categoriesElement.disable
d=disable;this._auditPresentStateElement.disabled=disable;this._auditReloadedSta
teElement.disabled=disable;},_launchButtonClicked:function(event) | 151 {this._selectAllCheckboxElement.disabled=disable;this._categoriesElement.disable
d=disable;this._auditPresentStateElement.disabled=disable;this._auditReloadedSta
teElement.disabled=disable;},_launchButtonClicked:function(event) |
151 {this._setAuditRunning(!this._auditRunning);},_selectAllClicked:function(checkCa
tegories,userGesture) | 152 {this._setAuditRunning(!this._auditRunning);},_clearButtonClicked:function() |
| 153 {this._auditController.clearResults();},_selectAllClicked:function(checkCategori
es,userGesture) |
152 {var childNodes=this._categoriesElement.childNodes;for(var i=0,length=childNodes
.length;i<length;++i) | 154 {var childNodes=this._categoriesElement.childNodes;for(var i=0,length=childNodes
.length;i<length;++i) |
153 childNodes[i].firstChild.checked=checkCategories;this._currentCategoriesCount=ch
eckCategories?this._sortedCategories.length:0;this._selectedCategoriesUpdated(us
erGesture);},_categoryClicked:function(event) | 155 childNodes[i].firstChild.checked=checkCategories;this._currentCategoriesCount=ch
eckCategories?this._sortedCategories.length:0;this._selectedCategoriesUpdated(us
erGesture);},_categoryClicked:function(event) |
154 {this._currentCategoriesCount+=event.target.checked?1:-1;this._selectAllCheckbox
Element.checked=this._currentCategoriesCount===this._sortedCategories.length;thi
s._selectedCategoriesUpdated(true);},_createCategoryElement:function(title,id) | 156 {this._currentCategoriesCount+=event.target.checked?1:-1;this._selectAllCheckbox
Element.checked=this._currentCategoriesCount===this._sortedCategories.length;thi
s._selectedCategoriesUpdated(true);},_createCategoryElement:function(title,id) |
155 {var labelElement=document.createElement("label");labelElement.id=this._category
IdPrefix+id;var element=document.createElement("input");element.type="checkbox";
if(id!=="") | 157 {var labelElement=document.createElement("label");labelElement.id=this._category
IdPrefix+id;var element=document.createElement("input");element.type="checkbox";
if(id!=="") |
156 element.addEventListener("click",this._boundCategoryClickListener,false);labelEl
ement.appendChild(element);labelElement.appendChild(document.createTextNode(titl
e));labelElement.__displayName=title;return labelElement;},_createLauncherUI:fun
ction() | 158 element.addEventListener("click",this._boundCategoryClickListener,false);labelEl
ement.appendChild(element);labelElement.appendChild(document.createTextNode(titl
e));labelElement.__displayName=title;return labelElement;},_createLauncherUI:fun
ction() |
157 {this._headerElement=document.createElement("h1");this._headerElement.textConten
t=WebInspector.UIString("Select audits to run");for(var child=0;child<this._cont
entElement.children.length;++child) | 159 {this._headerElement=document.createElement("h1");this._headerElement.textConten
t=WebInspector.UIString("Select audits to run");for(var child=0;child<this._cont
entElement.children.length;++child) |
158 this._contentElement.removeChild(this._contentElement.children[child]);this._con
tentElement.appendChild(this._headerElement);function handleSelectAllClick(event
) | 160 this._contentElement.removeChild(this._contentElement.children[child]);this._con
tentElement.appendChild(this._headerElement);function handleSelectAllClick(event
) |
159 {this._selectAllClicked(event.target.checked,true);} | 161 {this._selectAllClicked(event.target.checked,true);} |
160 var categoryElement=this._createCategoryElement(WebInspector.UIString("Select Al
l"),"");categoryElement.id="audit-launcher-selectall";this._selectAllCheckboxEle
ment=categoryElement.firstChild;this._selectAllCheckboxElement.checked=this._sel
ectedCategoriesSetting.get()[WebInspector.AuditLauncherView.AllCategoriesKey];th
is._selectAllCheckboxElement.addEventListener("click",handleSelectAllClick.bind(
this),false);this._contentElement.appendChild(categoryElement);this._categoriesE
lement=this._contentElement.createChild("fieldset","audit-categories-container")
;this._currentCategoriesCount=0;this._contentElement.createChild("div","flexible
-space");this._buttonContainerElement=this._contentElement.createChild("div","bu
tton-container");var labelElement=this._buttonContainerElement.createChild("labe
l");this._auditPresentStateElement=labelElement.createChild("input");this._audit
PresentStateElement.name="audit-mode";this._auditPresentStateElement.type="radio
";this._auditPresentStateElement.checked=true;this._auditPresentStateLabelElemen
t=document.createTextNode(WebInspector.UIString("Audit Present State"));labelEle
ment.appendChild(this._auditPresentStateLabelElement);labelElement=this._buttonC
ontainerElement.createChild("label");this._auditReloadedStateElement=labelElemen
t.createChild("input");this._auditReloadedStateElement.name="audit-mode";this._a
uditReloadedStateElement.type="radio";labelElement.appendChild(document.createTe
xtNode("Reload Page and Audit on Load"));this._launchButton=this._buttonContaine
rElement.createChild("button");this._launchButton.textContent=WebInspector.UIStr
ing("Run");this._launchButton.addEventListener("click",this._launchButtonClicked
.bind(this),false);this._selectAllClicked(this._selectAllCheckboxElement.checked
);},_updateResourceProgress:function() | 162 var categoryElement=this._createCategoryElement(WebInspector.UIString("Select Al
l"),"");categoryElement.id="audit-launcher-selectall";this._selectAllCheckboxEle
ment=categoryElement.firstChild;this._selectAllCheckboxElement.checked=this._sel
ectedCategoriesSetting.get()[WebInspector.AuditLauncherView.AllCategoriesKey];th
is._selectAllCheckboxElement.addEventListener("click",handleSelectAllClick.bind(
this),false);this._contentElement.appendChild(categoryElement);this._categoriesE
lement=this._contentElement.createChild("fieldset","audit-categories-container")
;this._currentCategoriesCount=0;this._contentElement.createChild("div","flexible
-space");this._buttonContainerElement=this._contentElement.createChild("div","bu
tton-container");var labelElement=this._buttonContainerElement.createChild("labe
l");this._auditPresentStateElement=labelElement.createChild("input");this._audit
PresentStateElement.name="audit-mode";this._auditPresentStateElement.type="radio
";this._auditPresentStateElement.checked=true;this._auditPresentStateLabelElemen
t=document.createTextNode(WebInspector.UIString("Audit Present State"));labelEle
ment.appendChild(this._auditPresentStateLabelElement);labelElement=this._buttonC
ontainerElement.createChild("label");this._auditReloadedStateElement=labelElemen
t.createChild("input");this._auditReloadedStateElement.name="audit-mode";this._a
uditReloadedStateElement.type="radio";labelElement.appendChild(document.createTe
xtNode("Reload Page and Audit on Load"));this._launchButton=this._buttonContaine
rElement.createChild("button");this._launchButton.textContent=WebInspector.UIStr
ing("Run");this._launchButton.addEventListener("click",this._launchButtonClicked
.bind(this),false);this._clearButton=this._buttonContainerElement.createChild("b
utton");this._clearButton.textContent=WebInspector.UIString("Clear");this._clear
Button.addEventListener("click",this._clearButtonClicked.bind(this),false);this.
_selectAllClicked(this._selectAllCheckboxElement.checked);},_updateResourceProgr
ess:function() |
161 {if(this._displayResourceLoadingProgress) | 163 {if(this._displayResourceLoadingProgress) |
162 this._progressIndicator.setTitle(WebInspector.UIString("Loading (%d of %d)",this
._loadedResources,this._totalResources));},_selectedCategoriesUpdated:function(u
serGesture) | 164 this._progressIndicator.setTitle(WebInspector.UIString("Loading (%d of %d)",this
._loadedResources,this._totalResources));},_selectedCategoriesUpdated:function(u
serGesture) |
163 {var selectedCategories=userGesture?{}:this._selectedCategoriesSetting.get();var
childNodes=this._categoriesElement.childNodes;for(var i=0,length=childNodes.len
gth;i<length;++i) | 165 {var selectedCategories=userGesture?{}:this._selectedCategoriesSetting.get();var
childNodes=this._categoriesElement.childNodes;for(var i=0,length=childNodes.len
gth;i<length;++i) |
164 selectedCategories[childNodes[i].__displayName]=childNodes[i].firstChild.checked
;selectedCategories[WebInspector.AuditLauncherView.AllCategoriesKey]=this._selec
tAllCheckboxElement.checked;this._selectedCategoriesSetting.set(selectedCategori
es);this._updateButton();},_updateButton:function() | 166 selectedCategories[childNodes[i].__displayName]=childNodes[i].firstChild.checked
;selectedCategories[WebInspector.AuditLauncherView.AllCategoriesKey]=this._selec
tAllCheckboxElement.checked;this._selectedCategoriesSetting.set(selectedCategori
es);this._updateButton();},_updateButton:function() |
165 {this._launchButton.textContent=this._auditRunning?WebInspector.UIString("Stop")
:WebInspector.UIString("Run");this._launchButton.disabled=!this._currentCategori
esCount;},__proto__:WebInspector.View.prototype};WebInspector.AuditResultView=fu
nction(categoryResults) | 167 {this._launchButton.textContent=this._auditRunning?WebInspector.UIString("Stop")
:WebInspector.UIString("Run");this._launchButton.disabled=!this._currentCategori
esCount;},__proto__:WebInspector.View.prototype};WebInspector.AuditResultView=fu
nction(categoryResults) |
166 {WebInspector.SidebarPaneStack.call(this);this.element.addStyleClass("audit-resu
lt-view");function categorySorter(a,b){return(a.title||"").localeCompare(b.title
||"");} | 168 {WebInspector.SidebarPaneStack.call(this);this.element.addStyleClass("audit-resu
lt-view");function categorySorter(a,b){return(a.title||"").localeCompare(b.title
||"");} |
167 categoryResults.sort(categorySorter);for(var i=0;i<categoryResults.length;++i) | 169 categoryResults.sort(categorySorter);for(var i=0;i<categoryResults.length;++i) |
168 this.addPane(new WebInspector.AuditCategoryResultPane(categoryResults[i]));} | 170 this.addPane(new WebInspector.AuditCategoryResultPane(categoryResults[i]));} |
169 WebInspector.AuditResultView.prototype={__proto__:WebInspector.SidebarPaneStack.
prototype} | 171 WebInspector.AuditResultView.prototype={__proto__:WebInspector.SidebarPaneStack.
prototype} |
170 WebInspector.AuditCategoryResultPane=function(categoryResult) | 172 WebInspector.AuditCategoryResultPane=function(categoryResult) |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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} | 470 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} |
469 WebInspector.AuditRules.StaticCookielessRule=function(minResources) | 471 WebInspector.AuditRules.StaticCookielessRule=function(minResources) |
470 {WebInspector.AuditRules.CookieRuleBase.call(this,"http-staticcookieless","Serve
static content from a cookieless domain");this._minResources=minResources;} | 472 {WebInspector.AuditRules.CookieRuleBase.call(this,"http-staticcookieless","Serve
static content from a cookieless domain");this._minResources=minResources;} |
471 WebInspector.AuditRules.StaticCookielessRule.prototype={processCookies:function(
allCookies,requests,result) | 473 WebInspector.AuditRules.StaticCookielessRule.prototype={processCookies:function(
allCookies,requests,result) |
472 {var domainToResourcesMap=WebInspector.AuditRules.getDomainToResourcesMap(reques
ts,[WebInspector.resourceTypes.Stylesheet,WebInspector.resourceTypes.Image],true
);var totalStaticResources=0;for(var domain in domainToResourcesMap) | 474 {var domainToResourcesMap=WebInspector.AuditRules.getDomainToResourcesMap(reques
ts,[WebInspector.resourceTypes.Stylesheet,WebInspector.resourceTypes.Image],true
);var totalStaticResources=0;for(var domain in domainToResourcesMap) |
473 totalStaticResources+=domainToResourcesMap[domain].length;if(totalStaticResource
s<this._minResources) | 475 totalStaticResources+=domainToResourcesMap[domain].length;if(totalStaticResource
s<this._minResources) |
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]} | 476 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]} |
475 if(badUrls.length<this._minResources) | 477 if(badUrls.length<this._minResources) |
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) | 478 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) |
477 {matchingResourceData[request.url]=(matchingResourceData[request.url]||0)+cookie
.size();},__proto__:WebInspector.AuditRules.CookieRuleBase.prototype}; | 479 {matchingResourceData[request.url]=(matchingResourceData[request.url]||0)+cookie
.size();},__proto__:WebInspector.AuditRules.CookieRuleBase.prototype}; |
OLD | NEW |