2015-03-19 10:48:28 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* 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/.
|
|
|
|
*/
|
|
|
|
|
2015-10-12 05:36:31 +03:00
|
|
|
enum PresentationConnectionState
|
2015-03-19 10:48:28 +03:00
|
|
|
{
|
|
|
|
// Existing presentation, and the communication channel is active.
|
|
|
|
"connected",
|
|
|
|
|
|
|
|
// Existing presentation, but the communication channel is inactive.
|
2015-10-08 13:11:10 +03:00
|
|
|
"closed",
|
2015-03-19 10:48:28 +03:00
|
|
|
|
|
|
|
// The presentation is nonexistent anymore. It could be terminated manually,
|
2015-10-08 13:11:10 +03:00
|
|
|
// or either controlling or receiving browsing context is no longer available.
|
2015-03-19 10:48:28 +03:00
|
|
|
"terminated"
|
|
|
|
};
|
|
|
|
|
|
|
|
[Pref="dom.presentation.enabled",
|
2015-10-21 09:01:08 +03:00
|
|
|
Func="Navigator::HasPresentationSupport"]
|
2015-10-12 05:36:31 +03:00
|
|
|
interface PresentationConnection : EventTarget {
|
2015-03-19 10:48:28 +03:00
|
|
|
/*
|
2015-10-12 05:36:31 +03:00
|
|
|
* Unique id for all existing connections.
|
2015-03-19 10:48:28 +03:00
|
|
|
*/
|
|
|
|
[Constant]
|
|
|
|
readonly attribute DOMString id;
|
|
|
|
|
|
|
|
/*
|
2015-10-08 13:11:10 +03:00
|
|
|
* @value "connected", "closed", or "terminated".
|
2015-03-19 10:48:28 +03:00
|
|
|
*/
|
2015-10-12 05:36:31 +03:00
|
|
|
readonly attribute PresentationConnectionState state;
|
2015-03-19 10:48:28 +03:00
|
|
|
|
|
|
|
/*
|
2015-10-12 05:36:31 +03:00
|
|
|
* It is called when connection state changes.
|
2015-03-19 10:48:28 +03:00
|
|
|
*/
|
|
|
|
attribute EventHandler onstatechange;
|
|
|
|
|
|
|
|
/*
|
2015-10-08 13:11:10 +03:00
|
|
|
* After a communication channel has been established between the controlling
|
|
|
|
* and receiving context, this function is called to send message out, and the
|
|
|
|
* event handler "onmessage" will be invoked at the remote side.
|
2015-03-19 10:48:28 +03:00
|
|
|
*
|
2015-10-08 13:11:10 +03:00
|
|
|
* This function only works when the state is "connected".
|
2015-03-19 10:48:28 +03:00
|
|
|
*
|
2016-04-11 06:20:55 +03:00
|
|
|
* TODO bug 1228474 Implement PresentationSessionTransport with DataChannel to
|
2015-10-08 13:11:10 +03:00
|
|
|
* support other binary types.
|
2015-03-19 10:48:28 +03:00
|
|
|
*/
|
|
|
|
[Throws]
|
|
|
|
void send(DOMString data);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* It is triggered when receiving messages.
|
|
|
|
*/
|
|
|
|
attribute EventHandler onmessage;
|
|
|
|
|
|
|
|
/*
|
2015-10-12 05:36:31 +03:00
|
|
|
* Both the controlling and receiving browsing context can close the
|
|
|
|
* connection. Then the connection state should turn into "closed".
|
2015-10-08 13:11:10 +03:00
|
|
|
*
|
|
|
|
* This function only works when the state is not "connected".
|
|
|
|
*/
|
|
|
|
// TODO Bug 1210340 - Support close semantics.
|
|
|
|
// [Throws]
|
|
|
|
// void close();
|
|
|
|
|
|
|
|
/*
|
2015-10-12 05:36:31 +03:00
|
|
|
* Both the controlling and receiving browsing context can terminate the
|
|
|
|
* connection. Then the connection state should turn into "terminated".
|
2015-03-19 10:48:28 +03:00
|
|
|
*
|
2015-10-08 13:11:10 +03:00
|
|
|
* This function only works when the state is not "connected".
|
2015-03-19 10:48:28 +03:00
|
|
|
*/
|
2015-10-08 13:11:10 +03:00
|
|
|
[Throws]
|
|
|
|
void terminate();
|
2015-03-19 10:48:28 +03:00
|
|
|
};
|