From: rwldrn Date: Wed, 16 Feb 2011 22:12:00 +0000 (-0500) Subject: [#347] Merges context fix and adds multi-context testing X-Git-Tag: v0.4~34^2~6 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=c0eeeae7b62da9198b19f18e49f2ab2d5f893fda;p=popcorn-js.git [#347] Merges context fix and adds multi-context testing --- diff --git a/plugins/flickr/popcorn.flickr.js b/plugins/flickr/popcorn.flickr.js index 18b5adb..6a731f5 100644 --- a/plugins/flickr/popcorn.flickr.js +++ b/plugins/flickr/popcorn.flickr.js @@ -84,7 +84,7 @@ uri += "tags="+tags+"&"; } - uri += "lang=en-us&format=json&jsoncallback=?"; + uri += "lang=en-us&format=json&jsoncallback=flickr"; Popcorn.xhr.getJSONP( uri, function( data ) { //$.getJSON( uri, function( data ) { diff --git a/popcorn.js b/popcorn.js index 846fad5..75056db 100644 --- a/popcorn.js +++ b/popcorn.js @@ -1000,17 +1000,16 @@ callback = params.length ? ( parts[1] ? parts[1] : parts[0] ) : "jsonp"; - if ( !paramStr && !isScript ) { url += "?callback=" + callback; } - if ( callback && !isScript ) { // If a callback name already exists... if ( !!window[ callback ] ) { - // Create a unique new callback name + + // Create a new unique callback name callback = Popcorn.guid( callback ); } @@ -1041,12 +1040,12 @@ // Executing for JSONP requests if ( fired || /loaded|complete/.test( script.readyState ) ) { - // cleanup in here + // Garbage collect the callback delete window[ callback ]; + // Garbage collect the script resource head.removeChild( script ); } - }; head.insertBefore( script, head.firstChild ); diff --git a/test/data/jsonp.php b/test/data/jsonp.php new file mode 100644 index 0000000..0a6a7e9 --- /dev/null +++ b/test/data/jsonp.php @@ -0,0 +1,14 @@ + \ No newline at end of file