2018-09-13 23:04:55 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2014-07-23 09:07:12 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* The origin of this IDL file is
|
|
|
|
* http://www.whatwg.org/html/#the-storage-interface
|
|
|
|
*
|
|
|
|
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
|
|
|
* Opera Software ASA. You are granted a license to use, reproduce
|
|
|
|
* and create derivative works of this document.
|
|
|
|
*/
|
|
|
|
|
2019-09-27 18:26:14 +03:00
|
|
|
[Exposed=Window]
|
2014-07-23 09:07:12 +04:00
|
|
|
interface Storage {
|
2016-10-03 17:10:27 +03:00
|
|
|
[Throws, NeedsSubjectPrincipal]
|
2014-07-23 09:07:12 +04:00
|
|
|
readonly attribute unsigned long length;
|
|
|
|
|
2016-10-03 17:10:27 +03:00
|
|
|
[Throws, NeedsSubjectPrincipal]
|
2014-07-23 09:07:12 +04:00
|
|
|
DOMString? key(unsigned long index);
|
|
|
|
|
2016-10-03 17:10:27 +03:00
|
|
|
[Throws, NeedsSubjectPrincipal]
|
2014-07-23 09:07:12 +04:00
|
|
|
getter DOMString? getItem(DOMString key);
|
|
|
|
|
2016-10-03 17:10:27 +03:00
|
|
|
[Throws, NeedsSubjectPrincipal]
|
2017-11-04 07:36:10 +03:00
|
|
|
setter void setItem(DOMString key, DOMString value);
|
2014-07-23 09:07:12 +04:00
|
|
|
|
2016-10-03 17:10:27 +03:00
|
|
|
[Throws, NeedsSubjectPrincipal]
|
2014-07-23 09:07:12 +04:00
|
|
|
deleter void removeItem(DOMString key);
|
|
|
|
|
2016-10-03 17:10:27 +03:00
|
|
|
[Throws, NeedsSubjectPrincipal]
|
2014-07-23 09:07:12 +04:00
|
|
|
void clear();
|
2015-12-09 23:47:53 +03:00
|
|
|
|
|
|
|
[ChromeOnly]
|
|
|
|
readonly attribute boolean isSessionOnly;
|
2014-07-23 09:07:12 +04:00
|
|
|
};
|
2018-11-29 23:48:11 +03:00
|
|
|
|
2018-11-05 22:04:39 +03:00
|
|
|
/**
|
|
|
|
* Testing methods that exist only for the benefit of automated glass-box
|
|
|
|
* testing. Will never be exposed to content at large and unlikely to be useful
|
|
|
|
* in a WebDriver context.
|
|
|
|
*/
|
2018-11-29 23:48:11 +03:00
|
|
|
partial interface Storage {
|
2018-11-05 22:04:39 +03:00
|
|
|
/**
|
|
|
|
* Does a security-check and ensures the underlying database has been opened
|
|
|
|
* without actually calling any database methods. (Read-only methods will
|
|
|
|
* have a similar effect but also impact the state of the snapshot.)
|
|
|
|
*/
|
2018-11-29 23:48:11 +03:00
|
|
|
[Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"]
|
|
|
|
void open();
|
|
|
|
|
2018-11-05 22:04:39 +03:00
|
|
|
/**
|
|
|
|
* Automatically ends any explicit snapshot and drops the reference to the
|
|
|
|
* underlying database, but does not otherwise perturb the database.
|
|
|
|
*/
|
2018-11-29 23:48:11 +03:00
|
|
|
[Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"]
|
|
|
|
void close();
|
2018-11-29 23:48:54 +03:00
|
|
|
|
2018-11-05 22:04:39 +03:00
|
|
|
/**
|
|
|
|
* Ensures the database has been opened and initiates an explicit snapshot.
|
|
|
|
* Snapshots are normally automatically ended and checkpointed back to the
|
|
|
|
* parent, but explicitly opened snapshots must be explicitly ended via
|
|
|
|
* `endExplicitSnapshot` or `close`.
|
|
|
|
*/
|
2018-11-29 23:48:54 +03:00
|
|
|
[Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"]
|
|
|
|
void beginExplicitSnapshot();
|
|
|
|
|
2018-11-05 22:04:39 +03:00
|
|
|
/**
|
|
|
|
* Ends the explicitly begun snapshot and retains the underlying database.
|
|
|
|
* Compare with `close` which also drops the reference to the database.
|
|
|
|
*/
|
2018-11-29 23:48:54 +03:00
|
|
|
[Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"]
|
|
|
|
void endExplicitSnapshot();
|
2019-06-02 09:00:25 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the underlying database has been opened and it has an
|
|
|
|
* active snapshot (initialized implicitly or explicitly).
|
|
|
|
*/
|
|
|
|
[Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"]
|
|
|
|
readonly attribute boolean hasActiveSnapshot;
|
2018-11-29 23:48:11 +03:00
|
|
|
};
|