Commit Graph

232 Commits

Author SHA1 Message Date
Pavel Feldman
437fe17825
browser(firefox): expose resource timing info (#4205) 2020-10-21 13:55:30 -07:00
Yury Semikhatsky
092c9905e6
browser(firefox): fix screencast timescale precision (#4196) 2020-10-20 13:39:56 -07:00
Joel Einbinder
4f7d65fe9c
browser(firefox): report pageerrors without stack properties (#4166) 2020-10-19 02:23:53 -07:00
Joel Einbinder
305d209e82
browser(firefox): always send focus events (#4150) 2020-10-16 01:28:13 -07:00
Andrey Lushnikov
8f8bebb632
browser(firefox): roll Firefox to tip-of-tree Oct, 12 (#4158) 2020-10-15 09:51:21 -07:00
Yury Semikhatsky
3c32c1683a
browser(firefox): use 16-byte long uid instead of ordinal as screencast id (#4147) 2020-10-14 16:14:24 -07:00
Joel Einbinder
a4474f6752
browser(firefox): Page.dispatchTapEvent (#4101) 2020-10-13 12:24:11 -07:00
Andrey Lushnikov
58285f6155
browser(firefox): await browser initialization when closing browser (#4121)
We try to avoid closing firefox too early, fearing that this
might terminate clean shutdown sequence.

Usually we assume that `Browser.enable` is called before `Browser.close`
- however, this is not the case in certain tests. So we have to
ensure browser initialization in `Browser.close` as well.

In my local tests, this fixes the Firefox Pipe problem: it looks like
we were closing browser too quickly.
2020-10-12 22:34:04 -07:00
Andrey Lushnikov
6a7d24469a
devops: fix firefox build (#4088)
New firefox build requires a pre-created python virtual environment.
We should detect it and create if necessary.

References #3995
2020-10-07 14:34:58 -07:00
Andrey Lushnikov
1ccce09a02
browser(firefox): roll Firefox to beta Oct 7, 2020 (#4087)
References #3995
2020-10-07 14:12:19 -07:00
Andrey Lushnikov
6beef551d9
browser(firefox): wait for search and addon manager initialization (#4081)
It looks like terminating browser when search service or addon manager is
not fully initialized results in a broken shutdown sequence. As of
today, this results in multiple errors in the browser STDERR. In future,
this might also result in browser stalling instead of terminating.

This starts awaiting search and addon manager termination.

References #3995
2020-10-07 10:24:16 -07:00
Andrey Lushnikov
3b4232864d
browser(firefox): a different way to emit 'load' event (#4080)
Using WebProgressListener events works in all cases. Currently
used `pageshow` event will stop being emitted in future when loading
was stopped with `window.stop()` api.

References #3995
2020-10-07 09:22:56 -07:00
Andrey Lushnikov
e6869edf98
browser(firefox): fix typo in dispatcher teardown (#4069) 2020-10-06 12:06:50 -07:00
Andrey Lushnikov
4ab66a4fe5
browser(firefox): follow-up with assorted simplifications (#4066)
This patch:
- moves `SimpleChannel` to synchronously dispatch buffered commands
  instead of a `await Promise.resolve()` hack
- moves dialog & screencast handling from `PageHandler` to
  `TargetManager`. This leaves `PageHandler` to be concerned solely about
  protocol.
- removes `attach` and `detach` methods for worker channels: since
  channels are buffering messages until the namespace registers, there's
  no chance to loose any events.
- slightly simplifies `PageNetwork` class: it's lifetime is now
  identical to the lifetime of the associated `PageTarget`, so a lot can
  be simplified later on.

References #3995
2020-10-06 01:53:25 -07:00
Andrey Lushnikov
c8a64b88e1
browser(firefox): enable document channel (#4065)
In the current tip-of-tree Firefox, document channel is enabled by
default, so we have to enable it in order to roll further.

This patch:
1. Removes content disposition sniffing from content process since it
   crashes renderer with document channel.
2. Merges all page-related handlers in a single `PageHandler` and
   serializes network events wrt the `Page.frameAttached` event.

The serialization mentioned in (2) is necessary: frame attachment is
reported from the content process, and network events are reported from
the browsers process. This is an inherent race, that becomes exposed by
the document channel.

On a side note, (2) makes it possible to synchronously report all
buffered events in `SimpleChannel` (cc offline discussion with @dgozman
that highlighted an unsighty approach that we currently employ there: reporting
events in a subsequent microtask.)

References #3995
2020-10-06 00:15:24 -07:00
Pavel Feldman
857abcfc10
browser(firefox): make pipe work on Windows (#4058) 2020-10-05 10:58:56 -07:00
Dmitry Gozman
133de10a47
browser(firefox): start screencast in existing pages upon setScreencastOptions (#4045)
This makes it work in persistent context.

To achieve this, we have to move screencast logic into PageTarget and
make PageHandler listen to an event.
2020-10-02 17:16:49 -07:00
Andrey Lushnikov
2c11b10598
browser(firefox): remove multisession logic (#4039)
This patch:
1. Changes `SimpleChannel` to buffer messages to the namespace that
   hasn't been registered yet. This allows us to create `SimpleChannel`
   per target on the browser side right away.
2. Removes multisession support. Now there's only one `PageAgent` in the
   content process, which talks to a single `PageHandler` on the browser
   side. Both ends can be created as-soon-as-needed; thanks to
   `SimpleChannel` bufferring, no messages will be lost and all messages
   will be delivered in proper order. (This is currently the reason why
   build 1178 flakes on windows).
3. Straightens up the target reporting. Targets are reported as soon
   as they appear on the browser side.

**NOTE:** this doesn't yet remove sessions from protocol.

References #3995
2020-10-02 04:13:42 -07:00
Andrey Lushnikov
b74a6b78ef
browser(firefox): do not double-attach session to the same target (#4027)
We currently might double-attach to the target in `BrowserHandler` since we iterate over all targets, and then subscribe to the additional event when target is getting initialized.

This patch fixes this race condition and should unblock the roll to r1177.

References #3995
2020-09-30 23:50:02 -07:00
Andrey Lushnikov
974358442d
browser(firefox): move user agent emulation to browser side (#4016)
References #3995
2020-09-30 08:02:22 -07:00
Andrey Lushnikov
e28083974d
browser(firefox): simplify PageTarget lifecycle (#4014)
As of today, we create `PageTarget` instances whenever we get a
sync IPC from the content process. This, however, breaks an invariant
that `browserContext.pages` always has all pages (and *browsing contexts* - not to be confused with *browser contexts*), associated with browser context. This invariant will be especially important when we move
user agent emulation to browser-side.

This patch makes `PageTarget` lifecycle symmetrical:
- `PageTarget` instance is created when tab is opened
- `PageTarget` is destroyed when tab is crashed or closed

This should also fix a bunch of race conditions with persistent mode, since sometimes we arrive to the window after its
initialization.

Drive-by: straighten viewport management and put a nice descriptive comment.
2020-09-30 02:10:34 -07:00
Andrey Lushnikov
24bc0e39b8
browser(firefox): remove the hack around setting viewport size (#4010)
Juggler code had a bug where we subscribed to window and tab
events, but did not iterate collections of current windows and tabs.

As a result, we were sometimes failing to set viewport size for the
initial window, and implemented an artificial promise to workaround
the problem.

This patch:
- starts calling `onOpenWindow` and `onOpenTabListener` callbacks
  for *all* windows and tabs - current and future, eliminating the
  race condition.

This worked too well and we started overriding window sizes that
were set by users with `window.open(url, 'width=300;height=400')` (we
have a test for this). To fix this, we now plumb `CHROME_WITH_SIZE`
flag from appWindow and override viewport iff this flag is not set.

After this patch, we will use the `onTabOpened` event to move user
agent emulation to the browser-side.

References #3995
2020-09-30 00:36:46 -07:00
Andrey Lushnikov
2631e1a809
browser(firefox): use browsingContextID for frame IDs (#3999)
BrowsingContextIDs are consistent across the processes, so we can use
them to target frames in both browser and content processes. This will
aid browser-side navigation.

As a nice side-effect, we can drop a round-trip to the content process
for every `requestWillBeSent` event since we *almost* always can
attribute all network events to the proper parent frames.

I say "almost", because we in fact **fail** to correctly attribute requests
from workers that are instantiated by subframes. This, however, is
not working in Chromium ATM, so I consider this to be a minor regression
that is worth the simplification.
2020-09-29 11:22:00 -07:00
Yury Semikhatsky
25b199b40a
browser(firefox): fix screencast start event for popups (#3834) 2020-09-10 14:37:48 -07:00
Yury Semikhatsky
d64d0025a4
browser(firefox): fix screencast in first window on mac headful (#3826)
* browser(firefox): fix screencast in first window on mac headful

* Revert only
2020-09-10 00:40:56 -07:00
Andrey Lushnikov
6c83266047
browser(firefox): force firefox devtools to open in a separate window (#3816)
References #3470
2020-09-09 09:36:32 -07:00
Dmitry Gozman
5364c6acbc
browser(firefox): fix automatic http->https redirect (#3812)
browser(firefox): fix automatic http->https redirect

Sometimes, Firefox does an automatic http->https redirect without hitting
the network (e.g. for http://wikipedia.org). In this case, the http request
is very strange:
- it does not actually hit the network;
- it is never intercepted;
- we cannot access its response because there was no actual response.

So, we had a bug where:
- redirects inherited the original request's listener;
- that listener was throwing an error.
This lead to the error in the listeners onDataAvailable call chain,
and original listener that renders the response was never called,
resulting in an empty page.

This change:
- ignores the original request that did not hit the network;
- does not inherit the listener;
- adds try/catch around problematic calls.
2020-09-09 09:16:03 -07:00
Yury Semikhatsky
ee1becd897
browser(firefox): autoscale screencast to fit frame (#3720) 2020-09-01 17:10:06 -07:00
Joel Einbinder
abb50a79bd
browser(firefox): fix request frame attribution (#3657)
Firefox will sometimes send multiple requests with the same http channel id. When a frame is loaded, the favicon is requested in the parent frame, but with the same channel id. This can cause the document request to report the wrong frame, causing the test 'should capture iframe navigation request' to fail. It fails consistently on my computer.

This patch adds the content policy type into the http channelId to better distinguish requests. Maybe there is something better we can do? It looks like we use channelId has request ids, so there might be more bugs with these favicon requests in playwright?
2020-08-28 17:55:05 -07:00
Yury Semikhatsky
17077fd901
browser(firefox): introduce browser level screencastFinished event (#3625) 2020-08-25 14:50:40 -07:00
Yury Semikhatsky
9f3a1b5168
browser(firefox): send screencastStarted after attachedToTarget (#3554) 2020-08-20 14:03:05 -07:00
Yury Semikhatsky
5ba0254c99
browser(firefox): make sure response is sent when context is closed (#3553) 2020-08-20 13:26:04 -07:00
Yury Semikhatsky
854d755db5
browser(firefox): make context close wait for sessions to finish (#3550) 2020-08-20 11:04:57 -07:00
Yury Semikhatsky
f13cebc66d
browser(firefox): remove redundant checks for PageTarget._browserContext (#3541) 2020-08-19 15:39:46 -07:00
Yury Semikhatsky
df50660458
browser(firefox): make tab close listener sync again (#3533) 2020-08-19 12:52:43 -07:00
Yury Semikhatsky
73cd6ecef3
browser(firefox): add screencast control methods to context (#3530) 2020-08-19 12:43:53 -07:00
Yury Semikhatsky
56da4bb027
devops: make sure rust toolchain is installed (#3485)
Otherwise if required version is not installed the build fails with a cryptic message like
`error: toolchain '1.45.0-x86_64-unknown-linux-gnu' does not support components`
2020-08-19 09:11:28 -07:00
Andrey Lushnikov
4dde2882e7
browser(firefox): roll Firefox to August 14 beta (#3465) 2020-08-13 23:14:24 -07:00
Joel Einbinder
a4eb86c3df
browser(firefox): update styles when changing color scheme (#3407)
`MediaFeatureValuesChanged` is what their devtools code uses to update the styles. I tried using their code directly, but it doesn't play nicely with navigations so I decided to stick with ours.
2020-08-13 12:16:00 -07:00
Andrey Lushnikov
915902c858
browser(firefox): roll Firefox to roughly July, 15 (#3411) 2020-08-12 10:09:20 -07:00
Dmitry Gozman
da95b73b59
browser(firefox): emit iframe lifecycle when initial navigation fails (#3389) 2020-08-11 16:05:34 -07:00
Yury Semikhatsky
538daf3302
browser(firefox): exclude frame from screencast video (#3372) 2020-08-10 15:10:12 -07:00
Andrey Lushnikov
a225447653
browser(firefox): introduce global proxy (#3335)
This will be used instead of messing up user preferences for proxy
setup.
2020-08-07 15:38:06 -07:00
Andrey Lushnikov
ca3bd5e2ef
browser(firefox): roll Firefox to June, 24 (#3327)
Review URL: 83e6f0114e

References #3215
2020-08-06 10:32:50 -07:00
Yury Semikhatsky
9effb32650
browser(firefox): always create new process rather than reuse one (#3312) 2020-08-05 15:48:26 -07:00
Yury Semikhatsky
90819fa350
browser(firefox): always create image buffer in headless mode (#3299) 2020-08-04 17:58:57 -07:00
Yury Semikhatsky
7e28c26f6d
browser(firefox): do not complain about SnapshotListener being cleared on Destroy (#3298) 2020-08-04 17:38:46 -07:00
Andrey Lushnikov
25089760fd
devops: fix typo in rustup detection (#3282)
This should bring back docker build.
2020-08-04 00:02:14 -07:00
Dmitry Gozman
d3a40be479
browser(firefox): reliably close the pipe (#3280) 2020-08-03 20:15:25 -07:00
Dmitry Gozman
402d1a6a67
browser(firefox): fix win compile 2 (#3277) 2020-08-03 15:26:12 -07:00