chrome-devtools-frontend 1.0.1603822 → 1.0.1604514
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/front_end/core/host/AidaClient.ts +39 -462
- package/front_end/core/host/AidaClientTypes.ts +470 -0
- package/front_end/core/host/AidaGcaTranslation.ts +225 -122
- package/front_end/core/host/GcaTypes.ts +107 -155
- package/front_end/core/protocol_client/DevToolsCDPConnection.ts +1 -1
- package/front_end/core/sdk/DOMModel.ts +24 -22
- package/front_end/core/sdk/EmulationModel.ts +21 -23
- package/front_end/core/sdk/HeapProfilerModel.ts +4 -7
- package/front_end/core/sdk/NetworkManager.ts +35 -28
- package/front_end/core/sdk/OverlayModel.ts +10 -10
- package/front_end/core/sdk/PreloadingModel.ts +3 -4
- package/front_end/core/sdk/ServiceWorkerManager.ts +2 -3
- package/front_end/core/sdk/SourceMapScopesInfo.ts +93 -63
- package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +1 -3
- package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +22 -48
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +1 -1
- package/front_end/generated/InspectorBackendCommands.ts +4 -0
- package/front_end/generated/SupportedCSSProperties.js +68 -2
- package/front_end/generated/protocol-mapping.d.ts +7 -0
- package/front_end/generated/protocol-proxy-api.d.ts +14 -0
- package/front_end/generated/protocol.ts +22 -0
- package/front_end/models/bindings/TempFile.ts +1 -4
- package/front_end/models/extensions/ExtensionAPI.ts +1 -1
- package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +34 -47
- package/front_end/models/javascript_metadata/NativeFunctions.js +6 -6
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +88 -19
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +14 -20
- package/front_end/panels/ai_assistance/components/ChatView.ts +3 -2
- package/front_end/panels/ai_assistance/components/WalkthroughView.ts +35 -7
- package/front_end/panels/elements/ElementsTreeElement.ts +91 -13
- package/front_end/panels/elements/elementsTreeOutline.css +18 -0
- package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +15 -19
- package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +4 -2
- package/front_end/panels/profiler/HeapSnapshotProxy.ts +12 -16
- package/front_end/panels/profiler/HeapSnapshotView.ts +3 -10
- package/front_end/panels/profiler/ProfilesPanel.ts +5 -7
- package/front_end/panels/sensors/SensorsView.ts +0 -2
- package/front_end/panels/timeline/TimelinePanel.ts +1 -3
- package/front_end/panels/timeline/components/LiveMetricsView.ts +35 -63
- package/front_end/panels/timeline/components/liveMetricsView.css +4 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/package.json +1 -1
|
@@ -168,40 +168,40 @@ export enum Mode {
|
|
|
168
168
|
NONE = 3,
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
172
171
|
export interface GenerateContentRequest {
|
|
173
172
|
model?: string;
|
|
174
|
-
aicode
|
|
173
|
+
aicode: AiCodeConfig;
|
|
175
174
|
contents: Content[];
|
|
176
|
-
|
|
175
|
+
systemInstruction?: Content;
|
|
177
176
|
tools?: Tool[];
|
|
178
|
-
|
|
177
|
+
toolConfig?: ToolConfig;
|
|
179
178
|
labels?: Record<string, string>;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
safetySettings?: SafetySetting[];
|
|
180
|
+
generationConfig?: GenerationConfig;
|
|
181
|
+
sessionId?: string;
|
|
183
182
|
}
|
|
184
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
185
183
|
|
|
186
184
|
export interface AiCodeConfig {
|
|
187
185
|
experience: string;
|
|
188
186
|
files?: SourceFile[];
|
|
189
187
|
}
|
|
190
188
|
|
|
191
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
192
189
|
export interface SourceFile {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
190
|
+
inclusionReason?: InclusionReason[];
|
|
191
|
+
fileUri: string;
|
|
192
|
+
programmingLanguage?: string;
|
|
193
|
+
segments?: FileSegment[];
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface FileSegment {
|
|
197
|
+
content: string;
|
|
198
|
+
isSelected: boolean;
|
|
196
199
|
}
|
|
197
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
198
200
|
|
|
199
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
200
201
|
export interface FileEdit {
|
|
201
|
-
|
|
202
|
+
fileUri: string;
|
|
202
203
|
content: string;
|
|
203
204
|
}
|
|
204
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
205
205
|
|
|
206
206
|
export type Role = 'user'|'model';
|
|
207
207
|
|
|
@@ -210,34 +210,28 @@ export interface Content {
|
|
|
210
210
|
role: Role;
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
214
213
|
export interface Part {
|
|
215
214
|
text?: string;
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
215
|
+
inlineData?: Blob;
|
|
216
|
+
fileData?: FileData;
|
|
217
|
+
functionCall?: FunctionCall;
|
|
218
|
+
functionResponse?: FunctionResponse;
|
|
219
|
+
executableCode?: ExecutableCode;
|
|
220
|
+
codeExecutionResult?: CodeExecutionResult;
|
|
221
|
+
videoMetadata?: VideoMetadata;
|
|
223
222
|
thought?: boolean;
|
|
224
|
-
|
|
223
|
+
thoughtSignature?: string; // bytes as base64 string
|
|
225
224
|
}
|
|
226
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
227
225
|
|
|
228
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
229
226
|
export interface Blob {
|
|
230
|
-
|
|
227
|
+
mimeType: string;
|
|
231
228
|
data: string; // bytes as base64 string
|
|
232
229
|
}
|
|
233
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
234
230
|
|
|
235
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
236
231
|
export interface FileData {
|
|
237
|
-
|
|
238
|
-
|
|
232
|
+
mimeType: string;
|
|
233
|
+
fileUri: string;
|
|
239
234
|
}
|
|
240
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
241
235
|
|
|
242
236
|
export interface FunctionCall {
|
|
243
237
|
name: string;
|
|
@@ -261,30 +255,25 @@ export interface CodeExecutionResult {
|
|
|
261
255
|
output: string;
|
|
262
256
|
}
|
|
263
257
|
|
|
264
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
265
258
|
export interface Tool {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
259
|
+
functionDeclarations?: FunctionDeclaration[];
|
|
260
|
+
googleSearch?: {
|
|
261
|
+
timeRangeFilter?: {
|
|
262
|
+
startTime?: string, // Timestamp
|
|
263
|
+
endTime?: string, // Timestamp
|
|
271
264
|
},
|
|
272
265
|
};
|
|
273
266
|
}
|
|
274
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
275
267
|
|
|
276
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
277
268
|
export interface FunctionDeclaration {
|
|
278
269
|
name: string;
|
|
279
270
|
description: string;
|
|
280
271
|
parameters?: Schema;
|
|
281
|
-
|
|
272
|
+
parametersJsonSchema?: unknown; // google.protobuf.Value
|
|
282
273
|
response?: Schema;
|
|
283
|
-
|
|
274
|
+
responseJsonSchema?: unknown; // google.protobuf.Value
|
|
284
275
|
}
|
|
285
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
286
276
|
|
|
287
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
288
277
|
export interface Schema {
|
|
289
278
|
type?: Type;
|
|
290
279
|
format?: string;
|
|
@@ -296,25 +285,20 @@ export interface Schema {
|
|
|
296
285
|
required?: string[];
|
|
297
286
|
minimum?: number;
|
|
298
287
|
maximum?: number;
|
|
299
|
-
|
|
300
|
-
|
|
288
|
+
minLength?: number;
|
|
289
|
+
maxLength?: number;
|
|
301
290
|
pattern?: string;
|
|
302
291
|
example?: unknown; // google.protobuf.Value
|
|
303
292
|
}
|
|
304
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
305
293
|
|
|
306
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
307
294
|
export interface ToolConfig {
|
|
308
|
-
|
|
295
|
+
functionCallingConfig?: FunctionCallingConfig;
|
|
309
296
|
}
|
|
310
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
311
297
|
|
|
312
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
313
298
|
export interface FunctionCallingConfig {
|
|
314
299
|
mode: Mode;
|
|
315
|
-
|
|
300
|
+
allowedFunctionNames?: string[];
|
|
316
301
|
}
|
|
317
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
318
302
|
|
|
319
303
|
export interface SafetySetting {
|
|
320
304
|
category: HarmCategory;
|
|
@@ -322,52 +306,44 @@ export interface SafetySetting {
|
|
|
322
306
|
method?: HarmBlockMethod;
|
|
323
307
|
}
|
|
324
308
|
|
|
325
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
326
309
|
export interface GenerationConfig {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
310
|
+
candidateCount?: number;
|
|
311
|
+
stopSequences?: string[];
|
|
312
|
+
maxOutputTokens?: number;
|
|
330
313
|
temperature?: number;
|
|
331
|
-
|
|
332
|
-
|
|
314
|
+
topP?: number;
|
|
315
|
+
topK?: number;
|
|
333
316
|
seed?: number;
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
317
|
+
responseMimeType?: string;
|
|
318
|
+
responseSchema?: Schema;
|
|
319
|
+
responseJsonSchema?: unknown; // google.protobuf.Value
|
|
320
|
+
presencePenalty?: number;
|
|
321
|
+
frequencyPenalty?: number;
|
|
322
|
+
thinkingConfig?: ThinkingConfig;
|
|
340
323
|
}
|
|
341
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
342
324
|
|
|
343
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
344
325
|
export interface ThinkingConfig {
|
|
345
|
-
|
|
346
|
-
|
|
326
|
+
includeThoughts?: boolean;
|
|
327
|
+
thinkingBudget?: number;
|
|
347
328
|
}
|
|
348
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
349
329
|
|
|
350
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
351
330
|
export interface GenerateContentResponse {
|
|
352
331
|
candidates: Candidate[];
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
332
|
+
promptFeedback: PromptFeedback;
|
|
333
|
+
usageMetadata: UsageMetadata;
|
|
334
|
+
modelVersion: string;
|
|
335
|
+
responseId: string;
|
|
357
336
|
}
|
|
358
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
359
337
|
|
|
360
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
361
338
|
export interface Candidate {
|
|
362
339
|
index: number;
|
|
363
340
|
content: Content;
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
341
|
+
finishReason: FinishReason;
|
|
342
|
+
safetyRatings: SafetyRating[];
|
|
343
|
+
citationMetadata: CitationMetadata;
|
|
344
|
+
groundingMetadata: GroundingMetadata;
|
|
345
|
+
aicodeOutput: AiCodeOutput;
|
|
369
346
|
}
|
|
370
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
371
347
|
|
|
372
348
|
export interface SafetyRating {
|
|
373
349
|
category: HarmCategory;
|
|
@@ -379,142 +355,118 @@ export interface CitationMetadata {
|
|
|
379
355
|
citations: Citation[];
|
|
380
356
|
}
|
|
381
357
|
|
|
382
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
383
358
|
export interface Citation {
|
|
384
|
-
|
|
385
|
-
|
|
359
|
+
startIndex: number;
|
|
360
|
+
endIndex: number;
|
|
386
361
|
uri: string;
|
|
387
362
|
license: string;
|
|
388
363
|
}
|
|
389
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
390
364
|
|
|
391
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
392
365
|
export interface GroundingMetadata {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
366
|
+
webSearchQueries?: string[];
|
|
367
|
+
searchEntryPoint?: {
|
|
368
|
+
renderedContent?: string,
|
|
369
|
+
sdkBlob?: string, // bytes as base64 string
|
|
397
370
|
};
|
|
398
|
-
|
|
371
|
+
groundingChunks?: Array<{
|
|
399
372
|
web?: {
|
|
400
373
|
uri?: string,
|
|
401
374
|
title?: string,
|
|
402
375
|
},
|
|
403
376
|
}>;
|
|
404
|
-
|
|
377
|
+
groundingSupports?: Array<{
|
|
405
378
|
segment?: {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
379
|
+
partIndex?: number,
|
|
380
|
+
startIndex?: number,
|
|
381
|
+
endIndex?: number,
|
|
409
382
|
text?: string,
|
|
410
383
|
},
|
|
411
|
-
|
|
412
|
-
|
|
384
|
+
groundingChunkIndices?: number[],
|
|
385
|
+
confidenceScores?: number[],
|
|
413
386
|
}>;
|
|
414
|
-
|
|
415
|
-
|
|
387
|
+
retrievalMetadata?: {
|
|
388
|
+
googleSearchDynamicRetrievalScore?: number,
|
|
416
389
|
};
|
|
417
390
|
}
|
|
418
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
419
391
|
|
|
420
392
|
export interface AiCodeOutput {
|
|
421
393
|
contents: DerivedContent[];
|
|
422
394
|
}
|
|
423
395
|
|
|
424
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
425
396
|
export interface DerivedContent {
|
|
426
|
-
|
|
427
|
-
|
|
397
|
+
startIndex?: number;
|
|
398
|
+
endIndex?: number;
|
|
428
399
|
file?: OutputSourceFile;
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
400
|
+
codeBlock?: CodeBlock;
|
|
401
|
+
textBlock?: TextBlock;
|
|
402
|
+
predictionMetadata?: PredictionMetadata;
|
|
432
403
|
}
|
|
433
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
434
404
|
|
|
435
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
436
405
|
export interface OutputSourceFile {
|
|
437
|
-
|
|
406
|
+
fileUri: string;
|
|
438
407
|
content: string;
|
|
439
408
|
}
|
|
440
409
|
|
|
441
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
442
410
|
export interface CodeBlock {
|
|
443
411
|
content: string;
|
|
444
|
-
|
|
412
|
+
programmingLanguage: string;
|
|
445
413
|
}
|
|
446
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
447
414
|
|
|
448
415
|
export interface TextBlock {
|
|
449
416
|
content: string;
|
|
450
417
|
}
|
|
451
418
|
|
|
452
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
453
419
|
export interface PredictionMetadata {
|
|
454
420
|
score: number;
|
|
455
|
-
|
|
421
|
+
classifierScore: number;
|
|
456
422
|
}
|
|
457
423
|
|
|
458
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
459
424
|
export interface PromptFeedback {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
425
|
+
blockReason: BlockReason;
|
|
426
|
+
safetyRatings: SafetyRating[];
|
|
427
|
+
blockReasonMessage: string;
|
|
463
428
|
}
|
|
464
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
465
429
|
|
|
466
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
467
430
|
export interface UsageMetadata {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
431
|
+
promptTokenCount: number;
|
|
432
|
+
candidatesTokenCount: number;
|
|
433
|
+
totalTokenCount: number;
|
|
434
|
+
thoughtsTokenCount: number;
|
|
435
|
+
cachedContentTokenCount: number;
|
|
473
436
|
}
|
|
474
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
475
437
|
|
|
476
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
477
438
|
export interface VideoMetadata {
|
|
478
|
-
|
|
479
|
-
|
|
439
|
+
startOffset?: string; // Duration
|
|
440
|
+
endOffset?: string; // Duration
|
|
480
441
|
fps?: number;
|
|
481
442
|
}
|
|
482
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
483
443
|
|
|
484
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
485
444
|
export interface SendTelemetryRequest {
|
|
486
|
-
|
|
445
|
+
feedbackMetrics: FeedbackMetric[];
|
|
487
446
|
}
|
|
488
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
489
447
|
|
|
490
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
491
448
|
export interface FeedbackMetric {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
449
|
+
eventTime: string; // Timestamp
|
|
450
|
+
responseId: string;
|
|
451
|
+
suggestionOffered?: SuggestionOffered;
|
|
452
|
+
suggestionInteraction?: SuggestionInteraction;
|
|
496
453
|
}
|
|
497
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
498
454
|
|
|
499
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
500
455
|
export interface SuggestionOffered {
|
|
501
456
|
method?: Method;
|
|
502
457
|
status?: SuggestionStatus;
|
|
503
|
-
|
|
504
|
-
|
|
458
|
+
firstMessageLatency?: string; // Duration
|
|
459
|
+
responseLatency?: string; // Duration
|
|
505
460
|
displayed?: boolean;
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
461
|
+
e2eLatency?: string; // Duration
|
|
462
|
+
displayDuration?: string; // Duration
|
|
463
|
+
programmingLanguage?: string;
|
|
509
464
|
}
|
|
510
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
511
465
|
|
|
512
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
513
466
|
export interface SuggestionInteraction {
|
|
514
467
|
interaction?: InteractionType;
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
468
|
+
acceptedLines?: number;
|
|
469
|
+
acceptedCharacters?: number;
|
|
470
|
+
acceptedCommentLines?: number;
|
|
471
|
+
candidateIndex?: number;
|
|
519
472
|
}
|
|
520
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
@@ -112,7 +112,7 @@ export class DevToolsCDPConnection implements CDPConnection {
|
|
|
112
112
|
if ('error' in response && response.error) {
|
|
113
113
|
callback?.(response.error, null);
|
|
114
114
|
} else if ('result' in response) {
|
|
115
|
-
callback?.(null, response.result
|
|
115
|
+
callback?.(null, response.result);
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
}
|
|
@@ -190,7 +190,7 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
|
|
|
190
190
|
/**
|
|
191
191
|
* Set if a DOMNode is ad related.
|
|
192
192
|
*/
|
|
193
|
-
#
|
|
193
|
+
#adProvenance?: Protocol.Network.AdProvenance;
|
|
194
194
|
|
|
195
195
|
constructor(domModel: DOMModel) {
|
|
196
196
|
super();
|
|
@@ -292,7 +292,7 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
|
|
|
292
292
|
this.setPseudoElements(payload.pseudoElements);
|
|
293
293
|
|
|
294
294
|
if (payload.adProvenance) {
|
|
295
|
-
this.#
|
|
295
|
+
this.#adProvenance = payload.adProvenance;
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
if (this.#nodeType === Node.ELEMENT_NODE) {
|
|
@@ -331,21 +331,24 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
|
|
|
331
331
|
return this.#topLayerIndex;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
//
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
return false;
|
|
344
|
-
}
|
|
345
|
-
return frame.adFrameType() !== Protocol.Page.AdFrameType.None;
|
|
334
|
+
adProvenance(): Protocol.Network.AdProvenance|undefined {
|
|
335
|
+
if (this.#adProvenance !== undefined) {
|
|
336
|
+
return this.#adProvenance;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// AdProvenance can be unavailable for deeply nested OOPIF ad iframes
|
|
340
|
+
// (crbug.com/421202278). We rely on `AdFrameType` as a fallback.
|
|
341
|
+
if (!this.isIframe() || !this.#frameOwnerFrameId) {
|
|
342
|
+
return undefined;
|
|
346
343
|
}
|
|
347
344
|
|
|
348
|
-
|
|
345
|
+
const frame = FrameManager.instance().getFrame(this.#frameOwnerFrameId);
|
|
346
|
+
if (frame && frame.adFrameType() !== Protocol.Page.AdFrameType.None) {
|
|
347
|
+
// The frame is ad-related, but provenance information is unavailable.
|
|
348
|
+
return {};
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return undefined;
|
|
349
352
|
}
|
|
350
353
|
|
|
351
354
|
isRootNode(): boolean {
|
|
@@ -425,8 +428,8 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
|
|
|
425
428
|
}
|
|
426
429
|
}
|
|
427
430
|
|
|
428
|
-
setIsAdRelated(
|
|
429
|
-
this.#
|
|
431
|
+
setIsAdRelated(adProvenance?: Protocol.Network.AdProvenance): void {
|
|
432
|
+
this.#adProvenance = adProvenance;
|
|
430
433
|
this.dispatchEventToListeners(DOMNodeEvents.AD_RELATED_STATE_UPDATED);
|
|
431
434
|
}
|
|
432
435
|
|
|
@@ -1476,8 +1479,8 @@ export class DOMModel extends SDKModel<EventTypes> {
|
|
|
1476
1479
|
return this.target().model(OverlayModel) as OverlayModel;
|
|
1477
1480
|
}
|
|
1478
1481
|
|
|
1479
|
-
static cancelSearch(): void {
|
|
1480
|
-
for (const domModel of
|
|
1482
|
+
static cancelSearch(targetManager: TargetManager = TargetManager.instance()): void {
|
|
1483
|
+
for (const domModel of targetManager.models(DOMModel)) {
|
|
1481
1484
|
domModel.cancelSearch();
|
|
1482
1485
|
}
|
|
1483
1486
|
}
|
|
@@ -1832,12 +1835,11 @@ export class DOMModel extends SDKModel<EventTypes> {
|
|
|
1832
1835
|
}
|
|
1833
1836
|
|
|
1834
1837
|
adRelatedStateUpdated(nodeId: Protocol.DOM.NodeId, adProvenance?: Protocol.Network.AdProvenance): void {
|
|
1835
|
-
const isAdRelated = adProvenance !== undefined;
|
|
1836
1838
|
const node = this.nodeForId(nodeId);
|
|
1837
|
-
if (!node
|
|
1839
|
+
if (!node) {
|
|
1838
1840
|
return;
|
|
1839
1841
|
}
|
|
1840
|
-
node.setIsAdRelated(
|
|
1842
|
+
node.setIsAdRelated(adProvenance);
|
|
1841
1843
|
}
|
|
1842
1844
|
|
|
1843
1845
|
affectedByStartingStylesFlagUpdated(nodeId: Protocol.DOM.NodeId, affectedByStartingStyles: boolean): void {
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
|
|
6
6
|
import * as Protocol from '../../generated/protocol.js';
|
|
7
|
-
import * as Common from '../common/common.js';
|
|
8
7
|
|
|
9
8
|
import {CSSModel} from './CSSModel.js';
|
|
10
9
|
import {MultitargetNetworkManager} from './NetworkManager.js';
|
|
@@ -50,7 +49,8 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
50
49
|
}, this);
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
const
|
|
52
|
+
const settings = this.target().targetManager().settings;
|
|
53
|
+
const disableJavascriptSetting = settings.moduleSetting('java-script-disabled');
|
|
54
54
|
disableJavascriptSetting.addChangeListener(
|
|
55
55
|
async () =>
|
|
56
56
|
await this.#emulationAgent.invoke_setScriptExecutionDisabled({value: disableJavascriptSetting.get()}));
|
|
@@ -58,14 +58,14 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
58
58
|
void this.#emulationAgent.invoke_setScriptExecutionDisabled({value: true});
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const touchSetting =
|
|
61
|
+
const touchSetting = settings.moduleSetting('emulation.touch');
|
|
62
62
|
touchSetting.addChangeListener(() => {
|
|
63
63
|
const settingValue = touchSetting.get();
|
|
64
64
|
|
|
65
65
|
void this.overrideEmulateTouch(settingValue === 'force');
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
const idleDetectionSetting =
|
|
68
|
+
const idleDetectionSetting = settings.moduleSetting('emulation.idle-detection');
|
|
69
69
|
idleDetectionSetting.addChangeListener(async () => {
|
|
70
70
|
const settingValue = idleDetectionSetting.get();
|
|
71
71
|
if (settingValue === 'none') {
|
|
@@ -80,7 +80,7 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
80
80
|
await this.setIdleOverride(emulationParams);
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
const cpuPressureDetectionSetting =
|
|
83
|
+
const cpuPressureDetectionSetting = settings.moduleSetting('emulation.cpu-pressure');
|
|
84
84
|
cpuPressureDetectionSetting.addChangeListener(async () => {
|
|
85
85
|
const settingValue = cpuPressureDetectionSetting.get();
|
|
86
86
|
|
|
@@ -98,21 +98,19 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
98
98
|
await this.setPressureStateOverride(settingValue);
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
-
const mediaTypeSetting =
|
|
102
|
-
const mediaFeatureColorGamutSetting =
|
|
103
|
-
Common.Settings.Settings.instance().moduleSetting<string>('emulated-css-media-feature-color-gamut');
|
|
101
|
+
const mediaTypeSetting = settings.moduleSetting<string>('emulated-css-media');
|
|
102
|
+
const mediaFeatureColorGamutSetting = settings.moduleSetting<string>('emulated-css-media-feature-color-gamut');
|
|
104
103
|
const mediaFeaturePrefersColorSchemeSetting =
|
|
105
|
-
|
|
106
|
-
const mediaFeatureForcedColorsSetting =
|
|
107
|
-
Common.Settings.Settings.instance().moduleSetting('emulated-css-media-feature-forced-colors');
|
|
104
|
+
settings.moduleSetting<string>('emulated-css-media-feature-prefers-color-scheme');
|
|
105
|
+
const mediaFeatureForcedColorsSetting = settings.moduleSetting('emulated-css-media-feature-forced-colors');
|
|
108
106
|
const mediaFeaturePrefersContrastSetting =
|
|
109
|
-
|
|
107
|
+
settings.moduleSetting<string>('emulated-css-media-feature-prefers-contrast');
|
|
110
108
|
const mediaFeaturePrefersReducedDataSetting =
|
|
111
|
-
|
|
112
|
-
const mediaFeaturePrefersReducedTransparencySetting =
|
|
113
|
-
'emulated-css-media-feature-prefers-reduced-transparency');
|
|
109
|
+
settings.moduleSetting<string>('emulated-css-media-feature-prefers-reduced-data');
|
|
110
|
+
const mediaFeaturePrefersReducedTransparencySetting =
|
|
111
|
+
settings.moduleSetting<string>('emulated-css-media-feature-prefers-reduced-transparency');
|
|
114
112
|
const mediaFeaturePrefersReducedMotionSetting =
|
|
115
|
-
|
|
113
|
+
settings.moduleSetting<string>('emulated-css-media-feature-prefers-reduced-motion');
|
|
116
114
|
// Note: this uses a different format than what the CDP API expects,
|
|
117
115
|
// because we want to update these values per media type/feature
|
|
118
116
|
// without having to search the `features` array (inefficient) or
|
|
@@ -161,7 +159,7 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
161
159
|
});
|
|
162
160
|
void this.updateCssMedia();
|
|
163
161
|
|
|
164
|
-
const autoDarkModeSetting =
|
|
162
|
+
const autoDarkModeSetting = settings.moduleSetting('emulate-auto-dark-mode');
|
|
165
163
|
autoDarkModeSetting.addChangeListener(() => {
|
|
166
164
|
const enabled = autoDarkModeSetting.get();
|
|
167
165
|
mediaFeaturePrefersColorSchemeSetting.setDisabled(enabled);
|
|
@@ -174,13 +172,13 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
174
172
|
void this.emulateAutoDarkMode(true);
|
|
175
173
|
}
|
|
176
174
|
|
|
177
|
-
const visionDeficiencySetting =
|
|
175
|
+
const visionDeficiencySetting = settings.moduleSetting('emulated-vision-deficiency');
|
|
178
176
|
visionDeficiencySetting.addChangeListener(() => this.emulateVisionDeficiency(visionDeficiencySetting.get()));
|
|
179
177
|
if (visionDeficiencySetting.get()) {
|
|
180
178
|
void this.emulateVisionDeficiency(visionDeficiencySetting.get());
|
|
181
179
|
}
|
|
182
180
|
|
|
183
|
-
const osTextScaleSetting =
|
|
181
|
+
const osTextScaleSetting = settings.moduleSetting('emulated-os-text-scale');
|
|
184
182
|
osTextScaleSetting.addChangeListener(() => {
|
|
185
183
|
void this.emulateOSTextScale(parseFloat(osTextScaleSetting.get()) || undefined);
|
|
186
184
|
});
|
|
@@ -188,15 +186,15 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
188
186
|
void this.emulateOSTextScale(parseFloat(osTextScaleSetting.get()) || undefined);
|
|
189
187
|
}
|
|
190
188
|
|
|
191
|
-
const localFontsDisabledSetting =
|
|
189
|
+
const localFontsDisabledSetting = settings.moduleSetting('local-fonts-disabled');
|
|
192
190
|
localFontsDisabledSetting.addChangeListener(() => this.setLocalFontsDisabled(localFontsDisabledSetting.get()));
|
|
193
191
|
if (localFontsDisabledSetting.get()) {
|
|
194
192
|
this.setLocalFontsDisabled(localFontsDisabledSetting.get());
|
|
195
193
|
}
|
|
196
194
|
|
|
197
|
-
const avifFormatDisabledSetting =
|
|
198
|
-
const jpegXlFormatDisabledSetting =
|
|
199
|
-
const webpFormatDisabledSetting =
|
|
195
|
+
const avifFormatDisabledSetting = settings.moduleSetting('avif-format-disabled');
|
|
196
|
+
const jpegXlFormatDisabledSetting = settings.moduleSetting('jpeg-xl-format-disabled');
|
|
197
|
+
const webpFormatDisabledSetting = settings.moduleSetting('webp-format-disabled');
|
|
200
198
|
|
|
201
199
|
const updateDisabledImageFormats = (): void => {
|
|
202
200
|
const types = [];
|