mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-24 08:13:38 +00:00
Work even when cookies are disabled
When cookies are disabled in Firefox, merely referencing window.localStorage is enough to cause Firefox to throw a SecurityError exception. (See the referenced bug for reproduction instructions.) This causes MMV to fail to start. Bug: T109110 Change-Id: I28399cf8b63328ee34316b785f2d091f6f052224
This commit is contained in:
parent
63a292655a
commit
1a0ee6d2a1
|
@ -24,6 +24,12 @@
|
|||
* @class mw.mmv.MultimediaViewerBootstrap
|
||||
*/
|
||||
function MultimediaViewerBootstrap () {
|
||||
var localStorage = false;
|
||||
|
||||
try {
|
||||
localStorage = window.localStorage || false;
|
||||
} catch ( e ) { }
|
||||
|
||||
this.validExtensions = {
|
||||
'jpg' : true,
|
||||
'jpeg' : true,
|
||||
|
@ -47,7 +53,7 @@
|
|||
mw.config,
|
||||
mw.user,
|
||||
new mw.Api(),
|
||||
window.localStorage
|
||||
localStorage
|
||||
);
|
||||
|
||||
/** @property {mw.mmv.HtmlUtils} htmlUtils - */
|
||||
|
|
|
@ -25,13 +25,18 @@
|
|||
* @constructor
|
||||
*/
|
||||
function LightboxInterface() {
|
||||
this.localStorage = false;
|
||||
try {
|
||||
this.localStorage = window.localStorage || false;
|
||||
} catch ( e ) {}
|
||||
|
||||
/** @property {mw.mmv.Config} config - */
|
||||
this.config = new mw.mmv.Config(
|
||||
mw.config.get( 'wgMultimediaViewer', {} ),
|
||||
mw.config,
|
||||
mw.user,
|
||||
new mw.Api(),
|
||||
window.localStorage
|
||||
this.localStorage
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -96,7 +101,7 @@
|
|||
|
||||
this.setupCanvasButtons();
|
||||
|
||||
this.panel = new mw.mmv.ui.MetadataPanel( this.$postDiv, this.$aboveFold, window.localStorage, this.config );
|
||||
this.panel = new mw.mmv.ui.MetadataPanel( this.$postDiv, this.$aboveFold, this.localStorage, this.config );
|
||||
this.buttons = new mw.mmv.ui.CanvasButtons( this.$preDiv, this.$closeButton, this.$fullscreenButton );
|
||||
this.canvas = new mw.mmv.ui.Canvas( this.$innerWrapper, this.$imageWrapper, this.$wrapper );
|
||||
|
||||
|
|
Loading…
Reference in a new issue