2018-11-29 23:47:20 +03: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/. */
|
|
|
|
|
2018-11-29 23:47:45 +03:00
|
|
|
include protocol PBackgroundLSObject;
|
2018-11-29 23:47:20 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2018-11-29 23:47:55 +03:00
|
|
|
struct LSNotifyInfo
|
|
|
|
{
|
|
|
|
bool changed;
|
|
|
|
nsString oldValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
union LSWriteOpResponse
|
|
|
|
{
|
|
|
|
nsresult;
|
|
|
|
LSNotifyInfo;
|
|
|
|
};
|
|
|
|
|
2018-11-29 23:47:20 +03:00
|
|
|
sync protocol PBackgroundLSDatabase
|
|
|
|
{
|
2018-11-29 23:47:45 +03:00
|
|
|
manager PBackgroundLSObject;
|
2018-11-29 23:47:20 +03:00
|
|
|
|
|
|
|
parent:
|
|
|
|
// The DeleteMe message is used to avoid a race condition between the parent
|
|
|
|
// actor and the child actor. The PBackgroundLSDatabase protocol could be
|
|
|
|
// simply destroyed by sending the __delete__ message from the child side.
|
|
|
|
// However, that would destroy the child actor immediatelly and the parent
|
|
|
|
// could be sending a message to the child at the same time resulting in a
|
|
|
|
// routing error since the child actor wouldn't exist anymore. A routing
|
|
|
|
// error typically causes a crash. The race can be prevented by doing the
|
|
|
|
// teardown in two steps. First, we send the DeleteMe message to the parent
|
|
|
|
// and the parent then sends the __delete__ message to the child.
|
|
|
|
async DeleteMe();
|
|
|
|
|
2018-11-29 23:47:24 +03:00
|
|
|
async AllowToClose();
|
|
|
|
|
2018-11-29 23:47:20 +03:00
|
|
|
sync GetLength()
|
|
|
|
returns (uint32_t length);
|
|
|
|
|
|
|
|
sync GetKey(uint32_t index)
|
|
|
|
returns (nsString key);
|
|
|
|
|
|
|
|
sync GetItem(nsString key)
|
|
|
|
returns (nsString value);
|
|
|
|
|
|
|
|
sync GetKeys()
|
|
|
|
returns (nsString[] keys);
|
|
|
|
|
2018-11-29 23:47:45 +03:00
|
|
|
sync SetItem(nsString key, nsString value)
|
2018-11-29 23:47:55 +03:00
|
|
|
returns (LSWriteOpResponse response);
|
2018-11-29 23:47:20 +03:00
|
|
|
|
2018-11-29 23:47:45 +03:00
|
|
|
sync RemoveItem(nsString key)
|
2018-11-29 23:47:55 +03:00
|
|
|
returns (LSWriteOpResponse response);
|
2018-11-29 23:47:20 +03:00
|
|
|
|
2018-11-29 23:47:45 +03:00
|
|
|
sync Clear()
|
2018-11-29 23:47:55 +03:00
|
|
|
returns (LSWriteOpResponse response);
|
2018-11-29 23:47:20 +03:00
|
|
|
|
|
|
|
child:
|
|
|
|
async __delete__();
|
2018-11-29 23:47:24 +03:00
|
|
|
|
|
|
|
async RequestAllowToClose();
|
2018-11-29 23:47:20 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|