tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsIWebSocketEventService.idl (3389B)


      1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #include "domstubs.idl"
      7 #include "nsISupports.idl"
      8 
      9 interface nsIWeakReference;
     10 
     11 [scriptable, builtinclass, uuid(6714a6be-2265-4f73-a988-d78a12416037)]
     12 interface nsIWebSocketFrame : nsISupports
     13 {
     14  [must_use] readonly attribute DOMHighResTimeStamp timeStamp;
     15 
     16  [must_use] readonly attribute boolean finBit;
     17 
     18  [must_use] readonly attribute boolean rsvBit1;
     19  [must_use] readonly attribute boolean rsvBit2;
     20  [must_use] readonly attribute boolean rsvBit3;
     21 
     22  [must_use] readonly attribute unsigned short opCode;
     23 
     24  [must_use] readonly attribute boolean maskBit;
     25 
     26  [must_use] readonly attribute unsigned long mask;
     27 
     28  [must_use] readonly attribute ACString payload;
     29 
     30  // Non-Control opCode values:
     31  const unsigned short OPCODE_CONTINUATION = 0x0;
     32  const unsigned short OPCODE_TEXT         = 0x1;
     33  const unsigned short OPCODE_BINARY       = 0x2;
     34 
     35  // Control opCode values:
     36  const unsigned short OPCODE_CLOSE        = 0x8;
     37  const unsigned short OPCODE_PING         = 0x9;
     38  const unsigned short OPCODE_PONG         = 0xA;
     39 };
     40 
     41 [scriptable, uuid(e7c005ab-e694-489b-b741-96db43ffb16f)]
     42 interface nsIWebSocketEventListener : nsISupports
     43 {
     44  [must_use] void webSocketCreated(in unsigned long aWebSocketSerialID,
     45                                   in AString aURI,
     46                                   in ACString aProtocols);
     47 
     48  [must_use] void webSocketOpened(in unsigned long aWebSocketSerialID,
     49                                  in AString aEffectiveURI,
     50                                  in ACString aProtocols,
     51                                  in ACString aExtensions,
     52                                  in uint64_t aHttpChannelId);
     53 
     54  const unsigned short TYPE_STRING      = 0x0;
     55  const unsigned short TYPE_BLOB        = 0x1;
     56  const unsigned short TYPE_ARRAYBUFFER = 0x2;
     57 
     58  [must_use] void webSocketMessageAvailable(in unsigned long aWebSocketSerialID,
     59                                            in ACString aMessage,
     60                                            in unsigned short aType);
     61 
     62  [must_use] void webSocketClosed(in unsigned long aWebSocketSerialID,
     63                                  in boolean aWasClean,
     64                                  in unsigned short aCode,
     65                                  in AString aReason);
     66 
     67  [must_use] void frameReceived(in unsigned long aWebSocketSerialID,
     68                                in nsIWebSocketFrame aFrame);
     69 
     70  [must_use] void frameSent(in unsigned long aWebSocketSerialID,
     71                            in nsIWebSocketFrame aFrame);
     72 };
     73 
     74 [scriptable, builtinclass, uuid(b89d1b90-2cf3-4d8f-ac21-5aedfb25c760)]
     75 interface nsIWebSocketEventService : nsISupports
     76 {
     77  [must_use] void sendMessage(in unsigned long aWebSocketSerialID,
     78                              in AString aMessage);
     79 
     80  [must_use] void addListener(in unsigned long long aInnerWindowID,
     81                              in nsIWebSocketEventListener aListener);
     82 
     83  [must_use] void removeListener(in unsigned long long aInnerWindowID,
     84                                 in nsIWebSocketEventListener aListener);
     85 
     86  [must_use] boolean hasListenerFor(in unsigned long long aInnerWindowID);
     87 };