Skip to content

Commit

Permalink
put cross-domain Ajax checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger Hu committed Mar 29, 2012
1 parent 9b7483a commit 6c404fe
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tracekit.js
Expand Up @@ -274,7 +274,15 @@ TraceKit.computeStackTrace = (function () {
*/
function getSource(url) {
if (!sourceCache.hasOwnProperty(url)) {
var source = loadSource(url);
// URL needs to be able to fetched within the acceptable domain. Otherwise,
// cross-domain errors will be triggered.
var source;
if (url.indexOf(document.domain) != -1) {
source = loadSource(url);
}
else {
source = [];
}
sourceCache[url] = source.length ? source.split("\n") : [];
}

Expand Down

0 comments on commit 6c404fe

Please sign in to comment.