From c0eeeae7b62da9198b19f18e49f2ab2d5f893fda Mon Sep 17 00:00:00 2001 From: rwldrn Date: Wed, 16 Feb 2011 17:12:00 -0500 Subject: [PATCH] [#347] Merges context fix and adds multi-context testing --- plugins/flickr/popcorn.flickr.js | 2 +- popcorn.js | 9 ++++----- test/data/jsonp.php | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 test/data/jsonp.php 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 -- 2.43.0