1// Copyright 2020 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5syntax = "proto3"; 6 7package identifiability.blink_apis; 8 9message Snapshot { 10 string chromium_revision = 1; 11 12 repeated InterfaceLike interfaces = 2; 13 repeated InterfaceLike namespaces = 3; 14 repeated Dictionary dictionaries = 4; 15 repeated Enumeration enumerations = 5; 16 repeated Operation callback_functions = 6; 17 repeated InterfaceLike callback_interfaces = 7; 18 repeated Typedef typedefs = 8; 19} 20 21// Type of HighEntropy. 22enum HighEntropyType { 23 // Invalid value. Means that the field is uninitialized. 24 HIGH_ENTROPY_UNSPECIFIED = 0; 25 26 // Not a source of identifiable information. 27 HIGH_ENTROPY_BENIGN = 1; 28 29 // A source of identifiable information. But the surface doesn't have 30 // a classification. 31 HIGH_ENTROPY_UNCLASSIFIED = 2; 32 33 // A source of identifiable information. The mapping from the inputs to the 34 // output of the annotated API directly conveys the identifiable information. 35 HIGH_ENTROPY_DIRECT = 3; 36} 37 38// Includes both WebIDL defined extended attributes as well as Chromium specific 39// custom extended attributes. 40// 41// The latter are described in: 42// https://chromium.googlesource.com/chromium/src/+/master/third_party/blink/renderer/bindings/IDLExtendedAttributes.md 43message ExtendedAttributes { 44 // https://heycam.github.io/webidl/#CrossOriginIsolated 45 bool cross_origin_isolated = 1; 46 47 message Exposed { 48 string interface = 1; 49 string member = 2; 50 } 51 52 // https://heycam.github.io/webidl/#Exposed 53 repeated Exposed exposed = 54 2; // One value for each interface/partial interface/etc.. 55 56 // https://heycam.github.io/webidl/#Global 57 bool global = 3; 58 59 // https://heycam.github.io/webidl/#SameObject 60 bool same_object = 4; 61 62 // https://heycam.github.io/webidl/#SecureContext 63 bool secure_context = 5; 64 65 // https://chromium.googlesource.com/chromium/src/+/master/third_party/blink/renderer/bindings/IDLExtendedAttributes.md#HighEntropy_m_a_c 66 // Ideally this must always be one of the well defined values. However, the 67 // HIGH_ENTROPY_UNSPECIFIED value should also be interpreted as 68 // NOT_HIGH_ENTROPY. 69 HighEntropyType high_entropy = 6; 70 71 // Value of MeasureAs or the autogenerated use counter value. Empty or 72 // undefined string is equivalent to no use counter. 73 // 74 // https://chromium.googlesource.com/chromium/src/+/master/third_party/blink/renderer/bindings/IDLExtendedAttributes.md#measure_i_m_a_c 75 string use_counter = 7; 76 77 // Value of [RuntimeEnabled] 78 // https://chromium.googlesource.com/chromium/src/+/master/third_party/blink/renderer/bindings/IDLExtendedAttributes.md#runtimeenabled_i_m_a_c 79 // Empty or undefined string is equivalent to there not being 80 // a `RuntimeEnabled` attribute. 81 string runtime_enabled = 8; 82 83 // Cross origin exposure. The [CrossOrigin=(Setter)] and 84 // [CrossOrigin=(Getter)] options are separated out into two distinct booleans 85 // for easier access. 86 // https://chromium.googlesource.com/chromium/src/+/master/third_party/blink/renderer/bindings/IDLExtendedAttributes.md#crossorigin_m_a 87 bool cross_origin_getter = 9; 88 bool cross_origin_setter = 10; 89 90 // https://chromium.googlesource.com/chromium/src/+/master/third_party/blink/renderer/bindings/IDLExtendedAttributes.md#implementedas_i_m_s_a 91 // Empty or undefined string is equivalent to an absent [ImplementedAs] 92 // attribute. 93 string implemented_as = 11; 94} 95 96// Represents an interface [^1], mixins or partial interface [^2], callback 97// interface [^3], or namespace [^4]. 98// 99// [^1]: https://heycam.github.io/webidl/#idl-interfaces 100// [^2]: https://heycam.github.io/webidl/#idl-interface-mixins 101// [^3]: https://heycam.github.io/webidl/#idl-callback-interfaces 102// [^4]: https://heycam.github.io/webidl/#idl-namespaces 103message InterfaceLike { 104 // Must be non-empty and must satisfy the requirements outlined in 105 // https://heycam.github.io/webidl/#idl-names . This should be trivially 106 // satisfied for all valid WebIDLs in the Chromium tree. 107 string name = 1; 108 109 // If this interface is defined to inherit from another interface, the latter 110 // is described here. Empty or undefined strings are interpreted as meaning 111 // that the interface does not inherit from another. 112 string inherits_from = 2; 113 114 // Extended attributes for the interface. Some may percolate down to the 115 // members. 116 ExtendedAttributes extended_attributes = 3; 117 118 // Members 119 repeated Attribute attributes = 4; 120 repeated Operation operations = 5; 121 repeated Constant constants = 6; 122} 123 124message IDLType { 125 // This is the string representation of the type. E.g.: "unsigned long long" 126 // or "sequence<USVString>" or somesuch. For this database, we leave out a lot 127 // of detail which should still be available in this field. 128 // 129 // The contents of this field is expected to parse as the _Type_ production in 130 // the WebIDL spec [^1]. The string may contain references to unresolved 131 // typedefs. 132 // 133 // [1]: https://heycam.github.io/webidl/#prod-Type 134 string idl_type_string = 1; 135 136 // Each `depends_on` value is string containing an identifier that maps to 137 // another `Interface` or `Dictionary` that's defined in the same snapshot. 138 // 139 // For example: "( boolean or sequence<Foo> or Bar )" depends on "Foo" and 140 // "Bar" types. It also depends on "boolean" but that's a primitive type 141 // that's not interesting for this database. 142 // 143 // All such dependent types must be listed for each type after resolving 144 // typedefs. 145 repeated string depends_on = 2; 146 147 // Types can have these too. Though none of the attributes we are interested 148 // in are likely to show up. 149 ExtendedAttributes extended_attributes = 3; 150} 151 152// An ordered map. 153// https://heycam.github.io/webidl/#idl-dictionaries 154message Dictionary { 155 // Name of the dictionary. 156 string name = 1; 157 string inherits_from = 2; 158 159 // Dictionary member. 160 // https://heycam.github.io/webidl/#dfn-dictionary-member 161 message Member { 162 string name = 1; 163 ExtendedAttributes extended_attributes = 2; 164 IDLType idl_type = 3; 165 } 166 167 repeated Member members = 7; 168} 169 170// Special operation types. 171// https://heycam.github.io/webidl/#dfn-special-operation 172enum SpecialOperationType { 173 SPECIAL_OP_UNSPECIFIED = 0; // Operation is not special. 174 SPECIAL_OP_GETTER = 1; // https://heycam.github.io/webidl/#dfn-getter 175 SPECIAL_OP_SETTER = 2; // https://heycam.github.io/webidl/#dfn-setter 176 SPECIAL_OP_STRINGIFIER = 177 3; // https://heycam.github.io/webidl/#dfn-stringifier 178} 179 180// An Operation represents an interface member, callback interface member, or 181// namespace member. 182// https://heycam.github.io/webidl/#idl-operations 183message Operation { 184 string name = 1; 185 ExtendedAttributes extended_attributes = 2; 186 IDLType return_type = 3; 187 repeated IDLType arguments = 4; 188 189 // True for static operations. 190 // https://heycam.github.io/webidl/#dfn-static-operation 191 bool static = 9; 192 193 // The following fields are only applicable to special operations. 194 // https://heycam.github.io/webidl/#dfn-special-operation 195 SpecialOperationType special_op_type = 5; 196} 197 198// An interface member or a namespace member declaring a data field. 199// https://heycam.github.io/webidl/#dfn-attribute 200message Attribute { 201 string name = 1; 202 ExtendedAttributes extended_attributes = 2; 203 IDLType idl_type = 3; 204 bool is_static = 4; 205 bool is_readonly = 5; 206} 207 208// A declaration binding a value to a name. 209// https://heycam.github.io/webidl/#dfn-attribute 210message Constant { 211 string name = 1; 212 ExtendedAttributes extended_attributes = 2; 213 IDLType idl_type = 3; 214 215 // Textual serialization of the value. Should be interpreted as befitting 216 // `type`. There should be no expectation that this representation is 217 // unambiguously parsable. It's intended solely for human consumption. 218 string value = 4; 219} 220 221// Defines a type who's valid values are a set of strings. 222// https://heycam.github.io/webidl/#dfn-enumeration 223message Enumeration { 224 string name = 1; 225 226 // Enum values are strings. 227 repeated string values = 2; 228} 229 230// Declares a new name for a type. 231// https://heycam.github.io/webidl/#dfn-typedef 232// These are included for completeness. 233message Typedef { 234 string name = 1; 235 IDLType idl_type = 2; 236} 237