-
Notifications
You must be signed in to change notification settings - Fork 210
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
chore: refactor UrlMatcher #1720
Conversation
playwright/src/main/java/com/microsoft/playwright/impl/UrlMatcher.java
Outdated
Show resolved
Hide resolved
playwright/src/main/java/com/microsoft/playwright/impl/UrlMatcher.java
Outdated
Show resolved
Hide resolved
playwright/src/main/java/com/microsoft/playwright/impl/UrlMatcher.java
Outdated
Show resolved
Hide resolved
static UrlMatcher any() { | ||
return new UrlMatcher((Object) null, null); | ||
} | ||
private final URL baseURL; |
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.
Why not resolve the pattern in the constructor and avoid plumbing base url all the way through?
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.
We need this later on when I'll add this check:
playwright/src/main/java/com/microsoft/playwright/impl/UrlMatcher.java
Outdated
Show resolved
Hide resolved
d564bc4
to
fb252dc
Compare
playwright/src/main/java/com/microsoft/playwright/impl/UrlMatcher.java
Outdated
Show resolved
Hide resolved
playwright/src/main/java/com/microsoft/playwright/impl/UrlMatcher.java
Outdated
Show resolved
Hide resolved
9f6a2a8
to
e31f5d3
Compare
playwright/src/main/java/com/microsoft/playwright/impl/UrlMatcher.java
Outdated
Show resolved
Hide resolved
playwright/src/main/java/com/microsoft/playwright/impl/UrlMatcher.java
Outdated
Show resolved
Hide resolved
e31f5d3
to
97def24
Compare
} | ||
return Objects.equals(rawSource, that.rawSource); | ||
return true; |
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 believe it should be return that.pattern == null && that.predicate == null && that.glob == null;
, otherwise it will be equal to any other pattern.
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 think I already have it like that.
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 disagree, with the current code e.g.new UrlMatcher(null, null, null, null).equals(new UrlMatcher((String s) -> true) == true
which is incorrect.
Extracted from #1717. There should be no behaviour changes.
This moves
rawSource
towards having it lazily determined which matching source it is - this helps us to align with upstream.