Skip to content

Commit

Permalink
feat(chromium): support oopifs (#1664)
Browse files Browse the repository at this point in the history
Splits CRPage into CRPage and FrameSession, carefully broadcasting or picking the right session for each operation.
  • Loading branch information
dgozman authored Apr 6, 2020
1 parent 56fbfc2 commit aeeac55
Show file tree
Hide file tree
Showing 6 changed files with 416 additions and 207 deletions.
8 changes: 4 additions & 4 deletions src/chromium/crBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export class CRBrowser extends BrowserBase {

async startTracing(page?: Page, options: { path?: string; screenshots?: boolean; categories?: string[]; } = {}) {
assert(!this._tracingRecording, 'Cannot start recording trace while already recording trace.');
this._tracingClient = page ? (page._delegate as CRPage)._client : this._session;
this._tracingClient = page ? (page._delegate as CRPage)._mainFrameSession._client : this._session;

const defaultCategories = [
'-*', 'devtools.timeline', 'v8.execute', 'disabled-by-default-devtools.timeline',
Expand Down Expand Up @@ -364,7 +364,7 @@ export class CRBrowserContext extends BrowserContextBase {
geolocation = verifyGeolocation(geolocation);
this._options.geolocation = geolocation || undefined;
for (const page of this.pages())
await (page._delegate as CRPage)._client.send('Emulation.setGeolocationOverride', geolocation || {});
await (page._delegate as CRPage).updateGeolocation();
}

async setExtraHTTPHeaders(headers: network.Headers): Promise<void> {
Expand All @@ -376,13 +376,13 @@ export class CRBrowserContext extends BrowserContextBase {
async setOffline(offline: boolean): Promise<void> {
this._options.offline = offline;
for (const page of this.pages())
await (page._delegate as CRPage)._networkManager.setOffline(offline);
await (page._delegate as CRPage).updateOffline();
}

async setHTTPCredentials(httpCredentials: types.Credentials | null): Promise<void> {
this._options.httpCredentials = httpCredentials || undefined;
for (const page of this.pages())
await (page._delegate as CRPage)._networkManager.authenticate(httpCredentials);
await (page._delegate as CRPage).updateHttpCredentials();
}

async addInitScript(script: Function | string | { path?: string, content?: string }, arg?: any) {
Expand Down
Loading

0 comments on commit aeeac55

Please sign in to comment.