docs: replace serviceWorkers workaround (#14902)

This commit is contained in:
Ross Wollman 2022-06-20 19:31:19 -07:00 committed by GitHub
parent db9ff4b7c9
commit 0f8114f6a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 15 deletions

View file

@ -854,7 +854,7 @@ Routing provides the capability to modify network requests that are made by any
is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
:::note
[`method: Page.route`] will not intercept requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception. Via `await context.addInitScript(() => delete window.navigator.serviceWorker);`
[`method: BrowserContext.route`] will not intercept requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting [`option: Browser.newContext.serviceWorkers`] to `'block'`.
:::
An example of a naive handler that aborts all image requests:

View file

@ -2577,7 +2577,7 @@ The handler will only be called for the first url if the response is a redirect.
:::
:::note
[`method: Page.route`] will not intercept requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception. Via `await context.addInitScript(() => delete window.navigator.serviceWorker);`
[`method: Page.route`] will not intercept requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting [`option: Browser.newContext.serviceWorkers`] to `'block'`.
:::
An example of a naive handler that aborts all image requests:

View file

@ -257,7 +257,7 @@ state is still returned, but won't be saved to the disk.
If specified the network requests that are made in the context will be served from the HAR file. Read more about [Replaying from HAR](../network.md#replaying-from-har).
:::note
Playwright will not serve requests intercepted by Service Worker from the HAR file. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception. Via `await context.addInitScript(() => delete window.navigator.serviceWorker);`
Playwright will not serve requests intercepted by Service Worker from the HAR file. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting [`option: Browser.newContext.serviceWorkers`] to `'block'`.
:::
## csharp-java-python-context-option-har-path

View file

@ -3114,8 +3114,8 @@ export interface Page {
* > NOTE: The handler will only be called for the first url if the response is a redirect.
* > NOTE: [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route) will not intercept
* requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We
* recommend disabling Service Workers when using request interception. Via `await context.addInitScript(() => delete
* window.navigator.serviceWorker);`
* recommend disabling Service Workers when using request interception by setting `Browser.newContext.serviceWorkers` to
* `'block'`.
*
* An example of a naive handler that aborts all image requests:
*
@ -7036,10 +7036,11 @@ export interface BrowserContext {
* Routing provides the capability to modify network requests that are made by any page in the browser context. Once route
* is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
*
* > NOTE: [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route) will not intercept
* requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We
* recommend disabling Service Workers when using request interception. Via `await context.addInitScript(() => delete
* window.navigator.serviceWorker);`
* > NOTE:
* [browserContext.route(url, handler[, options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-route)
* will not intercept requests intercepted by Service Worker. See
* [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
* request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
*
* An example of a naive handler that aborts all image requests:
*
@ -10512,7 +10513,7 @@ export interface BrowserType<Unused = {}> {
*
* > NOTE: Playwright will not serve requests intercepted by Service Worker from the HAR file. See
* [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
* request interception. Via `await context.addInitScript(() => delete window.navigator.serviceWorker);`
* request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
*/
har?: {
/**
@ -11767,7 +11768,7 @@ export interface AndroidDevice {
*
* > NOTE: Playwright will not serve requests intercepted by Service Worker from the HAR file. See
* [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
* request interception. Via `await context.addInitScript(() => delete window.navigator.serviceWorker);`
* request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
*/
har?: {
/**
@ -13335,7 +13336,7 @@ export interface Browser extends EventEmitter {
*
* > NOTE: Playwright will not serve requests intercepted by Service Worker from the HAR file. See
* [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
* request interception. Via `await context.addInitScript(() => delete window.navigator.serviceWorker);`
* request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
*/
har?: {
/**
@ -14207,7 +14208,7 @@ export interface Electron {
*
* > NOTE: Playwright will not serve requests intercepted by Service Worker from the HAR file. See
* [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
* request interception. Via `await context.addInitScript(() => delete window.navigator.serviceWorker);`
* request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
*/
har?: {
/**
@ -16000,7 +16001,7 @@ export interface BrowserContextOptions {
*
* > NOTE: Playwright will not serve requests intercepted by Service Worker from the HAR file. See
* [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
* request interception. Via `await context.addInitScript(() => delete window.navigator.serviceWorker);`
* request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
*/
har?: {
/**

View file

@ -2706,7 +2706,7 @@ export interface PlaywrightTestOptions {
*
* > NOTE: Playwright will not serve requests intercepted by Service Worker from the HAR file. See
* [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
* request interception. Via `await context.addInitScript(() => delete window.navigator.serviceWorker);`
* request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
*/
har: HAROptions | undefined;
/**