Skip to content

Commit

Permalink
Updated to use CORs and ignore http(s):// links in the optimiser
Browse files Browse the repository at this point in the history
  • Loading branch information
fewstera committed Oct 21, 2016
1 parent d04de4f commit aa27ef6
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions text.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,7 @@ define(['module'], function (module) {
* @returns Boolean
*/
useXhr: function (url, protocol, hostname, port) {
var uProtocol, uHostName, uPort,
match = text.xdRegExp.exec(url);
if (!match) {
return true;
}
uProtocol = match[2];
uHostName = match[3];

uHostName = uHostName.split(':');
uPort = uHostName[1];
uHostName = uHostName[0];

return (!uProtocol || uProtocol === protocol) &&
(!uHostName || uHostName.toLowerCase() === hostname.toLowerCase()) &&
((!uPort && !uHostName) || isSamePort(uProtocol, uPort, protocol, port));
return true;
},

finishLoad: function (name, strip, content, onLoad) {
Expand Down Expand Up @@ -193,6 +179,13 @@ define(['module'], function (module) {
useXhr = (masterConfig.useXhr) ||
text.useXhr;


// Do not load an external and we're building
if (config && config.isBuild && url.match(/^(https?:\/\/)/)) {
onLoad();
return;
}

// Do not load if it is an empty: url
if (url.indexOf('empty:') === 0) {
onLoad();
Expand Down

0 comments on commit aa27ef6

Please sign in to comment.