Skip to content

Commit cca68a0

Browse files
authored
core: replace Page.getResourceTree with Page.getFrameTree (#14663)
1 parent 40e8195 commit cca68a0

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

core/gather/driver/execution-context.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ class ExecutionContext {
6161
await this._session.sendCommand('Page.enable');
6262
await this._session.sendCommand('Runtime.enable');
6363

64-
const resourceTreeResponse = await this._session.sendCommand('Page.getResourceTree');
65-
const mainFrameId = resourceTreeResponse.frameTree.frame.id;
64+
const frameTreeResponse = await this._session.sendCommand('Page.getFrameTree');
65+
const mainFrameId = frameTreeResponse.frameTree.frame.id;
6666

6767
const isolatedWorldResponse = await this._session.sendCommand('Page.createIsolatedWorld', {
6868
frameId: mainFrameId,

core/gather/driver/network-monitor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ class NetworkMonitor extends NetworkMonitorEventEmitter {
9595
const frameNavigations = this._frameNavigations;
9696
if (!frameNavigations.length) return {};
9797

98-
const resourceTreeResponse = await this._session.sendCommand('Page.getResourceTree');
99-
const mainFrameId = resourceTreeResponse.frameTree.frame.id;
98+
const frameTreeResponse = await this._session.sendCommand('Page.getFrameTree');
99+
const mainFrameId = frameTreeResponse.frameTree.frame.id;
100100
const mainFrameNavigations = frameNavigations.filter(frame => frame.id === mainFrameId);
101101
if (!mainFrameNavigations.length) log.warn('NetworkMonitor', 'No detected navigations');
102102

core/test/gather/driver/execution-context-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('ExecutionContext', () => {
4444
executionContext._session.sendCommand = createMockSendCommandFn()
4545
.mockResponse('Page.enable')
4646
.mockResponse('Runtime.enable')
47-
.mockResponse('Page.getResourceTree', {frameTree: {frame: {id: '1337'}}})
47+
.mockResponse('Page.getFrameTree', {frameTree: {frame: {id: '1337'}}})
4848
.mockResponse('Page.createIsolatedWorld', {executionContextId})
4949
.mockResponse('Runtime.evaluate', {result: {value: 2}});
5050

@@ -144,7 +144,7 @@ describe('.evaluateAsync', () => {
144144
let sendCommand = (sessionMock.sendCommand = createMockSendCommandFn()
145145
.mockResponse('Page.enable')
146146
.mockResponse('Runtime.enable')
147-
.mockResponse('Page.getResourceTree', {frameTree: {frame: {id: '1337'}}})
147+
.mockResponse('Page.getFrameTree', {frameTree: {frame: {id: '1337'}}})
148148
.mockResponse('Page.createIsolatedWorld', {executionContextId: 1})
149149
.mockResponse('Runtime.evaluate', {result: {value: 2}}));
150150

@@ -175,12 +175,12 @@ describe('.evaluateAsync', () => {
175175
sessionMock.sendCommand = createMockSendCommandFn()
176176
.mockResponse('Page.enable')
177177
.mockResponse('Runtime.enable')
178-
.mockResponse('Page.getResourceTree', {frameTree: {frame: {id: '1337'}}})
178+
.mockResponse('Page.getFrameTree', {frameTree: {frame: {id: '1337'}}})
179179
.mockResponse('Page.createIsolatedWorld', {executionContextId: 9001})
180180
.mockResponse('Runtime.evaluate', Promise.reject(new Error('Cannot find context')))
181181
.mockResponse('Page.enable')
182182
.mockResponse('Runtime.enable')
183-
.mockResponse('Page.getResourceTree', {frameTree: {frame: {id: '1337'}}})
183+
.mockResponse('Page.getFrameTree', {frameTree: {frame: {id: '1337'}}})
184184
.mockResponse('Page.createIsolatedWorld', {executionContextId: 9002})
185185
.mockResponse('Runtime.evaluate', {result: {value: 'mocked value'}});
186186

core/test/gather/driver/navigation-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('.gotoURL', () => {
3838
.mockResponse('Page.setLifecycleEventsEnabled')
3939
.mockResponse('Page.navigate')
4040
.mockResponse('Runtime.evaluate')
41-
.mockResponse('Page.getResourceTree', {frameTree: {frame: {id: 'ABC'}}});
41+
.mockResponse('Page.getFrameTree', {frameTree: {frame: {id: 'ABC'}}});
4242
});
4343

4444
it('will track redirects through gotoURL load with warning', async () => {

core/test/gather/driver/network-monitor-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ describe('NetworkMonitor', () => {
171171
.mockResponse('Target.setAutoAttach')
172172
.mockResponse('Target.setAutoAttach')
173173
.mockResponse('Target.setAutoAttach')
174-
.mockResponse('Page.getResourceTree', {frameTree: {frame: {id: '1'}}});
174+
.mockResponse('Page.getFrameTree', {frameTree: {frame: {id: '1'}}});
175175
await monitor.enable();
176176

177177
const type = 'Navigation';
@@ -190,7 +190,7 @@ describe('NetworkMonitor', () => {
190190
rootCdpSessionMock.send
191191
.mockResponse('Target.setAutoAttach')
192192
.mockResponse('Target.setAutoAttach')
193-
.mockResponse('Page.getResourceTree', {frameTree: {frame: {id: '1'}}});
193+
.mockResponse('Page.getFrameTree', {frameTree: {frame: {id: '1'}}});
194194
await monitor.enable();
195195

196196
// One server redirect followed by a client redirect
@@ -218,7 +218,7 @@ describe('NetworkMonitor', () => {
218218
rootCdpSessionMock.send
219219
.mockResponse('Target.setAutoAttach')
220220
.mockResponse('Target.setAutoAttach')
221-
.mockResponse('Page.getResourceTree', {frameTree: {frame: {id: '1'}}});
221+
.mockResponse('Page.getFrameTree', {frameTree: {frame: {id: '1'}}});
222222
await monitor.enable();
223223

224224
const type = 'Navigation';

0 commit comments

Comments
 (0)