From 2714ff8f25972c28d6667c83b834f189b0427f2d Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Mon, 12 Feb 2018 19:27:09 +0000
Subject: [PATCH] MAINT-8276 Arrows 'Navigate back' and 'Navigate forward' have
 wrong state

---
 indra/llplugin/llpluginclassmedia.cpp        | 2 ++
 indra/media_plugins/cef/media_plugin_cef.cpp | 2 ++
 indra/newview/llfloaterwebcontent.cpp        | 3 +++
 3 files changed, 7 insertions(+)

diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index 680017204c0..f3fd4277ce4 100644
--- a/indra/llplugin/llpluginclassmedia.cpp
+++ b/indra/llplugin/llpluginclassmedia.cpp
@@ -1085,6 +1085,8 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
 		}
 		else if(message_name == "name_text")
 		{
+			mHistoryBackAvailable = message.getValueBoolean("history_back_available");
+			mHistoryForwardAvailable = message.getValueBoolean("history_forward_available");
 			mMediaName = message.getValue("name");
 			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_NAME_CHANGED);
 		}
diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp
index f3d7762a08e..4dbee12ea09 100644
--- a/indra/media_plugins/cef/media_plugin_cef.cpp
+++ b/indra/media_plugins/cef/media_plugin_cef.cpp
@@ -194,6 +194,8 @@ void MediaPluginCEF::onTitleChangeCallback(std::string title)
 {
 	LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "name_text");
 	message.setValue("name", title);
+	message.setValueBoolean("history_back_available", mCEFLib->canGoBack());
+	message.setValueBoolean("history_forward_available", mCEFLib->canGoForward());
 	sendMessage(message);
 }
 
diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp
index dece3fc1ea6..8a8d92d4594 100644
--- a/indra/newview/llfloaterwebcontent.cpp
+++ b/indra/newview/llfloaterwebcontent.cpp
@@ -399,6 +399,9 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent
 	}
 	else if(event == MEDIA_EVENT_NAME_CHANGED )
 	{
+		// flags are sent with this event
+		mBtnBack->setEnabled(self->getHistoryBackAvailable());
+		mBtnForward->setEnabled(self->getHistoryForwardAvailable());
 		std::string page_title = self->getMediaName();
 		// simulate browser behavior - title is empty, use the current URL
 		if (mShowPageTitle)
-- 
GitLab