Skip to content

Commit 3d3ff16

Browse files
bmeurerDevtools-frontend LUCI CQ
authored andcommitted
Disable storage inspection for service workers.
This is causing crashes in M143 and on. Unfortunately the original CL no longer reverts cleanly, so this is the minimal delta to disable its effects, which can also be back-merged appropriately. Bug: 406991275 Change-Id: If6451729e483de6d06d370c1f966fb981500cd3a Fixed: 466134219 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7319382 Reviewed-by: Changhao Han <changhaohan@chromium.org> Auto-Submit: Benedikt Meurer <bmeurer@chromium.org> Commit-Queue: Changhao Han <changhaohan@chromium.org>
1 parent 7a5fa42 commit 3d3ff16

File tree

3 files changed

+43
-34
lines changed

3 files changed

+43
-34
lines changed

front_end/core/sdk/ChildTargetManager.test.ts

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -260,38 +260,43 @@ describeWithMockConnection('ChildTargetManager', () => {
260260
});
261261

262262
describe('Storage initialization', () => {
263-
it('should initialize storage for a top-level worker with STORAGE capability', async () => {
264-
const parentTarget = createTarget({type: SDK.Target.Type.BROWSER});
265-
266-
const getStorageKeyStub = sinon.stub().resolves({
267-
storageKey: 'https://example.com/' as Protocol.Storage.SerializedStorageKey,
268-
getError: () => undefined,
269-
});
270-
271-
sinon.stub(SDK.Target.Target.prototype, 'storageAgent').returns({
272-
invoke_getStorageKey: getStorageKeyStub,
273-
} as sinon.SinonStubbedInstance<ProtocolProxyApi.StorageApi>);
274-
275-
const setMainStorageKeySpy = sinon.spy(SDK.StorageKeyManager.StorageKeyManager.prototype, 'setMainStorageKey');
276-
const updateStorageKeysSpy = sinon.spy(SDK.StorageKeyManager.StorageKeyManager.prototype, 'updateStorageKeys');
277-
const setMainSecurityOriginSpy =
278-
sinon.spy(SDK.SecurityOriginManager.SecurityOriginManager.prototype, 'setMainSecurityOrigin');
279-
const updateSecurityOriginsSpy =
280-
sinon.spy(SDK.SecurityOriginManager.SecurityOriginManager.prototype, 'updateSecurityOrigins');
281-
282-
const childTargetManager = new SDK.ChildTargetManager.ChildTargetManager(parentTarget);
283-
await childTargetManager.attachedToTarget({
284-
sessionId: createSessionId(),
285-
targetInfo: createTargetInfo(undefined, 'service_worker'),
286-
waitingForDebugger: false,
287-
});
288-
289-
assert.isTrue(getStorageKeyStub.calledOnceWith({}));
290-
assert.isTrue(setMainStorageKeySpy.calledOnceWith('https://example.com/'));
291-
assert.isTrue(updateStorageKeysSpy.calledOnceWith(new Set(['https://example.com/'])));
292-
assert.isTrue(setMainSecurityOriginSpy.calledOnceWith('https://example.com', ''));
293-
assert.isTrue(updateSecurityOriginsSpy.calledOnceWith(new Set(['https://example.com'])));
294-
});
263+
// Temporarily disabled until the root cause for the crashers in https://crbug.com/466134219 is
264+
// found and resolved.
265+
it.skip(
266+
'[crbug.com/406991275] should initialize storage for a top-level worker with STORAGE capability', async () => {
267+
const parentTarget = createTarget({type: SDK.Target.Type.BROWSER});
268+
269+
const getStorageKeyStub = sinon.stub().resolves({
270+
storageKey: 'https://example.com/' as Protocol.Storage.SerializedStorageKey,
271+
getError: () => undefined,
272+
});
273+
274+
sinon.stub(SDK.Target.Target.prototype, 'storageAgent').returns({
275+
invoke_getStorageKey: getStorageKeyStub,
276+
} as sinon.SinonStubbedInstance<ProtocolProxyApi.StorageApi>);
277+
278+
const setMainStorageKeySpy =
279+
sinon.spy(SDK.StorageKeyManager.StorageKeyManager.prototype, 'setMainStorageKey');
280+
const updateStorageKeysSpy =
281+
sinon.spy(SDK.StorageKeyManager.StorageKeyManager.prototype, 'updateStorageKeys');
282+
const setMainSecurityOriginSpy =
283+
sinon.spy(SDK.SecurityOriginManager.SecurityOriginManager.prototype, 'setMainSecurityOrigin');
284+
const updateSecurityOriginsSpy =
285+
sinon.spy(SDK.SecurityOriginManager.SecurityOriginManager.prototype, 'updateSecurityOrigins');
286+
287+
const childTargetManager = new SDK.ChildTargetManager.ChildTargetManager(parentTarget);
288+
await childTargetManager.attachedToTarget({
289+
sessionId: createSessionId(),
290+
targetInfo: createTargetInfo(undefined, 'service_worker'),
291+
waitingForDebugger: false,
292+
});
293+
294+
assert.isTrue(getStorageKeyStub.calledOnceWith({}));
295+
assert.isTrue(setMainStorageKeySpy.calledOnceWith('https://example.com/'));
296+
assert.isTrue(updateStorageKeysSpy.calledOnceWith(new Set(['https://example.com/'])));
297+
assert.isTrue(setMainSecurityOriginSpy.calledOnceWith('https://example.com', ''));
298+
assert.isTrue(updateSecurityOriginsSpy.calledOnceWith(new Set(['https://example.com'])));
299+
});
295300

296301
it('should NOT initialize storage for a frame target', async () => {
297302
const parentTarget = createTarget();

front_end/core/sdk/Target.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ describe('Target', () => {
4040
assert.isFalse(subframeTarget.hasAllCapabilities(SDK.Target.Capability.DEVICE_EMULATION));
4141
});
4242

43-
it('should grant STORAGE capability to top-level workers', () => {
43+
// Temporarily disabled until the root cause for the crashers in https://crbug.com/466134219 is
44+
// found and resolved.
45+
it.skip('[crbug.com/406991275] should grant STORAGE capability to top-level workers', () => {
4446
const serviceWorker = createTarget({type: SDK.Target.Type.ServiceWorker, parentTarget: browserTarget});
4547
const sharedWorker = createTarget({type: SDK.Target.Type.SHARED_WORKER, parentTarget: browserTarget});
4648
const dedicatedWorker = createTarget({type: SDK.Target.Type.Worker, parentTarget: browserTarget});

front_end/core/sdk/Target.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ export class Target extends ProtocolClient.InspectorBackend.TargetBase {
6666
this.#capabilitiesMask = Capability.JS | Capability.LOG | Capability.NETWORK | Capability.TARGET |
6767
Capability.INSPECTOR | Capability.IO | Capability.EVENT_BREAKPOINTS;
6868
if (parentTarget?.type() !== Type.FRAME) {
69-
this.#capabilitiesMask |= Capability.BROWSER | Capability.STORAGE;
69+
// TODO(crbug.com/406991275): This should also grant the `STORAGE` capability, but first the
70+
// crashers in https://crbug.com/466134219 have to be resolved.
71+
this.#capabilitiesMask |= Capability.BROWSER;
7072
}
7173
break;
7274
case Type.SHARED_WORKER:

0 commit comments

Comments
 (0)