Debian Codegraph @

closure-library/closure/goog/storage/mechanism/html5sessionstorage.js

raw
1 // Copyright 2011 The Closure Library Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS-IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 /**
16 * @fileoverview Provides data persistence using HTML5 session storage
17 * mechanism. Session storage must be available under window.sessionStorage,
18 * see: http://www.w3.org/TR/webstorage/#the-sessionstorage-attribute.
19 *
20 */
21
22 goog.provide('goog.storage.mechanism.HTML5SessionStorage');
23
24 goog.require('goog.storage.mechanism.HTML5WebStorage');
25
26
27
28 /**
29 * Provides a storage mechanism that uses HTML5 session storage.
30 *
31 * @constructor
32 * @struct
33 * @extends {goog.storage.mechanism.HTML5WebStorage}
34 */
35 goog.storage.mechanism.HTML5SessionStorage = function() {
36 var storage = null;
37
38 try {
39 // May throw an exception in cases where the session storage object is
40 // visible but access to it is disabled. For example, accessing the file
41 // in local mode in Firefox throws 'Operation is not supported' exception.
42 storage = window.sessionStorage || null;
43 } catch (e) {
44 }
45 goog.storage.mechanism.HTML5SessionStorage.base(this, 'constructor', storage);
46 };
47 goog.inherits(
48 goog.storage.mechanism.HTML5SessionStorage,
49 goog.storage.mechanism.HTML5WebStorage);