Browse Source

fixed bad test for 1st-party

pull/2/head
gorhill 10 years ago
parent
commit
cd7996fb7d
  1. 8
      src/js/matrix.js

8
src/js/matrix.js

@ -130,17 +130,11 @@ var extractFirstPartyDesDomain = function(srcHostname, desHostname) {
if ( srcHostname === '*' || desHostname === '*' || desHostname === '1st-party' ) { if ( srcHostname === '*' || desHostname === '*' || desHostname === '1st-party' ) {
return ''; return '';
} }
var srcLength = srcHostname.length;
var desLength = desHostname.length;
var len = srcLength < desLength ? srcLength : desLength;
if ( srcHostname.slice(-len) !== desHostname.slice(-len) ) {
return '';
}
var desDomain = µm.URI.domainFromHostname(desHostname); var desDomain = µm.URI.domainFromHostname(desHostname);
if ( desDomain === '' ) { if ( desDomain === '' ) {
return ''; return '';
} }
var pos = srcLength - desDomain.length;
var pos = srcHostname.length - desDomain.length;
if ( pos < 0 || srcHostname.slice(pos) !== desDomain ) { if ( pos < 0 || srcHostname.slice(pos) !== desDomain ) {
return ''; return '';
} }

Loading…
Cancel
Save