Location header fix; add YSlow version to beacon; valid protocols check #65

Merged
merged 3 commits into from Oct 8, 2013
View
2 src/common/component.js
@@ -92,7 +92,7 @@ YSLOW.Component.prototype.populateProperties = function (resolveRedirect, ignore
// check location
// bookmarklet and har already handle redirects
- if (that.headers.location && resolveRedirect) {
+ if (that.headers.location && resolveRedirect && that.headers.location !== that.url) {
// Add a new component.
comp = that.parent.addComponentNoDuplicate(that.headers.location,
(that.type !== 'redirect' ? that.type : 'unknown'), that.url);
View
15 src/common/componentSet.js
@@ -498,10 +498,9 @@ YSLOW.ComponentSet.prototype = {
};
/*
- * List of protocols to ignore in component set.
+ * List of valid protocols in component sets.
*/
-YSLOW.ComponentSet.ignoreProtocols = ['data', 'chrome', 'javascript', 'about',
- 'resource', 'jar', 'chrome-extension', 'file'];
+YSLOW.ComponentSet.validProtocols = ['http', 'https', 'ftp'];
/**
* @private
@@ -511,21 +510,21 @@ YSLOW.ComponentSet.ignoreProtocols = ['data', 'chrome', 'javascript', 'about',
*/
YSLOW.ComponentSet.isValidProtocol = function (s) {
var i, index, protocol,
- ignoreProtocols = this.ignoreProtocols,
- len = ignoreProtocols.length;
+ validProtocols = this.validProtocols,
+ len = validProtocols.length;
s = s.toLowerCase();
index = s.indexOf(':');
if (index > 0) {
protocol = s.substr(0, index);
for (i = 0; i < len; i += 1) {
- if (protocol === ignoreProtocols[i]) {
- return false;
+ if (protocol === validProtocols[i]) {
+ return true;
}
}
}
- return true;
+ return false;
};
View
1 src/common/util.js
@@ -836,6 +836,7 @@ YSLOW.util = {
}
}
+ params.v = YSLOW.version;
params.w = parseInt(yscontext.PAGE.totalSize, 10);
params.o = parseInt(yscontext.PAGE.overallScore, 10);
params.u = encodeURIComponent(yscontext.result_set.url);