[Libreoffice-commits] online.git: 3 commits - configure.ac gtk/mobile.cpp gtk/README wsd/LOOLWSD.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Nov 1 21:23:49 UTC 2018
configure.ac | 20 +++++++++++-------
gtk/README | 2 -
gtk/mobile.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++-------------
wsd/LOOLWSD.cpp | 8 +++++++
4 files changed, 70 insertions(+), 22 deletions(-)
New commits:
commit 698b806e232bdffb7f61ee0734f7a0079993f134
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Nov 1 21:22:01 2018 +0000
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Nov 1 21:23:15 2018 +0000
gtk: compile fixes for socket latency and version display.
Change-Id: I4ff4bcb54d8c1227feeb19b281c38e1769ed83e7
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 8d89e65e5..7af8b7311 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1330,10 +1330,12 @@ void LOOLWSD::handleOption(const std::string& optionName,
if (masterPort)
MasterPortNumber = std::stoi(masterPort);
+#ifndef MOBILEAPP
static const char* latencyMs = std::getenv("LOOL_DELAY_SOCKET_MS");
if (latencyMs)
SimulatedLatencyMs = std::stoi(latencyMs);
#endif
+#endif
#ifdef FUZZER
if (optionName == "dummy-lok")
@@ -1553,8 +1555,10 @@ bool LOOLWSD::createForKit()
if (UnitWSD::get().hasKitHooks())
args.push_back("--unitlib=" + UnitTestLibrary);
+#ifndef MOBILEAPP
if (DisplayVersion)
args.push_back("--version");
+#endif
if (NoCapsForKit)
args.push_back("--nocaps");
@@ -2807,8 +2811,10 @@ class SslSocketFactory final : public SocketFactory
{
int fd = physicalFd;
+#ifndef MOBILEAPP
if (SimulatedLatencyMs > 0)
fd = Delay::create(SimulatedLatencyMs, physicalFd);
+#endif
return StreamSocket::create<SslStreamSocket>(
fd, false, std::make_shared<ClientRequestDispatcher>());
@@ -3052,6 +3058,7 @@ int LOOLWSD::innerMain()
// down-pay all the forkit linking cost once & early.
Environment::set("LD_BIND_NOW", "1");
+#ifndef MOBILEAPP
if (DisplayVersion)
{
std::string version, hash;
@@ -3059,6 +3066,7 @@ int LOOLWSD::innerMain()
LOG_INF("Loolwsd version details: " << version << " - " << hash);
}
#endif
+#endif
initializeSSL();
commit 647150427e295f312deed6c9464f801b00820698
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Nov 1 21:21:04 2018 +0000
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Nov 1 21:23:12 2018 +0000
gtk: compile with older WebKit JS interface too.
Change-Id: I62ce96932b77ea8051cfb2862cb4f617d2804c1d
diff --git a/gtk/mobile.cpp b/gtk/mobile.cpp
index a819972cb..0797fd9c6 100644
--- a/gtk/mobile.cpp
+++ b/gtk/mobile.cpp
@@ -36,6 +36,9 @@
#include <gtk/gtk.h>
#include <webkit2/webkit2.h>
+#if !WEBKIT_CHECK_VERSION(2,22,0)
+# include<JavaScriptCore/JavaScript.h>
+#endif
#include "FakeSocket.hpp"
#include "Log.hpp"
@@ -133,27 +136,55 @@ static void send2JS(const std::vector<char>& buffer)
}, jscopy);
}
-static void handle_debug_message(WebKitUserContentManager *manager,
- WebKitJavascriptResult *js_result,
- gpointer user_data)
+static char *js_result_as_gstring(WebKitJavascriptResult *js_result)
{
+#if WEBKIT_CHECK_VERSION(2,22,0) // unclear when this API changed ...
JSCValue *value = webkit_javascript_result_get_js_value(js_result);
if (jsc_value_is_string(value))
- LOG_TRC_NOFILE("From JS: debug: " << jsc_value_to_string(value));
+ return jsc_value_to_string(value);
+ else
+ return nullptr;
+#else // older Webkits
+ JSValueRef value = webkit_javascript_result_get_value(js_result);
+ JSContextRef ctx = webkit_javascript_result_get_global_context(js_result);
+ if (JSValueIsString(ctx, value))
+ {
+ const JSStringRef js_str = JSValueToStringCopy(ctx, value, nullptr);
+ size_t gstring_max = JSStringGetMaximumUTF8CStringSize(js_str);
+ char *gstring = (char *)g_malloc(gstring_max);
+ if (gstring)
+ JSStringGetUTF8CString(js_str, gstring, gstring_max);
+ else
+ LOG_TRC_NOFILE("No string");
+ JSStringRelease(js_str);
+ return gstring;
+ }
else
- LOG_TRC_NOFILE("From JS: debug: some object");
+ LOG_TRC_NOFILE("Unexpected object type " << JSValueGetType(ctx, value));
+ return nullptr;
+#endif
+}
+
+static void handle_message(const char * type, WebKitJavascriptResult *js_result)
+{
+ gchar *string_value = js_result_as_gstring(js_result);
+
+ if (string_value)
+ LOG_TRC_NOFILE("From JS: " << type << ": " << string_value);
+ else
+ LOG_TRC_NOFILE("From JS: " << type << ": some object");
+
+ g_free(string_value);
}
static void handle_lool_message(WebKitUserContentManager *manager,
WebKitJavascriptResult *js_result,
gpointer user_data)
{
- JSCValue *value = webkit_javascript_result_get_js_value(js_result);
+ gchar *string_value = js_result_as_gstring(js_result);
- if (jsc_value_is_string(value))
+ if (string_value)
{
- gchar *string_value = jsc_value_to_string(value);
-
LOG_TRC_NOFILE("From JS: lool: " << string_value);
if (strcmp(string_value, "HULLO") == 0)
@@ -257,15 +288,18 @@ static void handle_lool_message(WebKitUserContentManager *manager,
LOG_TRC_NOFILE("From JS: lool: some object");
}
+static void handle_debug_message(WebKitUserContentManager *manager,
+ WebKitJavascriptResult *js_result,
+ gpointer user_data)
+{
+ handle_message("debug", js_result);
+}
+
static void handle_error_message(WebKitUserContentManager *manager,
WebKitJavascriptResult *js_result,
gpointer user_data)
{
- JSCValue *value = webkit_javascript_result_get_js_value(js_result);
- if (jsc_value_is_string(value))
- LOG_TRC_NOFILE("From JS: error: " << jsc_value_to_string(value));
- else
- LOG_TRC_NOFILE("From JS: error: some object");
+ handle_message("error", js_result);
}
int main(int argc, char* argv[])
commit 52dace9d2921d8b3784702df7ab5c16fca2109a4
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Nov 1 21:20:15 2018 +0000
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Nov 1 21:23:08 2018 +0000
Disable SSL when configuring for mobile.
Change-Id: Ia337cde9f183849088d3712dd339f21b7d290fd7
diff --git a/configure.ac b/configure.ac
index 4dbf70409..6d845d07c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -372,22 +372,28 @@ AS_IF([test `uname -s` = Linux],
AS_IF([test "$ENABLE_GTKAPP" = true],
[PKG_CHECK_MODULES([WEBKIT],[webkit2gtk-4.0])])
-AS_IF([test "$enable_ssl" != "no"],
- [AC_DEFINE([ENABLE_SSL],1,[Whether to enable SSL])],
- [AC_DEFINE([ENABLE_SSL],0,[Whether to enable SSL])])
-
-AM_CONDITIONAL([ENABLE_SSL], [test "$enable_ssl" != "no"])
AM_CONDITIONAL([ENABLE_DEBUG], [test "$ENABLE_DEBUG" = "true"])
+mobile_app=
+AC_MSG_CHECKING([Is this a mobile app])
+if test "$enable_gtkapp" != "no" -o "$enable_iosapp" != "no"; then
+ AC_MSG_RESULT([Yes])
+ mobile_app=true;
+else
+ AC_MSG_RESULT([No])
+fi
+
ENABLE_SSL=true
-if test "$enable_ssl" != "no"; then
+if test "$enable_ssl" != "no" -a "$mobile_app" != "true"; then
ssl_msg="ssl enabled"
ENABLE_SSL=true
+ AC_DEFINE([ENABLE_SSL],1,[Whether to enable SSL])
else
ssl_msg="insecure: ssl disabled"
ENABLE_SSL=false
+ AC_DEFINE([ENABLE_SSL],0,[Whether to enable SSL])
fi
-
+AM_CONDITIONAL([ENABLE_SSL], [$ENABLE_SSL])
AC_SUBST(ENABLE_SSL)
AC_CHECK_HEADERS([security/pam_appl.h],
diff --git a/gtk/README b/gtk/README
index 7ad68f855..a0fb1ee5b 100644
--- a/gtk/README
+++ b/gtk/README
@@ -10,7 +10,7 @@ normal Online.
Run autogen.sh, then configure:
-./configure --disable-ssl --enable-gtkapp --with-lo-path=/home/tml/lo/master/instdir --with-lokit-path=/home/tml/lo/master/include
+./configure --enable-gtkapp --with-lo-path=/home/tml/lo/master/instdir --with-lokit-path=/home/tml/lo/master/include
Obviously, adjust the path to your LibreOffice build tree as necessary.
More information about the Libreoffice-commits
mailing list