Skip to content

Commit

Permalink
fix: NPE after pause (#1314)
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s authored Jun 20, 2023
1 parent 7a1bbe2 commit d219fdd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ void recordIntoHar(PageImpl page, Path har, RouteFromHAROptions options) {

@Override
public void setDefaultNavigationTimeout(double timeout) {
setDefaultNavigationTimeoutImpl(timeout);
}

void setDefaultNavigationTimeoutImpl(Double timeout) {
withLogging("BrowserContext.setDefaultNavigationTimeout", () -> {
timeoutSettings.setDefaultNavigationTimeout(timeout);
JsonObject params = new JsonObject();
Expand All @@ -455,6 +459,10 @@ public void setDefaultNavigationTimeout(double timeout) {

@Override
public void setDefaultTimeout(double timeout) {
setDefaultTimeoutImpl(timeout);
}

void setDefaultTimeoutImpl(Double timeout) {
withLogging("BrowserContext.setDefaultTimeout", () -> {
timeoutSettings.setDefaultTimeout(timeout);
JsonObject params = new JsonObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -938,13 +938,13 @@ public void pause() {
withLogging("Page.pause", () -> {
Double defaultNavigationTimeout = browserContext.timeoutSettings.defaultNavigationTimeout();
Double defaultTimeout = browserContext.timeoutSettings.defaultTimeout();
browserContext.setDefaultNavigationTimeout(0);
browserContext.setDefaultTimeout(0);
browserContext.setDefaultNavigationTimeoutImpl(0.0);
browserContext.setDefaultTimeoutImpl(0.0);
try {
runUntil(() -> {}, new WaitableRace<>(asList(context().pause(), (Waitable<JsonElement>) waitableClosedOrCrashed)));
} finally {
browserContext.setDefaultNavigationTimeout(defaultNavigationTimeout);
browserContext.setDefaultTimeout(defaultTimeout);
browserContext.setDefaultNavigationTimeoutImpl(defaultNavigationTimeout);
browserContext.setDefaultTimeoutImpl(defaultTimeout);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ Double defaultNavigationTimeout() {
return defaultNavigationTimeout;
}

void setDefaultTimeout(double timeout) {
void setDefaultTimeout(Double timeout) {
defaultTimeout = timeout;
}

void setDefaultNavigationTimeout(double timeout) {
void setDefaultNavigationTimeout(Double timeout) {
defaultNavigationTimeout = timeout;
}

Expand Down

0 comments on commit d219fdd

Please sign in to comment.