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]
|
2022-09-21 10:44:58 +03:00
|
|
|
setter undefined setItem(DOMString key, DOMString value);
|
2014-07-23 09:07:12 +04:00
|
|
|
|
2016-10-03 17:10:27 +03:00
|
|
|
[Throws, NeedsSubjectPrincipal]
|
2022-09-21 10:44:58 +03:00
|
|
|
deleter undefined removeItem(DOMString key);
|
2014-07-23 09:07:12 +04:00
|
|
|
|
2016-10-03 17:10:27 +03:00
|
|
|
[Throws, NeedsSubjectPrincipal]
|
2022-09-21 10:44:58 +03:00
|
|
|
undefined 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"]
|
2022-09-21 10:44:58 +03:00
|
|
|
undefined open();
|
2018-11-29 23:48:11 +03:00
|
|
|
|
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"]
|
2022-09-21 10:44:58 +03:00
|
|
|
undefined 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"]
|
2022-09-21 10:44:58 +03:00
|
|
|
undefined beginExplicitSnapshot();
|
2018-11-29 23:48:54 +03:00
|
|
|
|
2022-03-09 12:43:09 +03:00
|
|
|
/**
|
|
|
|
* Checkpoints the explicitly begun snapshot. This is only useful for testing
|
|
|
|
* of snapshot re-using when multiple checkpoints are involved. There's no
|
|
|
|
* need to call this before `endExplicitSnapshot` because it checkpoints the
|
|
|
|
* snapshot before it's ended.
|
|
|
|
*/
|
|
|
|
[Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"]
|
2022-09-21 10:44:58 +03:00
|
|
|
undefined checkpointExplicitSnapshot();
|
2022-03-09 12:43:09 +03:00
|
|
|
|
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"]
|
2022-09-21 10:44:58 +03:00
|
|
|
undefined endExplicitSnapshot();
|
2019-06-02 09:00:25 +03:00
|
|
|
|
|
|
|
/**
|
2022-02-17 18:09:58 +03:00
|
|
|
* Returns true if the underlying database has been opened, the database is
|
|
|
|
* not being closed and it has a snapshot (initialized implicitly or
|
|
|
|
* explicitly).
|
2019-06-02 09:00:25 +03:00
|
|
|
*/
|
|
|
|
[Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"]
|
2022-02-17 18:09:58 +03:00
|
|
|
readonly attribute boolean hasSnapshot;
|
2022-02-18 07:30:46 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns snapshot usage.
|
|
|
|
*
|
|
|
|
* @throws NS_ERROR_NOT_AVAILABLE if the underlying database hasn't been
|
|
|
|
* opened or the database is being closed or it doesn't have a
|
|
|
|
* snapshot.
|
|
|
|
*/
|
|
|
|
[Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"]
|
|
|
|
readonly attribute long long snapshotUsage;
|
2018-11-29 23:48:11 +03:00
|
|
|
};
|