Open Bug 1650270 Opened 4 years ago Updated 4 years ago

ExecutionContext creation fails (debuggee.docShell is null) after Page.frameDetached

Categories

(Remote Protocol :: CDP, defect, P2)

defect

Tracking

(Not tracked)

People

(Reporter: impossibus, Unassigned)

References

Details

(Whiteboard: [puppeteer-beta2-mvp])

When a frameDetached event comes soon after a frameAttached event, we hit an error in the ExecutionContext ctor:

1593123819052	RemoteAgent	TRACE	<-(connection {7635a878-adcd-984e-bce0-9a83387f1cea}) {"sessionId":1,"method":"Page.frameAttached","params":{"frameId":"6442450945","parentFrameId":"18","stack":null}}
1593123819053	RemoteAgent	TRACE	<-(connection {7635a878-adcd-984e-bce0-9a83387f1cea}) {"sessionId":1,"method":"Page.frameStartedLoading","params":{"frameId":"6442450945"}}
1593123819054	RemoteAgent	TRACE	<-(connection {7635a878-adcd-984e-bce0-9a83387f1cea}) {"sessionId":1,"method":"Page.lifecycleEvent","params":{"frameId":"6442450945","name":"init","timestamp":1593123819.051}}
1593123819056	RemoteAgent	TRACE	<-(connection {7635a878-adcd-984e-bce0-9a83387f1cea}) {"sessionId":1,"method":"Page.frameNavigated","params":{"frame":{"id":"6442450945","parentId":"18","url":"","name":"","securityOrigin":null,"mimeType":null}}}
1593123819057	RemoteAgent	TRACE	<-(connection {7635a878-adcd-984e-bce0-9a83387f1cea}) {"sessionId":1,"method":"Runtime.executionContextCreated","params":{"context":{"id":15,"origin":"","name":"","auxData":{"isDefault":true,"frameId":"6442450945","type":"default"}}}}
1593123819060	RemoteAgent	TRACE	<-(connection {7635a878-adcd-984e-bce0-9a83387f1cea}) {"sessionId":1,"method":"Network.responseReceived","params":{"requestId":"99574521791062","timestamp":1593123819.059,"type":" ... remotePort":80,"fromDiskCache":false,"protocol":"http/1.1","securityDetails":null,"securityState":"unknown"},"frameId":"18"}}
1593123819062	RemoteAgent	TRACE	<-(connection {7635a878-adcd-984e-bce0-9a83387f1cea}) {"sessionId":1,"method":"Network.responseReceived","params":{"requestId":"99574521791062","timestamp":1593123819.062,"type":" ... "remotePort":80,"fromDiskCache":true,"protocol":"http/1.1","securityDetails":null,"securityState":"unknown"},"frameId":"18"}}
1593123819284	RemoteAgent	TRACE	<-(connection {7635a878-adcd-984e-bce0-9a83387f1cea}) {"sessionId":1,"method":"Page.frameDetached","params":{"frameId":"6442450945"}}
1593123819284	RemoteAgent	TRACE	<-(connection {7635a878-adcd-984e-bce0-9a83387f1cea}) {"sessionId":1,"method":"Page.frameStartedLoading","params":{"frameId":"6442450945"}}
1593123819285	RemoteAgent	TRACE	<-(connection {7635a878-adcd-984e-bce0-9a83387f1cea}) {"sessionId":1,"method":"Page.lifecycleEvent","params":{"frameId":"6442450945","name":"init","timestamp":1593123819.284}}
console.error: 
  TypeError: can't access property "browsingContext", debuggee.docShell is null: ExecutionContext@chrome://remote/content/domains/content/runtime/ExecutionContext.jsm:53:5
_onContextCreated@chrome://remote/content/domains/content/Runtime.jsm:396:21
_onScriptLoaded@chrome://remote/content/domains/content/Page.jsm:324:15
emit@resource://gre/modules/EventEmitter.jsm:160:20
handleEvent/<@chrome://remote/content/observers/ContextObserver.jsm:90:16

This is the top error in gutenberg tests; >10% of tests are affected. Frames are attached/detached in quick succession as a result of key/mouse interactions. For example, quote.test.js.

Severity: -- → S3
Priority: -- → P3

(In reply to Maja Frydrychowicz :maja_zf (UTC-4) (maja@mozilla.com) from comment #1)

This is the top error in gutenberg tests; >10% of tests are affected. Frames are attached/detached in quick succession as a result of key/mouse interactions. For example, quote.test.js.

Clarification: tests that were previously passing now fail. Probably related to Bug 1599773 or Bug 1593226.

Priority: P3 → P2
Whiteboard: [puppeteer-beta-reserve]

It also seems strange that we see Page.frameStartedLoaded and an init lifecycle event after the frame is detached. As far as I can tell from Chrome logs, after a frameDetached event there are never any more events for that frame id.

We have an overlap here:
https://searchfox.org/mozilla-central/rev/31d8600b73dc85b4cdbabf45ac3f1a9c11700d8e/remote/domains/content/Page.jsm#280-289

Maybe it's the wrong place to emit the events here, and we need a better DOM event?

Whiteboard: [puppeteer-beta-reserve] → [puppeteer-beta2-mvp]
Component: CDP: Runtime → CDP
You need to log in before you can comment on or make changes to this bug.