summaryrefslogtreecommitdiffstats
path: root/js/ipc/JavaScriptTypes.ipdlh
blob: 5129fc304f99e80802a4112378ca48a41377f736 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 * vim: set ts=4 sw=4 et tw=80:
 *
 * 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/. */

include DOMTypes;

using struct mozilla::void_t from "ipc/IPCMessageUtils.h";

namespace mozilla {
namespace jsipc {

struct JSIID
{
    uint32_t m0;
    uint16_t m1;
    uint16_t m2;
    uint8_t m3_0;
    uint8_t m3_1;
    uint8_t m3_2;
    uint8_t m3_3;
    uint8_t m3_4;
    uint8_t m3_5;
    uint8_t m3_6;
    uint8_t m3_7;
};

struct LocalObject
{
    uint64_t serializedId;
};

struct RemoteObject
{
    uint64_t serializedId;
    bool isCallable;
    bool isConstructor;
    bool isDOMObject;
    nsCString objectTag;
};

union ObjectVariant
{
    LocalObject;
    RemoteObject;
};

struct WellKnownSymbol
{
    uint32_t which;
};

struct RegisteredSymbol
{
    nsString key;
};

union SymbolVariant
{
    WellKnownSymbol;
    RegisteredSymbol;
};

struct UndefinedVariant {};
struct NullVariant {};

union ObjectOrNullVariant
{
    ObjectVariant;
    NullVariant;
};

union JSVariant
{
    UndefinedVariant;
    NullVariant;
    ObjectVariant;
    SymbolVariant;
    nsString;   /* StringValue(x) */
    double;     /* NumberValue(x) */
    bool;       /* BooleanValue(x) */
    JSIID;      /* XPC nsIID */
};

union JSIDVariant
{
    SymbolVariant;
    nsString;
    int32_t;
};

struct ReturnSuccess
{
};

struct ReturnStopIteration
{
};

struct ReturnDeadCPOW
{
};

struct ReturnException
{
    JSVariant exn;
};

struct ReturnObjectOpResult
{
    uint32_t code;
};

union ReturnStatus
{
    ReturnSuccess;
    ReturnStopIteration;
    ReturnDeadCPOW;
    ReturnException;
    ReturnObjectOpResult;
};

union JSParam
{
    void_t;     /* value is strictly an xpc out param */
    JSVariant;  /* actual value to pass through */
};

union GetterSetter
{
    uint64_t;
    ObjectVariant;
};

struct PPropertyDescriptor
{
    ObjectOrNullVariant obj;
    uint32_t attrs;
    JSVariant value;

    // How to interpret these values depends on whether JSPROP_GETTER/SETTER
    // are set. If set, the corresponding value is a CPOW or 0 for NULL.
    // Otherwise, the following table is used:
    //
    //  0 - NULL
    //  1 - Default getter or setter.
    //  2 - Unknown
    GetterSetter getter;
    GetterSetter setter;
};

struct CpowEntry
{
  nsString name;
  JSVariant value;
};

}
}