[DevTools] Add test for inline document.write() not sending CDP event
This CL adds a test which ensures that a `document.write()` when the document is still open does not trigger sending a `Page.documentOpened` CDP event. `Page.documentOpened` CL: https://crrev.com/c/2498482 Design Doc: http://doc/1l-XzjFMdASjRzX4-vMxOoK-MXoxY5uhCe0GNfDsXeDo Change-Id: Ibbe7d539db6ee85168c99972a8e2779dcc982b03 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2567007 Reviewed-by: Sigurd Schneider <sigurds@chromium.org> Commit-Queue: Wolfgang Beyer <wolfi@chromium.org> Cr-Commit-Position: refs/heads/master@{#834198}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
145cde68b5
commit
40525f2d46
third_party/blink/web_tests/http/tests/inspector-protocol/page
4
third_party/blink/web_tests/http/tests/inspector-protocol/page/inline-document-write-expected.txt
vendored
Normal file
4
third_party/blink/web_tests/http/tests/inspector-protocol/page/inline-document-write-expected.txt
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
Tests that inline document.write() does not send Page.documentOpened event
|
||||
Frame navigated to http://devtools.test:8000/inspector-protocol/page/resources/inline-document-write.html
|
||||
Frame stopped loading
|
||||
|
19
third_party/blink/web_tests/http/tests/inspector-protocol/page/inline-document-write.js
vendored
Normal file
19
third_party/blink/web_tests/http/tests/inspector-protocol/page/inline-document-write.js
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
(async function(testRunner) {
|
||||
const {page, dp} = await testRunner.startBlank(
|
||||
`Tests that inline document.write() does not send Page.documentOpened event`);
|
||||
|
||||
await dp.Page.enable();
|
||||
|
||||
dp.Page.onFrameNavigated((event) => {
|
||||
testRunner.log(`Frame navigated to ${event.params.frame.url}`);
|
||||
});
|
||||
dp.Page.onDocumentOpened((event) => {
|
||||
testRunner.log(`Document opened, new url: ${event.params.frame.url}`);
|
||||
});
|
||||
dp.Page.onFrameStoppedLoading((event) => {
|
||||
testRunner.log('Frame stopped loading');
|
||||
testRunner.completeTest();
|
||||
});
|
||||
|
||||
await page.navigate('http://devtools.test:8000/inspector-protocol/page/resources/inline-document-write.html');
|
||||
})
|
8
third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/inline-document-write.html
vendored
Normal file
8
third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/inline-document-write.html
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<h1>Write to self</h1>
|
||||
<script>document.write('Hello world');</script>
|
||||
<p>After write</p>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user