diff win/edge.cpp @ 2045:cb195d76de8e

Win: Make HTML_RESULT event match other platforms and disable dev tools when not DEBUG. When javascript_run() does not have a result other platforms return a NULL pointer, but Edge Chromium returns a string "null"; this change checks for "null" and makes it a NULL pointer instead. This may cause problems when a "null" string result is the expected result. Additionally disable developer tools for the HTML widget when DEBUG is not defined when compiling.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 25 Nov 2019 04:47:43 +0000
parents b74b9afa31aa
children cfa0a9554118
line wrap: on
line diff
--- a/win/edge.cpp	Mon Nov 25 03:16:45 2019 +0000
+++ b/win/edge.cpp	Mon Nov 25 04:47:43 2019 +0000
@@ -97,6 +97,9 @@
 					Settings->put_IsScriptEnabled(TRUE);
 					Settings->put_AreDefaultScriptDialogsEnabled(TRUE);
 					Settings->put_IsWebMessageEnabled(TRUE);
+#ifndef DEBUG
+					Settings->put_AreDevToolsEnabled(FALSE);
+#endif
 
 					// Resize WebView to fit the bounds of the parent window
 					WebView->DoSize();
@@ -290,7 +293,10 @@
 			Callback<IWebView2ExecuteScriptCompletedHandler>(
 				[thishwnd, scriptdata](HRESULT error, PCWSTR result) -> HRESULT
 				{
-					_wndproc(thishwnd, WM_USER + 100, (error == S_OK ? (WPARAM)WideToUTF8((LPWSTR)result) : NULL), (LPARAM)scriptdata);
+					if (result && _wcsicmp(result, L"null") == 0)
+						result = NULL;
+					void *params[2] = { (void *)(result ? WideToUTF8((LPWSTR)result) : NULL), DW_INT_TO_POINTER((error == S_OK ? DW_ERROR_NONE : DW_ERROR_UNKNOWN)) };
+					_wndproc(thishwnd, WM_USER + 100, (WPARAM)params, (LPARAM)scriptdata);
 					return S_OK;
 				}).Get());
 	return DW_ERROR_NONE;