Delete the post-edit cookie using the correct domain

Use the mediawiki.cookie#set to delete the post-edit cookie so that the
correct domain is used.

Bug: 61979
Change-Id: I0cba8d1421f359ff78f3f994af358e9997f27041
This commit is contained in:
Sam Smith 2014-03-31 15:21:19 +01:00 committed by Matthew Flaschen
parent 93afb008c2
commit 61129f8cdc
3 changed files with 5 additions and 8 deletions

View file

@ -1209,8 +1209,6 @@ class EditPage {
* marked HttpOnly. The JavaScript code converts the cookie to a wgPostEdit config
* variable.
*
* We use a path of '/' since wgCookiePath is not exposed to JS
*
* If the variable were set on the server, it would be cached, which is unwanted
* since the post-edit state should only apply to the load right after the save.
*
@ -1229,7 +1227,6 @@ class EditPage {
$response = RequestContext::getMain()->getRequest()->response();
$response->setcookie( $postEditKey, $val, time() + self::POST_EDIT_COOKIE_DURATION, array(
'path' => '/',
'httpOnly' => false,
) );
}

View file

@ -994,7 +994,7 @@ return array(
'scripts' => 'resources/src/mediawiki.action/mediawiki.action.view.postEdit.js',
'styles' => 'resources/src/mediawiki.action/mediawiki.action.view.postEdit.css',
'dependencies' => array(
'jquery.cookie',
'mediawiki.cookie',
'mediawiki.jqueryMsg'
),
'messages' => array(

View file

@ -18,10 +18,10 @@
* @member mw.hook
*/
var config = mw.config.get( [ 'wgAction', 'wgCookiePrefix', 'wgCurRevisionId' ] ),
var config = mw.config.get( [ 'wgAction', 'wgCurRevisionId' ] ),
// This should match EditPage::POST_EDIT_COOKIE_KEY_PREFIX:
cookieKey = config.wgCookiePrefix + 'PostEditRevision' + config.wgCurRevisionId,
cookieVal = $.cookie( cookieKey ),
cookieKey = 'PostEditRevision' + config.wgCurRevisionId,
cookieVal = mw.cookie.get( cookieKey ),
$div, id;
function showConfirmation( data ) {
@ -80,7 +80,7 @@
mw.user
)
} );
$.cookie( cookieKey, null, { path: '/' } );
mw.cookie.set( cookieKey, null );
}
} ( mediaWiki, jQuery ) );