Commit Graph

27 Commits

Author SHA1 Message Date
Daniel Martí
24decf54d3 remove top level frame mutex from Target
Now that it handles events synchronously, there's no need to worry about
concurrent field accesses.
2019-04-01 12:18:16 +01:00
Daniel Martí
81a48280ef route all communication via the browser
Use a single websocket connection per browser, removing the need for an
extra websocket connection per target.

This is thanks to the Target.sendMessageToTarget command to send
messages to each target, and the Target.receivedMessageFromTarget event
to receive messages back.

The browser handles activity via a single worker goroutine, and the same
technique is used for each target. This means that commands and events
are dealt with in order, and we can do away with some complexity like
mutexes and extra go statements.
2019-04-01 12:18:16 +01:00
Daniel Martí
3d3bf22ccc start the chromedp v2 refactor
First, we want all of the functionality in a single package; this means
collapsing whatever is useful into the root chromedp package.

The runner package is being replaced by the Allocator interface, with a
default implementation which starts browser processes.

The client package doesn't really have a place in the new design. The
context, allocator, and browser types will handle the connection with
each browser.

Finally, the new API is context-based, hence the addition of context.go.
The tests have been modified to build and run against the new API.
2019-04-01 12:17:28 +01:00
xinglong
5aca12cc3e send messages with select to avoid deadlocks
Fixes #287.
2019-04-01 10:35:07 +01:00
Daniel Martí
e9aa66f87e fix build breakage with newer cdproto versions
This isn't strictly necessary, as one can always build with the earlier
cdproto version specified in go.mod. However, many people still install
chromedp in GOPATH via 'go get -u', so this workaround makes life easier
for a lot of developers.

Fixes #285.
2019-03-28 21:45:27 +00:00
zhongjiajia
5dc1e0f3af use buffered chan for h.detached 2019-02-20 13:12:41 +01:00
Kenneth Shaw
53015e7d81 Changing Debugging => DevTools 2018-07-13 12:46:30 +07:00
Kenneth Shaw
4ae10864e4 Adding client API changes prior to package rewrite 2018-07-13 11:24:37 +07:00
Kenneth Shaw
1e1a3ace12 General code cleanup 2018-05-19 05:06:19 +07:00
Kenneth Shaw
b0c2445e67 Splitting repositories 2017-12-28 11:17:14 +07:00
Kenneth Shaw
6afa874714 Add empty *page.EventLifecycleEvent handler
Fixes #154
2017-12-18 11:03:22 +07:00
Daniel Martí
335d22d376 all: simplify some error variables
There's no need to put the error variables in a larger scope, nor define
them earlier than necessary. If anything, it makes the code harder to
follow, such as figuring out when nil errors are returned.
2017-12-18 10:51:37 +07:00
Daniel Martí
7ed029cf24 all: remove unnecessary loop labels
All of them are used for a single return, so use the return instead.
2017-12-18 10:51:37 +07:00
Rob Holland
68bf958ce3 If we receive an updated frame ensure we reset cur if required.
Prior to this change `cur` can be stale, meaning the frame returned for
`WaitFrame(ctxt, cdptypes.EmptyFrameID)` will be out of date, and never updated
based on incoming events.
2017-06-18 08:10:24 +07:00
Kenneth Shaw
622bb2ac33 Removing bad context declaration 2017-06-18 08:07:06 +07:00
Kenneth Shaw
869aafc836 Adding script to generate domains from protocol.json and updating to latest protocol.json 2017-05-06 08:20:24 +07:00
Kenneth Shaw
eb9de08765 Fixing typo from last commit 2017-03-28 07:42:47 +07:00
Kenneth Shaw
8eb44961e2 Adding simple bounds check on InlineStyleInvalidated events
Temporary fix. Better logic should be in place to handle this.

Fixes #44
2017-03-28 06:59:28 +07:00
Kenneth Shaw
4c16faa34d Minor code cleanup/maintenance on generated cdp protocol 2017-02-18 15:36:24 +07:00
Kenneth Shaw
ab80f4c5bc Fixing race issues on nodes 2017-02-18 14:28:43 +07:00
Randy Cahyana
0db7a9ee72 Increasing unit test coverage on query.go 2017-02-18 10:50:33 +07:00
Kenneth Shaw
b5032069e3 Fixing race issues
- Refactored chromedp-gen and cdp code so that Execute no longer returns
  a channel
- Fixing potential race problems in handler
- Eliminated some dead code
- Updated examples to include new logging parameters
2017-02-14 17:15:53 +07:00
Kenneth Shaw
7326b390a0 Initial changes to provide configurable logging options 2017-02-13 16:00:39 +07:00
Kenneth Shaw
3673164aef Code cleanup
- Refactored API calls to be cleaner
- Changed types that shoudn't be exported to not-exported
- Updated examples with API changes
- Added unit test for Title action
2017-02-12 14:08:40 +07:00
Kenneth Shaw
f73c429109 Renaming FrameHandler, updating to latest protocol.json, and code fixes 2017-02-12 12:50:46 +07:00
Kenneth Shaw
58283934b9 Fixing issues with code generation 2017-01-26 14:28:34 +07:00
Kenneth Shaw
20d575fece Initial import 2017-01-24 22:09:23 +07:00