Skip to content

Commit

Permalink
Merge pull request marcelduran#65 from brewt/master
Browse files Browse the repository at this point in the history
Location header fix; add YSlow version to beacon; valid protocols check
  • Loading branch information
marcelduran committed Oct 8, 2013
2 parents 792b2eb + e4791a5 commit aa4a688
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/common/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
15 changes: 7 additions & 8 deletions src/common/componentSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
};


Expand Down
1 change: 1 addition & 0 deletions src/common/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit aa4a688

Please sign in to comment.