-
-
Notifications
You must be signed in to change notification settings - Fork 303
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
Bugfix/#399 navigation #432
Conversation
# Conflicts: # go.mod # go.sum
Codecov Report
@@ Coverage Diff @@
## master #432 +/- ##
========================================
+ Coverage 39.4% 41.7% +2.3%
========================================
Files 222 227 +5
Lines 9096 8756 -340
========================================
+ Hits 3585 3654 +69
+ Misses 5154 4746 -408
+ Partials 357 356 -1 |
) | ||
|
||
type ( | ||
DocumentUpdatedListener func(ctx context.Context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment to all types below please.
pkg/drivers/cdp/events/listener.go
Outdated
} | ||
) | ||
|
||
// Many is a helper function that tells event loop to always call the function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Always...
} | ||
|
||
// Many is a helper function that tells event loop to call the function only once | ||
func Once(fn func(ctx context.Context, message interface{})) Handler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Once...
lc.mu.Lock() | ||
defer lc.mu.Unlock() | ||
|
||
bucket, exists := lc.values[eventID] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go allows you to delete key from the map without any checks.
Example: https://play.golang.org/p/yHhJIsYHkm6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but i'm not deleting it from lc.values
. I'm deleting in from a nested map.
"github.com/mafredri/cdp/rpcc" | ||
) | ||
|
||
type ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment to all types below please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:(
) | ||
|
||
var ( | ||
Error = New("error") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a builtin event ID
pkg/drivers/cookies.go
Outdated
|
||
oc := other.(HTTPCookies) | ||
|
||
if len(c) > len(oc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch-case
seems to be more readable
switch {
case len(c) > len(oc):
return 1
case len(c) < len(oc):
return -1
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe? I didn't know that you can omit switch expression.
|
||
var emptyExpires = time.Time{} | ||
|
||
func parseAttrs(attrs []string) *values.Object { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t quite understand what is going on here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CDP returns HTML attributes as an array of strings of key-value pairs. This methods parses the array and converts it into an object.
Big changes!
Refactored the way how we deal with frames and network events: