jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/328492 )

Change subject: Avoid security exception for illegal localStorage access
......................................................................


Avoid security exception for illegal localStorage access

Change-Id: I5962ab9cc74dee56d641281dfa9250ad1e62dab6
---
M wikibase/queryService/ui/editor/Editor.js
1 file changed, 15 insertions(+), 10 deletions(-)

Approvals:
  Smalyshev: Looks good to me, approved
  jenkins-bot: Verified
  Thiemo Mättig (WMDE): Looks good to me, but someone else must approve



diff --git a/wikibase/queryService/ui/editor/Editor.js 
b/wikibase/queryService/ui/editor/Editor.js
index 59be04b..d3258c7 100644
--- a/wikibase/queryService/ui/editor/Editor.js
+++ b/wikibase/queryService/ui/editor/Editor.js
@@ -3,8 +3,7 @@
 wikibase.queryService.ui = wikibase.queryService.ui || {};
 wikibase.queryService.ui.editor = wikibase.queryService.ui.editor || {};
 
-wikibase.queryService.ui.editor.Editor = ( function( $, wikibase, CodeMirror, 
WikibaseRDFTooltip,
-               localStorage ) {
+wikibase.queryService.ui.editor.Editor = ( function( $, wikibase, CodeMirror, 
WikibaseRDFTooltip ) {
        'use strict';
 
        var CODEMIRROR_DEFAULTS = {
@@ -241,8 +240,11 @@
         * @param {string} value
         */
        SELF.prototype.storeValue = function( value ) {
-               if ( localStorage ) {
-                       localStorage.setItem( LOCAL_STORAGE_KEY, value );
+               try {
+                       if ( localStorage ) {
+                               localStorage.setItem( LOCAL_STORAGE_KEY, value 
);
+                       }
+               } catch ( e ) {
                }
        };
 
@@ -250,12 +252,15 @@
         * Restores the value from the local storage
         */
        SELF.prototype.restoreValue = function() {
-               if ( localStorage ) {
-                       var value = localStorage.getItem( LOCAL_STORAGE_KEY );
-                       if ( value ) {
-                               this.setValue( value );
-                               this.refresh();
+               try {
+                       if ( localStorage ) {
+                               var value = localStorage.getItem( 
LOCAL_STORAGE_KEY );
+                               if ( value ) {
+                                       this.setValue( value );
+                                       this.refresh();
+                               }
                        }
+               } catch ( e ) {
                }
        };
 
@@ -271,4 +276,4 @@
 
        return SELF;
 
-}( jQuery, wikibase, CodeMirror, window.localStorage ) );
+}( jQuery, wikibase, CodeMirror ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/328492
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5962ab9cc74dee56d641281dfa9250ad1e62dab6
Gerrit-PatchSet: 3
Gerrit-Project: wikidata/query/gui
Gerrit-Branch: master
Gerrit-Owner: Jonas Kress (WMDE) <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to