1
0
mirror of synced 2026-08-05 06:56:56 +00:00

fix: event info for waitForLoadState (#534)

This commit is contained in:
Yury Semikhatsky
2021-07-30 04:54:42 -07:00
committed by GitHub
parent 3e7f8017e0
commit 696610de15
4 changed files with 11 additions and 6 deletions
@@ -69,7 +69,7 @@ class ChannelOwner extends LoggingSupport {
}
<T> T withWaitLogging(String apiName, Supplier<T> code) {
return withLogging(apiName, new WaitForEventLogger<>(this, apiName, code));
return new WaitForEventLogger<>(this, apiName, code).get();
}
@Override
@@ -781,7 +781,10 @@ public class FrameImpl extends ChannelOwner implements Frame {
@Override
public void waitForLoadState(LoadState state, WaitForLoadStateOptions options) {
withLogging("Frame.waitForLoadState", () -> waitForLoadStateImpl(state, options));
withWaitLogging("Frame.waitForLoadState", () -> {
waitForLoadStateImpl(state, options);
return null;
});
}
void waitForLoadStateImpl(LoadState state, WaitForLoadStateOptions options) {
@@ -1221,8 +1221,10 @@ public class PageImpl extends ChannelOwner implements Page {
@Override
public void waitForLoadState(LoadState state, WaitForLoadStateOptions options) {
withLogging("Page.waitForLoadState",
() -> mainFrame.waitForLoadStateImpl(state, convertViaJson(options, Frame.WaitForLoadStateOptions.class)));
withWaitLogging("Page.waitForLoadState", () -> {
mainFrame.waitForLoadStateImpl(state, convertViaJson(options, Frame.WaitForLoadStateOptions.class));
return null;
});
}
@Override
@@ -53,10 +53,10 @@ public class WaitForEventLogger<T> implements Supplier<T> {
}
private void sendWaitForEventInfo(JsonObject info) {
info.addProperty("apiName", apiName);
info.addProperty("event", "");
info.addProperty("waitId", waitId);
JsonObject params = new JsonObject();
params.add("info", info);
channel.sendMessageAsync("waitForEventInfo", params);
channel.withLogging(apiName, () -> channel.sendMessageAsync("waitForEventInfo", params));
}
}