Skip to content

Commit

Permalink
[mozilla#347] Merges context fix and adds multi-context testing
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Feb 16, 2011
1 parent a1d6d71 commit c0eeeae
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion plugins/flickr/popcorn.flickr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
9 changes: 4 additions & 5 deletions popcorn.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down Expand Up @@ -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 );
Expand Down
14 changes: 14 additions & 0 deletions test/data/jsonp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

$callback = $_REQUEST['callback'];

if ( !$callback ) {

$callback = explode( "?", end( explode( "/", $_SERVER['REQUEST_URI']) ) );
$callback = $callback[0];

}

echo $callback . '({ "data": {"lang": "en", "length": 25} });';

?>

0 comments on commit c0eeeae

Please sign in to comment.