File: service_worker_database.proto

package info (click to toggle)
chromium 139.0.7258.127-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,122,156 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (303 lines) | stat: -rw-r--r-- 10,086 bytes parent folder | download | duplicates (5)
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package storage;

message ServiceWorkerOriginTrialFeature {
  required string name = 1;
  repeated string tokens = 2;
}

message ServiceWorkerOriginTrialInfo {
  repeated ServiceWorkerOriginTrialFeature features = 1;
}

message ServiceWorkerNavigationPreloadState {
  required bool enabled = 1;
  optional string header = 2;
}

// NEXT ID TO USE: 27
message ServiceWorkerRegistrationData {
  enum ServiceWorkerScriptType {
    CLASSIC = 0;
    MODULE = 1;
  }
  enum ServiceWorkerUpdateViaCacheType {
    IMPORTS = 0;
    ALL = 1;
    NONE = 2;
  }
  enum CrossOriginEmbedderPolicyValue {
    NONE_OR_NOT_EXIST = 0;
    REQUIRE_CORP = 1;
    CREDENTIALLESS = 2;
  }
  enum AncestorFrameType {
    NORMAL_FRAME = 0;
    FENCED_FRAME = 1;
  }
  enum FetchHandlerSkippableType {
    reserved 0;  // Deprecated UNKNOWN_FETCH_HANDLER.
    NOT_SKIPPABLE = 1;
    SKIPPABLE_EMPTY_FETCH_HANDLER = 2;
  }
  enum ReferrerPolicyValue {
    ALWAYS = 0;
    DEFAULT = 1;
    NO_REFERRER_WHEN_DOWNGRADE = 2;
    NEVER = 3;
    ORIGIN = 4;
    ORIGIN_WHEN_CROSS_ORIGIN = 5;
    STRICT_ORIGIN_WHEN_CROSS_ORIGIN = 6;
    SAME_ORIGIN = 7;
    STRICT_ORIGIN = 8;
  }

  // https://wicg.github.io/private-network-access/#framework
  enum IPAddressSpace {
    UNKNOWN = 0;
    LOCAL = 1;
    PRIVATE = 2;
    PUBLIC = 3;
  }

  message PolicyContainerPolicies {
    optional ReferrerPolicyValue referrer_policy = 1 [default = DEFAULT];
    optional int32 sandbox_flags = 2 [default = 0];
    optional IPAddressSpace ip_address_space = 3 [default = UNKNOWN];
    // TODO(crbug.com/40168691): add content security policies
  }

  message RouterRules {
    message RuleV1 {
      message Condition {
        // Structure representing a URLPattern as described in:
        // https://wicg.github.io/urlpattern/.
        message URLPattern {
          message Part {
            enum Modifier {
              kNone = 0;
              kOptional = 1;
              kZeroOrMore = 2;
              kOneOrMore = 3;
            }
            // Represents a fixed string part of a URLPattern as described in:
            // https://wicg.github.io/urlpattern/#part-type-fixed-text
            message FixedPattern {
              optional string value = 1;
            }
            // Represents either a segment wildcard part or a full wildcard
            // part of a URLPattern as described in:
            // https://wicg.github.io/urlpattern/#parts
            message WildcardPattern {
              optional string name = 1;
              optional string prefix = 2;
              optional string value = 3;
              optional string suffix = 4;
            }
            optional Modifier modifier = 1;
            oneof pattern {
              FixedPattern fixed = 2;
              // Note that kRegex PartType is not implemented because we do not
              // execute regexp in the browser process for security concerns.
              // (but reserve 3 for regexp just in case).
              WildcardPattern segment_wildcard = 4;
              WildcardPattern full_wildcard = 5;
            }
          }
          message Options {
            optional bool ignore_case = 1 [default = false];
          }

          repeated Part legacy_pathname = 1;

          repeated Part protocol = 3;
          repeated Part username = 4;
          repeated Part password = 5;
          repeated Part hostname = 2;
          repeated Part port = 6;
          repeated Part pathname = 7;
          repeated Part search = 8;
          repeated Part hash = 9;

          optional Options options = 10;
        }
        message Request {
          optional string method = 1;
          // RequestMode in services/network/public/mojom/fetch_api.mojom
          enum Mode {
            kSameOriginMode = 0;
            kNoCorsMode = 1;
            kCorsMode = 2;
            kCorsWithForcedPreflightMode = 3;
            kNavigateMode = 4;
          }
          optional Mode mode = 2;
          // RequestDestination in services/network/public/mojom/fetch_api.mojom
          enum Destination {
            kEmptyDestination = 0;
            kAudioDestination = 1;
            kAudioWorkletDestination = 2;
            kDocumentDestination = 3;
            kEmbedDestination = 4;
            kFontDestination = 5;
            kFrameDestination = 6;
            kIframeDestination = 7;
            kImageDestination = 8;
            kManifestDestination = 9;
            kObjectDestination = 10;
            kPaintWorkletDestination = 11;
            kReportDestination = 12;
            kScriptDestination = 13;
            kServiceWorkerDestination = 14;
            kSharedWorkerDestination = 15;
            kStyleDestination = 16;
            kTrackDestination = 17;
            kVideoDestination = 18;
            kWebBundleDestination = 19;
            kWorkerDestination = 20;
            kXsltDestination = 21;
            kFencedframeDestination = 22;
            kWebIdentityDestination = 23;
            kDictionaryDestination = 24;
            kSpeculationRulesDestination = 25;
            kJsonDestination = 26;
            kSharedStorageWorkletDestination = 27;
          }
          optional Destination destination = 3;
        }
        message RunningStatus {
          enum Status {
            kRunning = 0;
            kNotRunning = 1;
          }
          optional Status status = 1;
        }
        // TODO(crbug.com/40285651): Remove and replace this to `condition`
        message ConditionObject {
          repeated Condition conditions = 1;
        }
        message OrCondition {
          repeated ConditionObject objects = 1;
        }
        message NotCondition {
          required ConditionObject object = 1;
        }
        // TODO(crbug.com/40285651): Make this a `message` to fit WebIDL
        oneof condition {
          // Used for representing URLPattern.
          URLPattern url_pattern = 1;
          // Used for representing Request.
          Request request = 2;
          // Used for representing running status.
          RunningStatus running_status = 3;
          // Used for representing 'or' condition.
          // The `_condition` suffix is to avoid conflicts with keywords in C++
          OrCondition or_condition = 4;
          // Used for representing 'not' condition.
          // The `_condition` suffix is to avoid conflicts with keywords in C++
          NotCondition not_condition = 5;
        }
      }
      message Source {
        message NetworkSource {}
        message RaceNetworkAndFetchEventSource {
          reserved 1;         // Deprecated
          reserved "target";  // Deprecated
        }
        message FetchEventSource {}
        message CacheSource {
          optional string cache_name = 1;
        }
        message RaceNetworkAndCacheSource {
          required CacheSource cache_source = 1;
        }
        oneof source {
          NetworkSource network_source = 1;
          RaceNetworkAndFetchEventSource race_network_and_fetch_event_source =
              2;
          FetchEventSource fetch_event_source = 3;
          CacheSource cache_source = 4;
          RaceNetworkAndCacheSource race_network_and_cache_source = 5;
        }
      }
      repeated Condition condition = 1;
      repeated Source source = 2;
    }

    required int32 version = 1;
    repeated RuleV1 v1 = 2;
  }

  required int64 registration_id = 1;
  required string scope_url = 2;
  required string script_url = 3;

  // Versions are first stored once they successfully install and become the
  // waiting version. Then they are updated when they transition to the active
  // version.
  required int64 version_id = 4;

  required bool is_active = 5;
  required bool has_fetch_handler = 6;
  optional FetchHandlerSkippableType fetch_handler_skippable_type = 22;

  // Serialized by Time::FromDeltaSinceWindowsEpoch().
  required int64 last_update_check_time = 7;

  optional uint64 resources_total_size_bytes = 8;

  // repeated string foreign_fetch_scope = 9;  // obsolete
  // repeated string foreign_fetch_origin = 10; // obsolete

  // If the registration data was created by old Chrome (< M56),
  // |origin_trial_tokens| is not set. In this case, we have to start the
  // Service Worker and load the main script resource in ServiceWorkerStorage
  // to check the HTTP header.
  optional ServiceWorkerOriginTrialInfo origin_trial_tokens = 11;

  optional ServiceWorkerNavigationPreloadState navigation_preload_state = 12;

  // The set of features that the worker used up until the time installation
  // completed. The values must be from blink::UseCounter::Feature enum.
  repeated uint32 used_features = 13;

  optional ServiceWorkerUpdateViaCacheType update_via_cache = 14
      [default = IMPORTS];
  optional ServiceWorkerScriptType script_type = 15 [default = CLASSIC];

  // The time when the browser received the service worker main script,
  // serialized by Time::ToDeltaSinceWindowsEpoch().
  optional int64 script_response_time = 16;

  optional CrossOriginEmbedderPolicyValue cross_origin_embedder_policy_value =
      17 [default = NONE_OR_NOT_EXIST];
  optional string cross_origin_embedder_policy_reporting_endpoint = 18;
  optional CrossOriginEmbedderPolicyValue
      cross_origin_embedder_policy_report_only_value = 19
      [default = NONE_OR_NOT_EXIST];
  optional string cross_origin_embedder_policy_report_only_reporting_endpoint =
      20;
  optional AncestorFrameType ancestor_frame_type = 21 [default = NORMAL_FRAME];

  optional PolicyContainerPolicies policy_container_policies = 23;

  optional RouterRules router_rules = 24;

  optional bool has_hid_event_handlers = 25;

  optional bool has_usb_event_handlers = 26;
}

message ServiceWorkerResourceRecord {
  required int64 resource_id = 1;
  required string url = 2;
  optional uint64 size_bytes = 3;
  optional string sha256_checksum = 4;
}