Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(browserContext): add BrowserContext.browser() #3849

Merged

Conversation

mxschmitt
Copy link
Member

Talked with Pavel about that.

@@ -92,6 +92,10 @@ export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel,
this._channel.setDefaultTimeoutNoReply({ timeout });
}

browser(): Browser {
return this._browser!;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about the !. There should be always a browser instance.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably change the type of this field to Browser and throw in the constructor if parent instanceof Browser check fails.

@mxschmitt mxschmitt force-pushed the feature/browser-context-browser branch from 26543ee to a1175f6 Compare September 11, 2020 15:13
@@ -92,6 +92,10 @@ export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel,
this._channel.setDefaultTimeoutNoReply({ timeout });
}

browser(): Browser {
return this._browser!;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably change the type of this field to Browser and throw in the constructor if parent instanceof Browser check fails.

test/browsercontext-basic.spec.ts Show resolved Hide resolved
@mxschmitt mxschmitt force-pushed the feature/browser-context-browser branch 2 times, most recently from dbd503a to 4cb4aab Compare September 11, 2020 17:45
@mxschmitt mxschmitt force-pushed the feature/browser-context-browser branch from 4cb4aab to efdebf9 Compare September 11, 2020 17:54
@mxschmitt
Copy link
Member Author

We should probably change the type of this field to Browser and throw in the constructor if parent instanceof Browser check fails.

When a browser was launched with a persistent context, then browser was undefined. Changed it to null, so it reflects to our current API design. (We don't expose undefined only null for nil elements).

@pavelfeldman pavelfeldman merged commit beceeaf into microsoft:master Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants