forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only emit frameAttached when frame is committed
This fixes a problem where frameAttached is not emitted when navigating a frame from an OOPIF back into the parent's frame process. Change-Id: I2c2ce150e810bcb97c179d8ad5cbc940a0c0b4ce Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4744066 Auto-Submit: Andrey Kosyakov <caseq@chromium.org> Commit-Queue: Andrey Kosyakov <caseq@chromium.org> Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Cr-Commit-Position: refs/heads/main@{#1179345}
- Loading branch information
Showing
5 changed files
with
83 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
third_party/blink/web_tests/http/tests/inspector-protocol/page/frame-attached-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Tests Page.frameAttachedevents with different kinds of frame navigation | ||
Initial navigation | ||
Navigating same origin | ||
Navigating cross origin | ||
http://oopif-a.devtools.test:8000/inspector-protocol/resources/empty.html | ||
Navigating cross origin again | ||
http://oopif-b.devtools.test:8000/inspector-protocol/resources/empty.html | ||
Navigating back to in-process | ||
main target: Page.frameAttached | ||
Attaching a local frame | ||
main target: Page.frameAttached | ||
|
60 changes: 60 additions & 0 deletions
60
third_party/blink/web_tests/http/tests/inspector-protocol/page/frame-attached.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
(async function(testRunner) { | ||
const {session, dp} = await testRunner.startHTML( | ||
`<html><body><iframe id='frame'></iframe></body></html>`, | ||
'Tests Page.frameAttachedevents with ' + | ||
'different kinds of frame navigation'); | ||
|
||
function setLogFrameAttachedEvents(dp, prefix) { | ||
dp.Page.enable(); | ||
dp.Page.onceFrameAttached(e => testRunner.log(`${prefix}: ${e.method}`)); | ||
} | ||
|
||
setLogFrameAttachedEvents(dp, 'main target'); | ||
await dp.Target.setAutoAttach({autoAttach: true, flatten: true, waitForDebuggerOnStart: true}); | ||
|
||
const url1 = 'http://127.0.0.1:8000/inspector-protocol/resources/empty.html'; | ||
const url2 = `${url1}?foo=bar`; | ||
const url3 = `http://oopif-a.devtools.test:8000/inspector-protocol/resources/empty.html`; | ||
const url4 = `http://oopif-b.devtools.test:8000/inspector-protocol/resources/empty.html`; | ||
|
||
testRunner.log(`Initial navigation`); | ||
session.evaluate(`document.getElementById('frame').src = '${url1}'`); | ||
await dp.Page.onceFrameStoppedLoading(); | ||
|
||
testRunner.log(`Navigating same origin`); | ||
session.evaluate(`document.getElementById('frame').src = '${url2}'`); | ||
await dp.Page.onceFrameStoppedLoading(); | ||
|
||
testRunner.log(`Navigating cross origin`); | ||
|
||
session.evaluate(`document.getElementById('frame').src = '${url3}'`); | ||
|
||
let {params} = await dp.Target.onceAttachedToTarget(); | ||
const session2 = session.createChild(params.sessionId); | ||
const dp2 = session2.protocol; | ||
setLogFrameAttachedEvents(dp2, 'child target'); | ||
dp2.Runtime.runIfWaitingForDebugger(); | ||
|
||
await dp2.Page.onceDomContentEventFired(); | ||
testRunner.log(await session2.evaluate(`location.href`)); | ||
|
||
testRunner.log(`Navigating cross origin again`); | ||
session.evaluate(`document.getElementById('frame').src = '${url4}'`); | ||
|
||
await dp2.Page.onceDomContentEventFired(); | ||
testRunner.log(await session2.evaluate(`location.href`)); | ||
|
||
testRunner.log(`Navigating back to in-process`); | ||
session.evaluate(`document.getElementById('frame').src = '${url1}'`); | ||
await dp.Page.onceFrameStoppedLoading(); | ||
|
||
testRunner.log(`Attaching a local frame`); | ||
session.evaluate(`(function() { | ||
const frame = document.createElement('iframe'); | ||
frame.src = '${url1}'; | ||
document.body.appendChild(frame); | ||
})()`); | ||
await dp.Page.onceFrameAttached(); | ||
|
||
testRunner.completeTest(); | ||
}) |