Closed Bug 1597877 Opened 5 years ago Closed 4 years ago

Implement Page.createIsolatedWorld

Categories

(Remote Protocol :: CDP, enhancement, P1)

enhancement

Tracking

(firefox73 fixed)

RESOLVED FIXED
Tracking Status
firefox73 --- fixed

People

(Reporter: impossibus, Assigned: impossibus)

References

Details

(Whiteboard: [puppeteer-alpha])

Attachments

(6 files)

Creates an isolated world for the given frame and returns an execution context for it.

Example:

puppeteer:protocol SEND ► {"sessionId":"x","method":"Page.createIsolatedWorld","params":{"frameId":"dddddd","grantUniveralAccess":true,"worldName":"__puppeteer_utility_world__"},"id":14}
puppeteer:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"context":{"id":2,"origin":"","name":"__puppeteer_utility_world__","auxData":{"isDefault":false,"type":"isolated","frameId":"dddddd"}}},"sessionId":"x"}
puppeteer:protocol ◀ RECV {"id":14,"result":{"executionContextId":2},"sessionId":"x"}

This is why gutenberg tests hang in test setup at Puppeteer methods like Page.focus and Page.click. Every Puppeteer Frame has two DOMWorlds, "main" and "secondary". The secondary is created in FrameManager._ensureIsolatedWorld as mentioned in https://bugzilla.mozilla.org/show_bug.cgi?id=1587452#c1

Since we don't implement Page.createIsolatedWorld yet, we never create an execution context for the secondary world and so Puppeteer hangs waiting for that execution context. Puppeteer Page methods like click, focus, select, hover, tap all rely on the secondary world.

Assignee: nobody → mjzffr
Status: NEW → ASSIGNED
Priority: P2 → P1

According to the CDP viewer, the type of FrameId is string.

Dismantle the assumption that there is one ExecutionContext per
inner window and generate a fresh id for each ExecutionContext
rather than reusing the inner window id.

As a bonus, also emit Runtime.executionContextsCleared.

Depends on D55167

This does not support the grantUniversalAccess parameter.
It just creates a new execution context.

Depends on D55168

As noted in Bug 1602083, the CDP viewer implies that execution context management
is independent of the Runtime domain, which makes sense with the behaviour of methods
like Page.createIsolatedWorld.

This is a first step in that direction.

Depends on D55168

Depends on D55168

Pushed by mjzffr@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/f2d4096ee285
Make frameId a string; r=remote-protocol-reviewers,ato,whimboo
https://hg.mozilla.org/integration/autoland/rev/4a9491dbf5b1
Report name, origin, type in Runtime.executionContextCreated; r=remote-protocol-reviewers,ato,whimboo
https://hg.mozilla.org/integration/autoland/rev/ca7c88a4a9e3
Identify internal methods in Runtime domain; r=remote-protocol-reviewers,whimboo
https://hg.mozilla.org/integration/autoland/rev/c6be67f53106
Allow many ExecutionContexts per inner window; r=remote-protocol-reviewers,ato,whimboo
https://hg.mozilla.org/integration/autoland/rev/8e0ad3f91d48
Make Runtime.enable/disable control notifications only; r=remote-protocol-reviewers,whimboo,ato
https://hg.mozilla.org/integration/autoland/rev/2bf39a9a1a78
Implement Page.createIsolatedWorld; r=remote-protocol-reviewers,whimboo,ato
Regressions: 1602686
Component: CDP: Page → CDP
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: