Skip to content

Commit e692dd6

Browse files
authored
api(cdp): rename ChromiumSession to CDPSession (#1380)
1 parent 19dd233 commit e692dd6

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

docs/api.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
- [class: ChromiumBrowser](#class-chromiumbrowser)
3030
- [class: ChromiumBrowserContext](#class-chromiumbrowsercontext)
3131
- [class: ChromiumCoverage](#class-chromiumcoverage)
32-
- [class: ChromiumSession](#class-chromiumsession)
32+
- [class: CDPSession](#class-cdpsession)
3333
- [class: FirefoxBrowser](#class-firefoxbrowser)
3434
- [class: WebKitBrowser](#class-webkitbrowser)
3535
- [Environment Variables](#environment-variables)
@@ -3742,7 +3742,7 @@ await browser.stopTracing();
37423742
<!-- GEN:stop -->
37433743

37443744
#### chromiumBrowser.newBrowserCDPSession()
3745-
- returns: <[Promise]<[ChromiumSession]>> Promise that resolves to the newly created browser
3745+
- returns: <[Promise]<[CDPSession]>> Promise that resolves to the newly created browser
37463746
session.
37473747

37483748
#### chromiumBrowser.startTracing([page, options])
@@ -3815,7 +3815,7 @@ Emitted when new service worker is created in the context.
38153815

38163816
#### chromiumBrowserContext.newCDPSession(page)
38173817
- `page` <[Page]> Page to create new session for.
3818-
- returns: <[Promise]<[ChromiumSession]>> Promise that resolves to the newly created session.
3818+
- returns: <[Promise]<[CDPSession]>> Promise that resolves to the newly created session.
38193819

38203820
### class: ChromiumCoverage
38213821

@@ -3882,11 +3882,11 @@ const v8toIstanbul = require('v8-to-istanbul');
38823882
> **NOTE** JavaScript Coverage doesn't include anonymous scripts by default. However, scripts with sourceURLs are
38833883
reported.
38843884

3885-
### class: ChromiumSession
3885+
### class: CDPSession
38863886

38873887
* extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
38883888

3889-
The `ChromiumSession` instances are used to talk raw Chrome Devtools Protocol:
3889+
The `CDPSession` instances are used to talk raw Chrome Devtools Protocol:
38903890
- protocol methods can be called with `session.send` method.
38913891
- protocol events can be subscribed to with `session.on` method.
38923892

@@ -3906,17 +3906,17 @@ await client.send('Animation.setPlaybackRate', {
39063906
```
39073907

39083908
<!-- GEN:toc -->
3909-
- [chromiumSession.detach()](#chromiumsessiondetach)
3910-
- [chromiumSession.send(method[, params])](#chromiumsessionsendmethod-params)
3909+
- [cdpSession.detach()](#cdpsessiondetach)
3910+
- [cdpSession.send(method[, params])](#cdpsessionsendmethod-params)
39113911
<!-- GEN:stop -->
39123912

3913-
#### chromiumSession.detach()
3913+
#### cdpSession.detach()
39143914
- returns: <[Promise]>
39153915

3916-
Detaches the chromiumSession from the target. Once detached, the chromiumSession object won't emit any events and can't be used
3916+
Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be used
39173917
to send messages.
39183918

3919-
#### chromiumSession.send(method[, params])
3919+
#### cdpSession.send(method[, params])
39203920
- `method` <[string]> protocol method name
39213921
- `params` <[Object]> Optional method parameters
39223922
- returns: <[Promise]<[Object]>>
@@ -4040,7 +4040,7 @@ const { chromium } = require('playwright');
40404040
[ChromiumBrowser]: #class-chromiumbrowser "ChromiumBrowser"
40414041
[ChromiumBrowserContext]: #class-chromiumbrowsercontext "ChromiumBrowserContext"
40424042
[ChromiumCoverage]: #class-chromiumcoverage "ChromiumCoverage"
4043-
[ChromiumSession]: #class-chromiumsession "ChromiumSession"
4043+
[CDPSession]: #class-cdpsession "CDPSession"
40444044
[ConsoleMessage]: #class-consolemessage "ConsoleMessage"
40454045
[Dialog]: #class-dialog "Dialog"
40464046
[ElementHandle]: #class-elementhandle "ElementHandle"

src/api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export { Selectors } from './selectors';
3131
export { CRBrowser as ChromiumBrowser } from './chromium/crBrowser';
3232
export { CRBrowserContext as ChromiumBrowserContext } from './chromium/crBrowser';
3333
export { CRCoverage as ChromiumCoverage } from './chromium/crCoverage';
34-
export { CRSession as ChromiumSession } from './chromium/crConnection';
34+
export { CRSession as CDPSession } from './chromium/crConnection';
3535

3636
export { FFBrowser as FirefoxBrowser } from './firefox/ffBrowser';
3737

test/test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ const BROWSER_CONFIGS = [
8585
...require('../lib/events').Events,
8686
...require('../lib/chromium/events').Events,
8787
},
88-
missingCoverage: ['browserContext.setGeolocation', 'browserContext.setOffline', 'worker.url'],
88+
missingCoverage: ['browserContext.setGeolocation', 'browserContext.setOffline', 'worker.url', 'cDPSession.send', 'cDPSession.detach'],
8989
},
9090
{
9191
name: 'WebKit',
9292
events: require('../lib/events').Events,
93-
missingCoverage: ['browserContext.clearPermissions'],
93+
missingCoverage: ['browserContext.clearPermissions', 'cDPSession.send', 'cDPSession.detach'],
9494
},
9595
{
9696
name: 'Chromium',

utils/doclint/check_public_api/JSBuilder.js

+2
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ function checkSources(sources, externalDependencies) {
326326
}
327327

328328
function expandPrefix(name) {
329+
if (name === 'CRSession')
330+
return 'CDPSession';
329331
if (name.startsWith('CR'))
330332
return 'Chromium' + name.substring(2);
331333
if (name.startsWith('FF'))

0 commit comments

Comments
 (0)