summaryrefslogtreecommitdiffstats
path: root/WebCore/inspector/front-end/AuditsPanel.js
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-15 12:23:52 +0000
committerSteve Block <steveblock@google.com>2010-02-16 11:48:32 +0000
commit8a0914b749bbe7da7768e07a7db5c6d4bb09472b (patch)
tree73f9065f370435d6fde32ae129d458a8c77c8dff /WebCore/inspector/front-end/AuditsPanel.js
parentbf14be70295513b8076f3fa47a268a7e42b2c478 (diff)
downloadexternal_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.zip
external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.tar.gz
external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.tar.bz2
Merge webkit.org at r54731 : Initial merge by git
Change-Id: Ia79977b6cf3b0b00c06ef39419989b28e57e4f4a
Diffstat (limited to 'WebCore/inspector/front-end/AuditsPanel.js')
-rw-r--r--WebCore/inspector/front-end/AuditsPanel.js38
1 files changed, 26 insertions, 12 deletions
diff --git a/WebCore/inspector/front-end/AuditsPanel.js b/WebCore/inspector/front-end/AuditsPanel.js
index 696d132..fcadb82 100644
--- a/WebCore/inspector/front-end/AuditsPanel.js
+++ b/WebCore/inspector/front-end/AuditsPanel.js
@@ -105,7 +105,8 @@ WebInspector.AuditsPanel.prototype = {
this._auditCategoriesById = {};
for (var categoryCtorID in WebInspector.AuditCategories) {
var auditCategory = new WebInspector.AuditCategories[categoryCtorID]();
- this.categoriesById[auditCategory.id] = auditCategory;
+ auditCategory._id = categoryCtorID;
+ this.categoriesById[categoryCtorID] = auditCategory;
}
},
@@ -185,15 +186,13 @@ WebInspector.AuditsPanel.prototype = {
_reloadResources: function(callback)
{
- function nullCallback()
- {
- }
this._resourceTrackingCallback = callback;
+
if (!InspectorBackend.resourceTrackingEnabled()) {
InspectorBackend.enableResourceTracking(false);
- this._updateLauncherViewControls();
+ this._updateLauncherViewControls(true);
} else
- InjectedScriptAccess.getDefault().evaluate("window.location.reload()", nullCallback);
+ InjectedScriptAccess.getDefault().evaluate("window.location.reload()", switchCallback);
},
_didMainResourceLoad: function()
@@ -239,7 +238,7 @@ WebInspector.AuditsPanel.prototype = {
WebInspector.Panel.prototype.show.call(this);
this.showView();
- this._updateLauncherViewControls();
+ this._updateLauncherViewControls(InspectorBackend.resourceTrackingEnabled());
},
attach: function()
@@ -254,10 +253,10 @@ WebInspector.AuditsPanel.prototype = {
this.viewsContainerElement.style.left = width + "px";
},
- _updateLauncherViewControls: function()
+ _updateLauncherViewControls: function(isTracking)
{
if (this._launcherView)
- this._launcherView.updateResourceTrackingState();
+ this._launcherView.updateResourceTrackingState(isTracking);
},
_clearButtonClicked: function()
@@ -278,9 +277,8 @@ WebInspector.AuditsPanel.prototype.__proto__ = WebInspector.Panel.prototype;
-WebInspector.AuditCategory = function(id, displayName)
+WebInspector.AuditCategory = function(displayName)
{
- this._id = id;
this._displayName = displayName;
this._rules = [];
}
@@ -288,6 +286,7 @@ WebInspector.AuditCategory = function(id, displayName)
WebInspector.AuditCategory.prototype = {
get id()
{
+ // this._id value is injected at construction time.
return this._id;
},
@@ -298,6 +297,7 @@ WebInspector.AuditCategory.prototype = {
get ruleCount()
{
+ this._ensureInitialized();
return this._rules.length;
},
@@ -308,8 +308,18 @@ WebInspector.AuditCategory.prototype = {
runRules: function(resources, callback)
{
+ this._ensureInitialized();
for (var i = 0; i < this._rules.length; ++i)
this._rules[i].run(resources, callback);
+ },
+
+ _ensureInitialized: function()
+ {
+ if (!this._initialized) {
+ if ("initialize" in this)
+ this.initialize();
+ this._initialized = true;
+ }
}
}
@@ -354,7 +364,6 @@ WebInspector.AuditRule.prototype = {
WebInspector.AuditCategoryResult = function(category)
{
- this.categoryId = category.id;
this.title = category.displayName;
this.entries = [];
}
@@ -378,8 +387,13 @@ WebInspector.AuditRuleResult = function(value)
}
WebInspector.AuditRuleResult.Type = {
+ // Does not denote a discovered flaw but rather represents an informational message.
NA: 0,
+
+ // Denotes a minor impact on the checked metric.
Hint: 1,
+
+ // Denotes a major impact on the checked metric.
Violation: 2
}