r47809 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47808‎ | r47809 | r47810 >
Date:17:38, 25 February 2009
Author:jojo
Status:ok (Comments)
Tags:
Comment:
set appropriate Content-Type in responses for XHR calls
Modified paths:
  • /trunk/extensions/Collection/Collection.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.php
@@ -129,7 +129,9 @@
130130 } else {
131131 $collection = array();
132132 }
133 - return $json->encode( array( 'collection' => $collection ) );
 133+ $r = new AjaxResponse( $json->encode( array( 'collection' => $collection ) ) );
 134+ $r->setContentType( 'application/json' );
 135+ return $r;
134136 }
135137
136138 $wgAjaxExportList[] = 'wfAjaxGetCollection';
@@ -141,7 +143,9 @@
142144 }
143145 $collection = $json->decode( $collection );
144146 $_SESSION['wsCollection'] = $collection;
145 - return $json->encode( array( 'collection' => $collection ) );
 147+ $r = new AjaxResponse( $json->encode( array( 'collection' => $collection ) ) );
 148+ $r->setContentType( 'application/json' );
 149+ return $r;
146150 }
147151
148152 $wgAjaxExportList[] = 'wfAjaxPostCollection';
@@ -152,7 +156,9 @@
153157 'collection_id' => $collection_id,
154158 'writer' => $writer
155159 ) );
156 - return $json->encode( $result );
 160+ $r = new AjaxResponse( $json->encode( $result ) );
 161+ $r->setContentType( 'application/json' );
 162+ return $r;
157163 }
158164
159165 $wgAjaxExportList[] = 'wfAjaxGetMWServeStatus';

Comments

#Comment by Brion VIBBER (talk | contribs)   18:09, 25 February 2009

XSS fix.

Status & tagging log