diff options
author | Josh Matthews <josh@joshmatthews.net> | 2020-06-18 00:02:44 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2020-06-18 00:02:44 -0400 |
commit | c7f5d8a2660f48ad6ce229b19115cc9bd057d2fb (patch) | |
tree | 48640ea264510fa21477a6c79bc064a62137d0ba /support | |
parent | bd8c7d6f4d0c84f901bb0822cb48deb38b86037f (diff) | |
download | servo-c7f5d8a2660f48ad6ce229b19115cc9bd057d2fb.tar.gz servo-c7f5d8a2660f48ad6ce229b19115cc9bd057d2fb.zip |
UWP: clear console when navigating pages.
Diffstat (limited to 'support')
-rw-r--r-- | support/hololens/ServoApp/BrowserPage.cpp | 5 | ||||
-rw-r--r-- | support/hololens/ServoApp/BrowserPage.h | 1 | ||||
-rw-r--r-- | support/hololens/ServoApp/Devtools/Client.cpp | 4 | ||||
-rw-r--r-- | support/hololens/ServoApp/Devtools/Client.h | 1 |
4 files changed, 10 insertions, 1 deletions
diff --git a/support/hololens/ServoApp/BrowserPage.cpp b/support/hololens/ServoApp/BrowserPage.cpp index 85b1c0c5885..29b18a3e439 100644 --- a/support/hololens/ServoApp/BrowserPage.cpp +++ b/support/hololens/ServoApp/BrowserPage.cpp @@ -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, [=] { diff --git a/support/hololens/ServoApp/BrowserPage.h b/support/hololens/ServoApp/BrowserPage.h index 1b4a53bc636..db127cdf569 100644 --- a/support/hololens/ServoApp/BrowserPage.h +++ b/support/hololens/ServoApp/BrowserPage.h @@ -44,6 +44,7 @@ public: void OnPrefererenceSearchboxEdited(IInspectable const &, Input::KeyRoutedEventArgs const &); void OnDevtoolsMessage(servo::DevtoolsMessageLevel, hstring, hstring); + void ClearConsole(); void OnDevtoolsDetached(); private: diff --git a/support/hololens/ServoApp/Devtools/Client.cpp b/support/hololens/ServoApp/Devtools/Client.cpp index 8a10ce65cdc..c7d1b7cfc89 100644 --- a/support/hololens/ServoApp/Devtools/Client.cpp +++ b/support/hololens/ServoApp/Devtools/Client.cpp @@ -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 diff --git a/support/hololens/ServoApp/Devtools/Client.h b/support/hololens/ServoApp/Devtools/Client.h index 162d2e33e07..3764c201d46 100644 --- a/support/hololens/ServoApp/Devtools/Client.h +++ b/support/hololens/ServoApp/Devtools/Client.h @@ -51,6 +51,7 @@ private: class DevtoolsDelegate { public: virtual void OnDevtoolsMessage(DevtoolsMessageLevel, hstring, hstring) = 0; + virtual void ClearConsole() = 0; virtual void OnDevtoolsDetached() = 0; }; |