Comparing version 0.0.2 to 0.0.3
@@ -55,7 +55,7 @@ /* See license.txt for terms of usage */ | ||
function jsonpReturn(o) { | ||
window.jsonp = undefined; | ||
if (o.error) { | ||
cb(o); | ||
self.jsonp = undefined; | ||
if (!o || o.error) { | ||
if (cb) cb(o); | ||
} else { | ||
cb(0, o); | ||
if (cb) cb(0, o); | ||
} | ||
@@ -65,3 +65,3 @@ } | ||
if (has('appjs')) { | ||
window.jsonp = jsonpReturn; | ||
self.jsonp = jsonpReturn; | ||
@@ -75,4 +75,4 @@ appjs.load(url, 'GET', {}, params, function(err, data) { | ||
}); | ||
} else { | ||
window.jsonp = function(o) { | ||
} else if (self.document) { | ||
self.jsonp = function(o) { | ||
// Return on a timeout to ensure that getJSON calls return asynchronously. There | ||
@@ -101,3 +101,15 @@ // is a case in IE where, after hitting the back button, this will return | ||
head.appendChild(script); | ||
} else { | ||
self.jsonp = jsonpReturn; | ||
var xhr = new XMLHttpRequest(); | ||
xhr.open('GET', url, true); | ||
xhr.onreadystatechange = function() { | ||
if (xhr.readyState == 4) { | ||
eval(xhr.responseText); | ||
self.jsonp = null; | ||
} | ||
} | ||
xhr.send(""); | ||
} | ||
} |
{ | ||
"name": "ajax", | ||
"description": "Utilities for loading JSON and XML.", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"homepage": "http://github.com/joehewitt/ajax", | ||
@@ -25,2 +25,2 @@ "repository": { | ||
"devDependencies": {} | ||
} | ||
} |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
4794
97