chrome-devtools-frontend 1.0.1039140 → 1.0.1039659
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/panels/application/IndexedDBModel.ts +68 -41
- package/front_end/panels/application/IndexedDBViews.ts +3 -1
- package/front_end/panels/elements/StylesSidebarPane.ts +5 -1
- package/front_end/panels/settings/KeybindsSettingsTab.ts +1 -0
- package/front_end/panels/settings/keybindsSettingsTab.css +4 -0
- package/package.json +1 -1
@@ -176,9 +176,11 @@ export class IndexedDBModel extends SDK.SDKModel.SDKModel<EventTypes> implements
|
|
176
176
|
if (!this.enabled) {
|
177
177
|
return;
|
178
178
|
}
|
179
|
-
|
180
|
-
|
181
|
-
|
179
|
+
if (databaseId.securityOrigin) {
|
180
|
+
await this.indexedDBAgent.invoke_deleteDatabase(
|
181
|
+
{securityOrigin: databaseId.securityOrigin, databaseName: databaseId.name});
|
182
|
+
void this.loadDatabaseNames(databaseId.securityOrigin);
|
183
|
+
}
|
182
184
|
}
|
183
185
|
|
184
186
|
async refreshDatabaseNames(): Promise<void> {
|
@@ -193,14 +195,18 @@ export class IndexedDBModel extends SDK.SDKModel.SDKModel<EventTypes> implements
|
|
193
195
|
}
|
194
196
|
|
195
197
|
async clearObjectStore(databaseId: DatabaseId, objectStoreName: string): Promise<void> {
|
196
|
-
|
197
|
-
|
198
|
+
if (databaseId.securityOrigin) {
|
199
|
+
await this.indexedDBAgent.invoke_clearObjectStore(
|
200
|
+
{securityOrigin: databaseId.securityOrigin, databaseName: databaseId.name, objectStoreName});
|
201
|
+
}
|
198
202
|
}
|
199
203
|
|
200
204
|
async deleteEntries(databaseId: DatabaseId, objectStoreName: string, idbKeyRange: IDBKeyRange): Promise<void> {
|
201
205
|
const keyRange = IndexedDBModel.keyRangeFromIDBKeyRange(idbKeyRange);
|
202
|
-
|
203
|
-
|
206
|
+
if (databaseId.securityOrigin) {
|
207
|
+
await this.indexedDBAgent.invoke_deleteObjectStoreEntries(
|
208
|
+
{securityOrigin: databaseId.securityOrigin, databaseName: databaseId.name, objectStoreName, keyRange});
|
209
|
+
}
|
204
210
|
}
|
205
211
|
|
206
212
|
private securityOriginAdded(event: Common.EventTarget.EventTargetEvent<string>): void {
|
@@ -259,19 +265,19 @@ export class IndexedDBModel extends SDK.SDKModel.SDKModel<EventTypes> implements
|
|
259
265
|
for (const securityOrigin in this.databaseNamesBySecurityOrigin) {
|
260
266
|
const databaseNames = this.databaseNamesBySecurityOrigin[securityOrigin];
|
261
267
|
for (let i = 0; i < databaseNames.length; ++i) {
|
262
|
-
result.push(new DatabaseId(securityOrigin, databaseNames[i]));
|
268
|
+
result.push(new DatabaseId(securityOrigin, undefined, databaseNames[i]));
|
263
269
|
}
|
264
270
|
}
|
265
271
|
return result;
|
266
272
|
}
|
267
273
|
|
268
274
|
private databaseAdded(securityOrigin: string, databaseName: string): void {
|
269
|
-
const databaseId = new DatabaseId(securityOrigin, databaseName);
|
275
|
+
const databaseId = new DatabaseId(securityOrigin, undefined, databaseName);
|
270
276
|
this.dispatchEventToListeners(Events.DatabaseAdded, {model: this, databaseId: databaseId});
|
271
277
|
}
|
272
278
|
|
273
279
|
private databaseRemoved(securityOrigin: string, databaseName: string): void {
|
274
|
-
const databaseId = new DatabaseId(securityOrigin, databaseName);
|
280
|
+
const databaseId = new DatabaseId(securityOrigin, undefined, databaseName);
|
275
281
|
this.dispatchEventToListeners(Events.DatabaseRemoved, {model: this, databaseId: databaseId});
|
276
282
|
}
|
277
283
|
|
@@ -288,15 +294,20 @@ export class IndexedDBModel extends SDK.SDKModel.SDKModel<EventTypes> implements
|
|
288
294
|
}
|
289
295
|
|
290
296
|
private async loadDatabase(databaseId: DatabaseId, entriesUpdated: boolean): Promise<void> {
|
291
|
-
|
292
|
-
|
297
|
+
let databaseWithObjectStores: Protocol.IndexedDB.DatabaseWithObjectStores|null = null;
|
298
|
+
if (databaseId.securityOrigin) {
|
299
|
+
databaseWithObjectStores = (await this.indexedDBAgent.invoke_requestDatabase({
|
300
|
+
securityOrigin: databaseId.securityOrigin,
|
301
|
+
databaseName: databaseId.name,
|
302
|
+
})).databaseWithObjectStores;
|
303
|
+
if (!this.databaseNamesBySecurityOrigin[databaseId.securityOrigin]) {
|
304
|
+
return;
|
305
|
+
}
|
306
|
+
}
|
293
307
|
|
294
308
|
if (!databaseWithObjectStores) {
|
295
309
|
return;
|
296
310
|
}
|
297
|
-
if (!this.databaseNamesBySecurityOrigin[databaseId.securityOrigin]) {
|
298
|
-
return;
|
299
|
-
}
|
300
311
|
|
301
312
|
const databaseModel = new Database(databaseId, databaseWithObjectStores.version);
|
302
313
|
this.databasesInternal.set(databaseId, databaseModel);
|
@@ -334,44 +345,58 @@ export class IndexedDBModel extends SDK.SDKModel.SDKModel<EventTypes> implements
|
|
334
345
|
idbKeyRange: IDBKeyRange|null, skipCount: number, pageSize: number,
|
335
346
|
callback: (arg0: Array<Entry>, arg1: boolean) => void): Promise<void> {
|
336
347
|
const keyRange = idbKeyRange ? IndexedDBModel.keyRangeFromIDBKeyRange(idbKeyRange) : undefined;
|
348
|
+
const runtimeModel = this.target().model(SDK.RuntimeModel.RuntimeModel);
|
349
|
+
let response: Protocol.IndexedDB.RequestDataResponse|null = null;
|
350
|
+
|
351
|
+
if (databaseId.securityOrigin) {
|
352
|
+
response = await this.indexedDBAgent.invoke_requestData({
|
353
|
+
securityOrigin: databaseId.securityOrigin,
|
354
|
+
databaseName,
|
355
|
+
objectStoreName,
|
356
|
+
indexName,
|
357
|
+
skipCount,
|
358
|
+
pageSize,
|
359
|
+
keyRange,
|
360
|
+
});
|
361
|
+
if (!runtimeModel || !this.databaseNamesBySecurityOrigin[databaseId.securityOrigin]) {
|
362
|
+
return;
|
363
|
+
}
|
364
|
+
}
|
337
365
|
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
objectStoreName,
|
342
|
-
indexName,
|
343
|
-
skipCount,
|
344
|
-
pageSize,
|
345
|
-
keyRange,
|
346
|
-
});
|
347
|
-
|
366
|
+
if (!response) {
|
367
|
+
return;
|
368
|
+
}
|
348
369
|
if (response.getError()) {
|
349
370
|
console.error('IndexedDBAgent error: ' + response.getError());
|
350
371
|
return;
|
351
372
|
}
|
352
373
|
|
353
|
-
const runtimeModel = this.target().model(SDK.RuntimeModel.RuntimeModel);
|
354
|
-
if (!runtimeModel || !this.databaseNamesBySecurityOrigin[databaseId.securityOrigin]) {
|
355
|
-
return;
|
356
|
-
}
|
357
374
|
const dataEntries = response.objectStoreDataEntries;
|
358
375
|
const entries = [];
|
359
376
|
for (const dataEntry of dataEntries) {
|
360
|
-
const key = runtimeModel
|
361
|
-
const primaryKey = runtimeModel
|
362
|
-
const value = runtimeModel
|
377
|
+
const key = runtimeModel?.createRemoteObject(dataEntry.key);
|
378
|
+
const primaryKey = runtimeModel?.createRemoteObject(dataEntry.primaryKey);
|
379
|
+
const value = runtimeModel?.createRemoteObject(dataEntry.value);
|
380
|
+
if (!key || !primaryKey || !value) {
|
381
|
+
return;
|
382
|
+
}
|
363
383
|
entries.push(new Entry(key, primaryKey, value));
|
364
384
|
}
|
365
385
|
callback(entries, response.hasMore);
|
366
386
|
}
|
367
387
|
|
368
388
|
async getMetadata(databaseId: DatabaseId, objectStore: ObjectStore): Promise<ObjectStoreMetadata|null> {
|
369
|
-
const databaseOrigin = databaseId.securityOrigin;
|
370
389
|
const databaseName = databaseId.name;
|
371
390
|
const objectStoreName = objectStore.name;
|
372
|
-
|
373
|
-
|
391
|
+
let response: Protocol.IndexedDB.GetMetadataResponse|null = null;
|
392
|
+
if (databaseId.securityOrigin) {
|
393
|
+
response = await this.indexedDBAgent.invoke_getMetadata(
|
394
|
+
{securityOrigin: databaseId.securityOrigin, databaseName, objectStoreName});
|
395
|
+
}
|
374
396
|
|
397
|
+
if (!response) {
|
398
|
+
return null;
|
399
|
+
}
|
375
400
|
if (response.getError()) {
|
376
401
|
console.error('IndexedDBAgent error: ' + response.getError());
|
377
402
|
return null;
|
@@ -382,7 +407,7 @@ export class IndexedDBModel extends SDK.SDKModel.SDKModel<EventTypes> implements
|
|
382
407
|
private async refreshDatabaseList(securityOrigin: string): Promise<void> {
|
383
408
|
const databaseNames = await this.loadDatabaseNames(securityOrigin);
|
384
409
|
for (const databaseName of databaseNames) {
|
385
|
-
void this.loadDatabase(new DatabaseId(securityOrigin, databaseName), false);
|
410
|
+
void this.loadDatabase(new DatabaseId(securityOrigin, undefined, databaseName), false);
|
386
411
|
}
|
387
412
|
}
|
388
413
|
|
@@ -400,7 +425,7 @@ export class IndexedDBModel extends SDK.SDKModel.SDKModel<EventTypes> implements
|
|
400
425
|
|
401
426
|
indexedDBContentUpdated({origin: securityOrigin, databaseName, objectStoreName}:
|
402
427
|
Protocol.Storage.IndexedDBContentUpdatedEvent): void {
|
403
|
-
const databaseId = new DatabaseId(securityOrigin, databaseName);
|
428
|
+
const databaseId = new DatabaseId(securityOrigin, undefined, databaseName);
|
404
429
|
this.dispatchEventToListeners(
|
405
430
|
Events.IndexedDBContentUpdated, {databaseId: databaseId, objectStoreName: objectStoreName, model: this});
|
406
431
|
}
|
@@ -450,15 +475,17 @@ export class Entry {
|
|
450
475
|
}
|
451
476
|
|
452
477
|
export class DatabaseId {
|
453
|
-
securityOrigin
|
478
|
+
readonly securityOrigin?: string;
|
479
|
+
readonly storageKey?: string;
|
454
480
|
name: string;
|
455
|
-
constructor(securityOrigin: string, name: string) {
|
456
|
-
this.securityOrigin = securityOrigin;
|
481
|
+
constructor(securityOrigin: string|undefined, storageKey: string|undefined, name: string) {
|
482
|
+
securityOrigin ? this.securityOrigin = securityOrigin : (storageKey ? this.storageKey = storageKey : undefined);
|
457
483
|
this.name = name;
|
458
484
|
}
|
459
485
|
|
460
486
|
equals(databaseId: DatabaseId): boolean {
|
461
|
-
return this.name === databaseId.name && this.securityOrigin === databaseId.securityOrigin
|
487
|
+
return this.name === databaseId.name && this.securityOrigin === databaseId.securityOrigin &&
|
488
|
+
this.storageKey === databaseId.storageKey;
|
462
489
|
}
|
463
490
|
}
|
464
491
|
|
@@ -198,7 +198,9 @@ export class IDBDatabaseView extends UI.Widget.VBox {
|
|
198
198
|
}
|
199
199
|
|
200
200
|
private refreshDatabase(): void {
|
201
|
-
|
201
|
+
if (this.database.databaseId.securityOrigin) {
|
202
|
+
this.securityOriginElement.textContent = this.database.databaseId.securityOrigin;
|
203
|
+
}
|
202
204
|
if (this.versionElement) {
|
203
205
|
this.versionElement.textContent = this.database.version.toString();
|
204
206
|
}
|
@@ -1396,7 +1396,11 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
|
|
1396
1396
|
button.setToggleWithDot(true);
|
1397
1397
|
|
1398
1398
|
button.element.addEventListener('click', event => {
|
1399
|
-
const
|
1399
|
+
const boundingRect = button.element.getBoundingClientRect();
|
1400
|
+
const menu = new UI.ContextMenu.ContextMenu(event, {
|
1401
|
+
x: boundingRect.left,
|
1402
|
+
y: boundingRect.bottom,
|
1403
|
+
});
|
1400
1404
|
const preferredColorScheme = prefersColorSchemeSetting.get();
|
1401
1405
|
const isLightColorScheme = preferredColorScheme === 'light';
|
1402
1406
|
const isDarkColorScheme = preferredColorScheme === 'dark';
|
@@ -461,6 +461,7 @@ export class ShortcutListItem {
|
|
461
461
|
private createIconButton(label: string, iconName: string, className: string, listener: () => void):
|
462
462
|
HTMLButtonElement {
|
463
463
|
const button = document.createElement('button') as HTMLButtonElement;
|
464
|
+
button.setAttribute('title', label);
|
464
465
|
button.appendChild(UI.Icon.Icon.create(iconName));
|
465
466
|
button.addEventListener('click', listener);
|
466
467
|
UI.ARIAUtils.setAccessibleName(button, label);
|
package/package.json
CHANGED