Changeset 233576 in webkit
- Timestamp:
- Jul 6, 2018, 3:51:33 AM (8 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
TestWebKitAPI/Tests/WebKitGLib/TestWebKitUserContentManager.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r233563 r233576 1 2018-07-06 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][WPE] REGRESSION(r233111): Test /webkit/WebKitUserContentManager/script-message-received fails 4 https://bugs.webkit.org/show_bug.cgi?id=187383 5 6 Reviewed by Žan Doberšek. 7 8 This is actually a problem in the test itself. The problem is that we run js, connect to message-received and 9 quite the main loop when the message is received, which happens before the run js operation has been 10 completed. The test finishes early and since r233111 an IPC message is still pending (I guess the run js 11 callback) and the web page is still protected. Just adding a run loop operation before finishing the test would 12 fix it. We should wait for the js run to complete, instead of the message. 13 14 * TestWebKitAPI/Tests/WebKitGLib/TestWebKitUserContentManager.cpp: 15 (UserScriptMessageTest::scriptMessageReceived): 16 (UserScriptMessageTest::waitUntilMessageReceived): 17 (UserScriptMessageTest::runJavaScriptFinished): 18 (UserScriptMessageTest::postMessageAndWaitUntilReceived): 19 1 20 2018-07-05 Youenn Fablet <youenn@apple.com> 2 21 -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitUserContentManager.cpp
r225044 r233576 223 223 { 224 224 g_signal_handlers_disconnect_by_func(userContentManager, reinterpret_cast<gpointer>(scriptMessageReceived), test); 225 g_main_loop_quit(test->m_mainLoop); 225 if (!test->m_waitForScriptRun) 226 g_main_loop_quit(test->m_mainLoop); 226 227 227 228 g_assert(!test->m_userScriptMessage); … … 240 241 241 242 g_main_loop_run(m_mainLoop); 243 g_assert(!m_waitForScriptRun); 242 244 g_assert(m_userScriptMessage); 243 245 return m_userScriptMessage; 244 246 } 245 247 248 static void runJavaScriptFinished(GObject*, GAsyncResult* result, UserScriptMessageTest* test) 249 { 250 g_assert(test->m_waitForScriptRun); 251 test->m_waitForScriptRun = false; 252 g_main_loop_quit(test->m_mainLoop); 253 } 254 246 255 WebKitJavascriptResult* postMessageAndWaitUntilReceived(const char* handlerName, const char* javascriptValueAsText) 247 256 { 248 257 GUniquePtr<char> javascriptSnippet(g_strdup_printf("window.webkit.messageHandlers.%s.postMessage(%s);", handlerName, javascriptValueAsText)); 249 webkit_web_view_run_javascript(m_webView, javascriptSnippet.get(), nullptr, nullptr, nullptr); 258 m_waitForScriptRun = true; 259 webkit_web_view_run_javascript(m_webView, javascriptSnippet.get(), nullptr, reinterpret_cast<GAsyncReadyCallback>(runJavaScriptFinished), this); 250 260 return waitUntilMessageReceived(handlerName); 251 261 } … … 253 263 private: 254 264 WebKitJavascriptResult* m_userScriptMessage; 265 bool m_waitForScriptRun { false }; 255 266 }; 256 267
Note:
See TracChangeset
for help on using the changeset viewer.