comparison 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
comparison
equal deleted inserted replaced
2044:b74b9afa31aa 2045:cb195d76de8e
95 IWebView2Settings* Settings; 95 IWebView2Settings* Settings;
96 webview->get_Settings(&Settings); 96 webview->get_Settings(&Settings);
97 Settings->put_IsScriptEnabled(TRUE); 97 Settings->put_IsScriptEnabled(TRUE);
98 Settings->put_AreDefaultScriptDialogsEnabled(TRUE); 98 Settings->put_AreDefaultScriptDialogsEnabled(TRUE);
99 Settings->put_IsWebMessageEnabled(TRUE); 99 Settings->put_IsWebMessageEnabled(TRUE);
100 #ifndef DEBUG
101 Settings->put_AreDevToolsEnabled(FALSE);
102 #endif
100 103
101 // Resize WebView to fit the bounds of the parent window 104 // Resize WebView to fit the bounds of the parent window
102 WebView->DoSize(); 105 WebView->DoSize();
103 106
104 // Save the token, we might need to dw_window_set_data() this value 107 // Save the token, we might need to dw_window_set_data() this value
288 if (WebView) 291 if (WebView)
289 WebView->ExecuteScript(UTF8toWide(script), 292 WebView->ExecuteScript(UTF8toWide(script),
290 Callback<IWebView2ExecuteScriptCompletedHandler>( 293 Callback<IWebView2ExecuteScriptCompletedHandler>(
291 [thishwnd, scriptdata](HRESULT error, PCWSTR result) -> HRESULT 294 [thishwnd, scriptdata](HRESULT error, PCWSTR result) -> HRESULT
292 { 295 {
293 _wndproc(thishwnd, WM_USER + 100, (error == S_OK ? (WPARAM)WideToUTF8((LPWSTR)result) : NULL), (LPARAM)scriptdata); 296 if (result && _wcsicmp(result, L"null") == 0)
297 result = NULL;
298 void *params[2] = { (void *)(result ? WideToUTF8((LPWSTR)result) : NULL), DW_INT_TO_POINTER((error == S_OK ? DW_ERROR_NONE : DW_ERROR_UNKNOWN)) };
299 _wndproc(thishwnd, WM_USER + 100, (WPARAM)params, (LPARAM)scriptdata);
294 return S_OK; 300 return S_OK;
295 }).Get()); 301 }).Get());
296 return DW_ERROR_NONE; 302 return DW_ERROR_NONE;
297 } 303 }
298 304