UWP: clear console when navigating pages.

This commit is contained in:
Josh Matthews 2020-06-18 00:02:44 -04:00
parent bd8c7d6f4d
commit c7f5d8a266
4 changed files with 10 additions and 1 deletions

View file

@ -273,6 +273,11 @@ void BrowserPage::OnPrefererenceSearchboxEdited(
}
}
void BrowserPage::ClearConsole() {
Dispatcher().RunAsync(CoreDispatcherPriority::Low,
[=] { DevtoolsConsoleOutput().Blocks().Clear(); });
}
void BrowserPage::OnDevtoolsMessage(DevtoolsMessageLevel level, hstring source,
hstring body) {
Dispatcher().RunAsync(CoreDispatcherPriority::Low, [=] {

View file

@ -44,6 +44,7 @@ public:
void OnPrefererenceSearchboxEdited(IInspectable const &,
Input::KeyRoutedEventArgs const &);
void OnDevtoolsMessage(servo::DevtoolsMessageLevel, hstring, hstring);
void ClearConsole();
void OnDevtoolsDetached();
private:

View file

@ -133,7 +133,9 @@ void DevtoolsClient::HandleMessage(JsonObject obj) {
// Ignore
return;
} else if (obj.GetNamedString(L"type") == L"tabNavigated") {
// Ignore
if (obj.HasKey(L"state") && obj.GetNamedString(L"state") == L"stop") {
mDelegate.ClearConsole();
}
return;
} else if (obj.GetNamedString(L"type") == L"networkEventUpdate") {
// FIXME: log if there is a non-200 HTTP response

View file

@ -51,6 +51,7 @@ private:
class DevtoolsDelegate {
public:
virtual void OnDevtoolsMessage(DevtoolsMessageLevel, hstring, hstring) = 0;
virtual void ClearConsole() = 0;
virtual void OnDevtoolsDetached() = 0;
};