#1134: code review to fix unwanted side effect if previous fix

This commit is contained in:
gorhill 2015-03-31 07:51:01 -04:00
parent 91e143008f
commit 12fc8faf3a
1 changed files with 11 additions and 0 deletions

View File

@ -319,10 +319,21 @@ var is3rdParty = function(srcHostname, desHostname) {
if ( desHostname === '*' ) {
return false;
}
// This case occurs for matrix rendering
if ( srcHostname === '*' ) {
return false;
}
var srcDomain = domainFromHostname(srcHostname);
// This can very well occurs, for examples:
// - localhost
// - file-scheme
// etc.
if ( srcDomain === '' ) {
srcDomain = srcHostname !== '' ? srcHostname : desHostname;
}
if ( desHostname.slice(0 - srcDomain.length) !== srcDomain ) {
return true;
}