Changeset 164450 in webkit
- Timestamp:
- Feb 20, 2014 3:04:31 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r164438 r164450 1 2014-02-20 Anders Carlsson <andersca@apple.com> 2 3 Make it possible to reply asynchronously to JavaScript panels and alerts 4 https://bugs.webkit.org/show_bug.cgi?id=129116 5 6 Reviewed by Dan Bernstein. 7 8 * Scripts/webkit2/LegacyMessageReceiver-expected.cpp: 9 (Messages::WebPage::GetPluginProcessConnection::DelayedReply::send): 10 (Messages::WebPage::TestMultipleAttributes::DelayedReply::send): 11 * Scripts/webkit2/MessageReceiver-expected.cpp: 12 (Messages::WebPage::GetPluginProcessConnection::DelayedReply::send): 13 (Messages::WebPage::TestMultipleAttributes::DelayedReply::send): 14 * Scripts/webkit2/messages.py: 15 (generate_message_handler): 16 * UIProcess/API/APIUIClient.h: 17 (API::UIClient::runJavaScriptAlert): 18 (API::UIClient::runJavaScriptConfirm): 19 (API::UIClient::runJavaScriptPrompt): 20 * UIProcess/API/C/WKPage.cpp: 21 (WKPageSetPageUIClient): 22 * UIProcess/WebPageProxy.cpp: 23 (WebKit::WebPageProxy::runJavaScriptAlert): 24 (WebKit::WebPageProxy::runJavaScriptConfirm): 25 (WebKit::WebPageProxy::runJavaScriptPrompt): 26 * UIProcess/WebPageProxy.h: 27 * UIProcess/WebPageProxy.messages.in: 28 1 29 2014-02-20 Enrique Ocaña González <eocanha@igalia.com> 2 30 -
trunk/Source/WebKit2/Scripts/webkit2/LegacyMessageReceiver-expected.cpp
r164171 r164450 75 75 ASSERT(m_encoder); 76 76 *m_encoder << connectionHandle; 77 bool result = m_connection->sendSyncReply(std::move(m_encoder));77 bool _result = m_connection->sendSyncReply(std::move(m_encoder)); 78 78 m_connection = nullptr; 79 return result;79 return _result; 80 80 } 81 81 … … 94 94 { 95 95 ASSERT(m_encoder); 96 bool result = m_connection->sendSyncReply(std::move(m_encoder));96 bool _result = m_connection->sendSyncReply(std::move(m_encoder)); 97 97 m_connection = nullptr; 98 return result;98 return _result; 99 99 } 100 100 -
trunk/Source/WebKit2/Scripts/webkit2/MessageReceiver-expected.cpp
r164171 r164450 75 75 ASSERT(m_encoder); 76 76 *m_encoder << connectionHandle; 77 bool result = m_connection->sendSyncReply(std::move(m_encoder));77 bool _result = m_connection->sendSyncReply(std::move(m_encoder)); 78 78 m_connection = nullptr; 79 return result;79 return _result; 80 80 } 81 81 … … 94 94 { 95 95 ASSERT(m_encoder); 96 bool result = m_connection->sendSyncReply(std::move(m_encoder));96 bool _result = m_connection->sendSyncReply(std::move(m_encoder)); 97 97 m_connection = nullptr; 98 return result;98 return _result; 99 99 } 100 100 -
trunk/Source/WebKit2/Scripts/webkit2/messages.py
r164171 r164450 574 574 result.append(' ASSERT(m_encoder);\n') 575 575 result += [' *m_encoder << %s;\n' % x.name for x in message.reply_parameters] 576 result.append(' bool result = m_connection->sendSyncReply(std::move(m_encoder));\n')576 result.append(' bool _result = m_connection->sendSyncReply(std::move(m_encoder));\n') 577 577 result.append(' m_connection = nullptr;\n') 578 result.append(' return result;\n')578 result.append(' return _result;\n') 579 579 result.append('}\n') 580 580 result.append('\n') -
trunk/Source/WebKit2/UIProcess/API/APIUIClient.h
r164271 r164450 31 31 #include "WebHitTestResult.h" 32 32 #include <WebCore/FloatRect.h> 33 #include <functional> 33 34 #include <wtf/PassRefPtr.h> 34 35 … … 69 70 virtual void unfocus(WebKit::WebPageProxy*) { } 70 71 71 virtual void runJavaScriptAlert(WebKit::WebPageProxy*, const WTF::String&, WebKit::WebFrameProxy* ) {}72 virtual bool runJavaScriptConfirm(WebKit::WebPageProxy*, const WTF::String&, WebKit::WebFrameProxy*) { return false; }73 virtual WTF::String runJavaScriptPrompt(WebKit::WebPageProxy*, const WTF::String&, const WTF::String&, WebKit::WebFrameProxy*) { return WTF::String(); }72 virtual void runJavaScriptAlert(WebKit::WebPageProxy*, const WTF::String&, WebKit::WebFrameProxy*, std::function<void ()> completionHandler) { completionHandler(); } 73 virtual void runJavaScriptConfirm(WebKit::WebPageProxy*, const WTF::String&, WebKit::WebFrameProxy*, std::function<void (bool)> completionHandler) { completionHandler(false); } 74 virtual void runJavaScriptPrompt(WebKit::WebPageProxy*, const WTF::String&, const WTF::String&, WebKit::WebFrameProxy*, std::function<void (const WTF::String&)> completionHandler) { completionHandler(WTF::String()); } 74 75 75 76 virtual void setStatusText(WebKit::WebPageProxy*, const WTF::String&) { } -
trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp
r164410 r164450 1149 1149 } 1150 1150 1151 virtual void runJavaScriptAlert(WebPageProxy* page, const String& message, WebFrameProxy* frame) override 1152 { 1153 if (!m_client.runJavaScriptAlert) 1154 return; 1151 virtual void runJavaScriptAlert(WebPageProxy* page, const String& message, WebFrameProxy* frame, std::function<void ()> completionHandler) override 1152 { 1153 if (!m_client.runJavaScriptAlert) { 1154 completionHandler(); 1155 return; 1156 } 1155 1157 1156 1158 m_client.runJavaScriptAlert(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.base.clientInfo); 1157 1159 } 1158 1160 1159 virtual bool runJavaScriptConfirm(WebPageProxy* page, const String& message, WebFrameProxy* frame) override 1160 { 1161 if (!m_client.runJavaScriptConfirm) 1162 return false; 1163 1164 return m_client.runJavaScriptConfirm(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.base.clientInfo); 1165 } 1166 1167 virtual String runJavaScriptPrompt(WebPageProxy* page, const String& message, const String& defaultValue, WebFrameProxy* frame) override 1168 { 1169 if (!m_client.runJavaScriptPrompt) 1170 return String(); 1171 1172 API::String* string = toImpl(m_client.runJavaScriptPrompt(toAPI(page), toAPI(message.impl()), toAPI(defaultValue.impl()), toAPI(frame), m_client.base.clientInfo)); 1173 if (!string) 1174 return String(); 1175 1176 String result = string->string(); 1177 string->deref(); 1178 1179 return result; 1161 virtual void runJavaScriptConfirm(WebPageProxy* page, const String& message, WebFrameProxy* frame, std::function<void (bool)> completionHandler) override 1162 { 1163 if (!m_client.runJavaScriptConfirm) { 1164 completionHandler(false); 1165 return; 1166 } 1167 1168 bool result = m_client.runJavaScriptConfirm(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.base.clientInfo); 1169 completionHandler(result); 1170 } 1171 1172 virtual void runJavaScriptPrompt(WebPageProxy* page, const String& message, const String& defaultValue, WebFrameProxy* frame, std::function<void (const String&)> completionHandler) override 1173 { 1174 if (!m_client.runJavaScriptPrompt) { 1175 completionHandler(String()); 1176 return; 1177 } 1178 1179 RefPtr<API::String> string = adoptRef(toImpl(m_client.runJavaScriptPrompt(toAPI(page), toAPI(message.impl()), toAPI(defaultValue.impl()), toAPI(frame), m_client.base.clientInfo))); 1180 if (!string) { 1181 completionHandler(String()); 1182 return; 1183 } 1184 1185 completionHandler(string->string()); 1180 1186 } 1181 1187 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r164398 r164450 2643 2643 } 2644 2644 2645 void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message )2645 void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message, RefPtr<Messages::WebPageProxy::RunJavaScriptAlert::DelayedReply> reply) 2646 2646 { 2647 2647 WebFrameProxy* frame = m_process->webFrame(frameID); … … 2651 2651 m_process->responsivenessTimer()->stop(); 2652 2652 2653 m_uiClient->runJavaScriptAlert(this, message, frame );2654 } 2655 2656 void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, bool& result)2653 m_uiClient->runJavaScriptAlert(this, message, frame, [reply]{ reply->send(); }); 2654 } 2655 2656 void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, RefPtr<Messages::WebPageProxy::RunJavaScriptConfirm::DelayedReply> reply) 2657 2657 { 2658 2658 WebFrameProxy* frame = m_process->webFrame(frameID); … … 2662 2662 m_process->responsivenessTimer()->stop(); 2663 2663 2664 result = m_uiClient->runJavaScriptConfirm(this, message, frame);2665 } 2666 2667 void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, const String& defaultValue, String& result)2664 m_uiClient->runJavaScriptConfirm(this, message, frame, [reply](bool result) { reply->send(result); }); 2665 } 2666 2667 void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, const String& defaultValue, RefPtr<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply> reply) 2668 2668 { 2669 2669 WebFrameProxy* frame = m_process->webFrame(frameID); … … 2673 2673 m_process->responsivenessTimer()->stop(); 2674 2674 2675 result = m_uiClient->runJavaScriptPrompt(this, message, defaultValue, frame);2675 m_uiClient->runJavaScriptPrompt(this, message, defaultValue, frame, [reply](const String& result) { reply->send(result); }); 2676 2676 } 2677 2677 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r164409 r164450 957 957 void showPage(); 958 958 void closePage(bool stopResponsivenessTimer); 959 void runJavaScriptAlert(uint64_t frameID, const String& );960 void runJavaScriptConfirm(uint64_t frameID, const String&, bool& result);961 void runJavaScriptPrompt(uint64_t frameID, const String&, const String&, String& result);959 void runJavaScriptAlert(uint64_t frameID, const String&, RefPtr<Messages::WebPageProxy::RunJavaScriptAlert::DelayedReply>); 960 void runJavaScriptConfirm(uint64_t frameID, const String&, RefPtr<Messages::WebPageProxy::RunJavaScriptConfirm::DelayedReply>); 961 void runJavaScriptPrompt(uint64_t frameID, const String&, const String&, RefPtr<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply>); 962 962 void shouldInterruptJavaScript(bool& result); 963 963 void setStatusText(const String&); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r164382 r164450 26 26 ShowPage() 27 27 ClosePage(bool stopResponsivenessTimer) 28 RunJavaScriptAlert(uint64_t frameID, String message) -> () 29 RunJavaScriptConfirm(uint64_t frameID, String message) -> (bool result) 30 RunJavaScriptPrompt(uint64_t frameID, String message, String defaultValue) -> (String result) 28 RunJavaScriptAlert(uint64_t frameID, String message) -> () Delayed 29 RunJavaScriptConfirm(uint64_t frameID, String message) -> (bool result) Delayed 30 RunJavaScriptPrompt(uint64_t frameID, String message, String defaultValue) -> (String result) Delayed 31 31 ShouldInterruptJavaScript() -> (bool shouldInterupt) 32 32 MouseDidMoveOverElement(WebKit::WebHitTestResult::Data hitTestResultData, uint32_t modifiers, WebKit::InjectedBundleUserMessageEncoder userData) Variadic
Note: See TracChangeset
for help on using the changeset viewer.