From 61129f8cdc877aefe2a995fb05efa213c77ae90c Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Mon, 31 Mar 2014 15:21:19 +0100 Subject: [PATCH] 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 --- includes/EditPage.php | 3 --- resources/Resources.php | 2 +- .../mediawiki.action/mediawiki.action.view.postEdit.js | 8 ++++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index dac2d55a75..7be6274d9d 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -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, ) ); } diff --git a/resources/Resources.php b/resources/Resources.php index 63e0ccdb2e..a58cfdc27a 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -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( diff --git a/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js b/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js index 3419b5a989..4d2c47a5d5 100644 --- a/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js +++ b/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js @@ -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 ) ); -- 2.20.1