Revision control

Copy as Markdown

typedef string TabsGuid;
// a local timestamp, a custom type to avoid using the int directly.
typedef i64 Timestamp;
typedef extern DeviceType;
namespace tabs {
interface TabsApiError {
SyncError(string reason);
SqlError(string reason);
UnexpectedTabsError(string reason);
interface TabsStore {
constructor(string path);
sequence<ClientRemoteTabs> get_all();
void set_local_tabs(sequence<RemoteTabRecord> remote_tabs);
RemoteCommandStore new_remote_command_store();
void register_with_sync_manager();
TabsBridgedEngine bridged_engine();
dictionary RemoteTabRecord {
string title;
sequence<string> url_history;
string? icon;
// Number of ms since the unix epoch (as reported by the client's clock)
i64 last_used;
boolean inactive = false;
dictionary ClientRemoteTabs {
string client_id;
string client_name;
DeviceType device_type;
// Number of ms since the unix epoch (as reported by the server's clock)
i64 last_modified;
sequence<RemoteTabRecord> remote_tabs;
/// A command which should be sent to a remote device.
interface RemoteCommand {
CloseTab(string url);
// CloseInactive(); ??
interface RemoteCommandStore {
/// Add a new command, after which it will be pending. Returns false if the command is already active.
boolean add_remote_command([ByRef] string device_id, [ByRef] RemoteCommand command);
/// Add a new command with an explicit timestamp. Primarily used by tests.
boolean add_remote_command_at([ByRef] string device_id, [ByRef] RemoteCommand command, Timestamp when);
/// Removes the remote command. Typically used to implement "undo" but may also be used by the queue
/// processor when it gives up trying to send a command.
boolean remove_remote_command([ByRef] string device_id, [ByRef] RemoteCommand command);
/// Return all unsent commands. This is for the code sending the commands, result is sorted by time_requested.
sequence<PendingCommand> get_unsent_commands();
/// Flag a command as sent.
boolean set_pending_command_sent([ByRef]PendingCommand command);
/// Represents a "pending" command.
dictionary PendingCommand {
string device_id;
RemoteCommand command;
Timestamp time_requested;
Timestamp? time_sent;
// It's only actually used in desktop, but it's fine to expose this everywhere.
// NOTE: all timestamps here are milliseconds.
interface TabsBridgedEngine {
//readonly attribute long storageVersion;
// readonly attribute boolean allowSkippedRecord;
// XXX - better logging story than this?
// attribute mozIServicesLogSink logger;
i64 last_sync();
void set_last_sync(i64 last_sync);
string? sync_id();
string reset_sync_id();
string ensure_current_sync_id([ByRef]string new_sync_id);
void prepare_for_sync([ByRef]string client_data);
void sync_started();
void store_incoming(sequence<string> incoming_envelopes_as_json);
sequence<string> apply();
void set_uploaded(i64 new_timestamp, sequence<TabsGuid> uploaded_ids);
void sync_finished();
void reset();
void wipe();