X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki.user.js;h=5f629e7dcb6d4a384e7a865dfc4ab575c5172fd8;hb=204d0df4d2bb8139109253f3da1df42cd455850c;hp=d9b1227bbbcd8e742860a733bbb38334d2ac1b80;hpb=12a9cf3110c9ea840b20f74b3d4a968c92d8b446;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki.user.js b/resources/src/mediawiki.user.js index d9b1227bbb..5f629e7dcb 100644 --- a/resources/src/mediawiki.user.js +++ b/resources/src/mediawiki.user.js @@ -136,10 +136,21 @@ }, /** - * Get an automatically generated random ID (persisted in sessionStorage) + * Retrieve a random ID persisted in sessionStorage, generating it if needed * - * This ID is ephemeral for everyone, staying in their browser only until they - * close their browsing session. + * This ID is stored in sessionStorage and persists within a single tab, + * including between page views through links and form submissions, + * and when going forwards/backwards in browser history, and when restoring + * a closed tab, or restoring a closed browser session. + * + * This is different from session cookies, because it is not shared between + * tabs of the same browser. Two simultaneous pageviews in the same browser + * can have different session IDs. The ID is also not re-used when opening + * a new tab to a website after fully closing others. + * + * See https://phabricator.wikimedia.org/T118063#4547178 and + * https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage + * for more information. * * @return {string} Random session ID */ @@ -173,7 +184,7 @@ var userGroups = mw.config.get( 'wgUserGroups', [] ); // Uses promise for backwards compatibility - return $.Deferred().resolve( userGroups ).done( callback ); + return $.Deferred().resolve( userGroups ).then( callback ); }, /** @@ -186,7 +197,7 @@ return getUserInfo().then( function ( userInfo ) { return userInfo.rights; }, function () { return []; } - ).done( callback ); + ).then( callback ); } } );