<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[169023] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/169023">169023</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2014-05-18 16:12:37 -0700 (Sun, 18 May 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[WebKit2] Implement ScriptMessageHandlers
https://bugs.webkit.org/show_bug.cgi?id=133053
Reviewed by Anders Carlsson.
* DerivedSources.make:
../WebCore:
* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::finishCreation):
* bindings/js/JSUserMessageHandlersNamespaceCustom.cpp: Added.
(WebCore::JSUserMessageHandlersNamespace::getOwnPropertySlotDelegate):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::shouldHaveWebKitNamespaceForWorld):
(WebCore::DOMWindow::webkitNamespace):
* page/DOMWindow.h:
* page/UserContentController.cpp:
(WebCore::UserContentController::addUserMessageHandlerDescriptor):
(WebCore::UserContentController::removeUserMessageHandlerDescriptor):
* page/UserContentController.h:
(WebCore::UserContentController::userMessageHandlerDescriptors):
* page/UserMessageHandler.cpp: Added.
(WebCore::UserMessageHandler::UserMessageHandler):
(WebCore::UserMessageHandler::~UserMessageHandler):
(WebCore::UserMessageHandler::postMessage):
(WebCore::UserMessageHandler::name):
(WebCore::UserMessageHandler::world):
* page/UserMessageHandler.h: Added.
(WebCore::UserMessageHandler::create):
* page/UserMessageHandler.idl: Added.
* page/UserMessageHandlerDescriptor.cpp: Added.
(WebCore::UserMessageHandlerDescriptor::UserMessageHandlerDescriptor):
(WebCore::UserMessageHandlerDescriptor::~UserMessageHandlerDescriptor):
(WebCore::UserMessageHandlerDescriptor::name):
(WebCore::UserMessageHandlerDescriptor::world):
* page/UserMessageHandlerDescriptor.h: Added.
(WebCore::UserMessageHandlerDescriptor::Client::~Client):
(WebCore::UserMessageHandlerDescriptor::create):
(WebCore::UserMessageHandlerDescriptor::client):
* page/UserMessageHandlerDescriptorTypes.h: Added.
* page/UserMessageHandlersNamespace.cpp: Added.
(WebCore::UserMessageHandlersNamespace::UserMessageHandlersNamespace):
(WebCore::UserMessageHandlersNamespace::~UserMessageHandlersNamespace):
(WebCore::UserMessageHandlersNamespace::handler):
* page/UserMessageHandlersNamespace.h: Added.
(WebCore::UserMessageHandlersNamespace::create):
* page/UserMessageHandlersNamespace.idl: Added.
* page/WebKitNamespace.cpp: Added.
(WebCore::WebKitNamespace::WebKitNamespace):
(WebCore::WebKitNamespace::~WebKitNamespace):
(WebCore::WebKitNamespace::messageHandlers):
* page/WebKitNamespace.h: Added.
(WebCore::WebKitNamespace::create):
* page/WebKitNamespace.idl: Added.
../WebKit2:
* Scripts/webkit2/messages.py:
(struct_or_class):
(argument_coder_headers_for_type):
(headers_for_type):
* UIProcess/API/Cocoa/WKScriptMessage.mm:
(-[WKScriptMessage _initWithBody:webView:name:]):
(-[WKScriptMessage body]):
(-[WKScriptMessage webView]):
(-[WKScriptMessage name]):
(-[WKScriptMessage _scriptWorld]): Deleted.
* UIProcess/API/Cocoa/WKScriptMessageInternal.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessagePrivate.h.
* UIProcess/API/Cocoa/WKScriptMessagePrivate.h: Removed.
* UIProcess/API/Cocoa/WKUserContentController.mm:
(-[WKUserContentController addScriptMessageHandler:name:]):
(-[WKUserContentController removeScriptMessageHandlerForName:]):
(-[WKUserContentController _addScriptMessageHandler:name:world:]): Deleted.
(-[WKUserContentController _removeScriptMessageHandlerForName:world:]): Deleted.
* UIProcess/API/Cocoa/WKUserContentControllerInternal.h:
* UIProcess/API/Cocoa/WKUserContentControllerPrivate.h: Removed.
* UIProcess/API/Cocoa/WKWebView.mm:
(pageToViewMap):
(fromWebPageProxy):
(-[WKWebView initWithFrame:configuration:]):
(-[WKWebView dealloc]):
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/UserContent/WebScriptMessageHandler.cpp: Added.
(WebKit::WebScriptMessageHandlerHandle::encode):
(WebKit::WebScriptMessageHandlerHandle::decode):
(WebKit::generateIdentifier):
(WebKit::WebScriptMessageHandler::create):
(WebKit::WebScriptMessageHandler::WebScriptMessageHandler):
(WebKit::WebScriptMessageHandler::~WebScriptMessageHandler):
* UIProcess/UserContent/WebScriptMessageHandler.h: Added.
(WebKit::WebScriptMessageHandler::Client::~Client):
(WebKit::WebScriptMessageHandler::handle):
(WebKit::WebScriptMessageHandler::identifier):
(WebKit::WebScriptMessageHandler::name):
(WebKit::WebScriptMessageHandler::client):
* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::addProcess):
(WebKit::WebUserContentControllerProxy::removeProcess):
(WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
(WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
(WebKit::WebUserContentControllerProxy::didPostMessage):
* UIProcess/UserContent/WebUserContentControllerProxy.h:
* UIProcess/UserContent/WebUserContentControllerProxy.messages.in: Added.
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/UserContent/WebUserContentController.cpp:
(WebKit::WebUserMessageHandlerDescriptorProxy::create):
(WebKit::WebUserMessageHandlerDescriptorProxy::~WebUserMessageHandlerDescriptorProxy):
(WebKit::WebUserMessageHandlerDescriptorProxy::didPostMessage):
(WebKit::WebUserMessageHandlerDescriptorProxy::descriptor):
(WebKit::WebUserMessageHandlerDescriptorProxy::identifier):
(WebKit::WebUserMessageHandlerDescriptorProxy::WebUserMessageHandlerDescriptorProxy):
(WebKit::WebUserContentController::addUserScriptMessageHandlers):
(WebKit::WebUserContentController::removeUserScriptMessageHandler):
* WebProcess/UserContent/WebUserContentController.h:
* WebProcess/UserContent/WebUserContentController.messages.in:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFwtfPlatformh">trunk/Source/WTF/wtf/Platform.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcesmake">trunk/Source/WebCore/DerivedSources.make</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMWindowBasecpp">trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowcpp">trunk/Source/WebCore/page/DOMWindow.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowh">trunk/Source/WebCore/page/DOMWindow.h</a></li>
<li><a href="#trunkSourceWebCorepageUserContentControllercpp">trunk/Source/WebCore/page/UserContentController.cpp</a></li>
<li><a href="#trunkSourceWebCorepageUserContentControllerh">trunk/Source/WebCore/page/UserContentController.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2DerivedSourcesmake">trunk/Source/WebKit2/DerivedSources.make</a></li>
<li><a href="#trunkSourceWebKit2Scriptswebkit2messagespy">trunk/Source/WebKit2/Scripts/webkit2/messages.py</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKScriptMessagemm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessage.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKUserContentControllermm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKUserContentControllerInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxycpp">trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxyh">trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessUserContentWebUserContentControllercpp">trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessUserContentWebUserContentControllerh">trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessUserContentWebUserContentControllermessagesin">trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorebindingsjsJSUserMessageHandlersNamespaceCustomcpp">trunk/Source/WebCore/bindings/js/JSUserMessageHandlersNamespaceCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorepageUserMessageHandlercpp">trunk/Source/WebCore/page/UserMessageHandler.cpp</a></li>
<li><a href="#trunkSourceWebCorepageUserMessageHandlerh">trunk/Source/WebCore/page/UserMessageHandler.h</a></li>
<li><a href="#trunkSourceWebCorepageUserMessageHandleridl">trunk/Source/WebCore/page/UserMessageHandler.idl</a></li>
<li><a href="#trunkSourceWebCorepageUserMessageHandlerDescriptorcpp">trunk/Source/WebCore/page/UserMessageHandlerDescriptor.cpp</a></li>
<li><a href="#trunkSourceWebCorepageUserMessageHandlerDescriptorh">trunk/Source/WebCore/page/UserMessageHandlerDescriptor.h</a></li>
<li><a href="#trunkSourceWebCorepageUserMessageHandlerDescriptorTypesh">trunk/Source/WebCore/page/UserMessageHandlerDescriptorTypes.h</a></li>
<li><a href="#trunkSourceWebCorepageUserMessageHandlersNamespacecpp">trunk/Source/WebCore/page/UserMessageHandlersNamespace.cpp</a></li>
<li><a href="#trunkSourceWebCorepageUserMessageHandlersNamespaceh">trunk/Source/WebCore/page/UserMessageHandlersNamespace.h</a></li>
<li><a href="#trunkSourceWebCorepageUserMessageHandlersNamespaceidl">trunk/Source/WebCore/page/UserMessageHandlersNamespace.idl</a></li>
<li><a href="#trunkSourceWebCorepageWebKitNamespacecpp">trunk/Source/WebCore/page/WebKitNamespace.cpp</a></li>
<li><a href="#trunkSourceWebCorepageWebKitNamespaceh">trunk/Source/WebCore/page/WebKitNamespace.h</a></li>
<li><a href="#trunkSourceWebCorepageWebKitNamespaceidl">trunk/Source/WebCore/page/WebKitNamespace.idl</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKScriptMessageInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessageInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessUserContentWebScriptMessageHandlercpp">trunk/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessUserContentWebScriptMessageHandlerh">trunk/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxymessagesin">trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.messages.in</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKScriptMessagePrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessagePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKUserContentControllerPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerPrivate.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFwtfPlatformh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Platform.h (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Platform.h        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WTF/wtf/Platform.h        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -465,6 +465,7 @@
</span><span class="cx">
</span><span class="cx"> #define WTF_USE_CF 1
</span><span class="cx"> #define WTF_USE_FOUNDATION 1
</span><ins>+#define ENABLE_USER_MESSAGE_HANDLERS 1
</ins><span class="cx">
</span><span class="cx"> #endif
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebCore/ChangeLog        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -1,3 +1,60 @@
</span><ins>+2014-05-18 Sam Weinig <sam@webkit.org>
+
+ [WebKit2] Implement ScriptMessageHandlers
+ https://bugs.webkit.org/show_bug.cgi?id=133053
+
+ Reviewed by Anders Carlsson.
+
+ * DerivedSources.make:
+ * WebCore.exp.in:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSDOMWindowBase.cpp:
+ (WebCore::JSDOMWindowBase::finishCreation):
+ * bindings/js/JSUserMessageHandlersNamespaceCustom.cpp: Added.
+ (WebCore::JSUserMessageHandlersNamespace::getOwnPropertySlotDelegate):
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::shouldHaveWebKitNamespaceForWorld):
+ (WebCore::DOMWindow::webkitNamespace):
+ * page/DOMWindow.h:
+ * page/UserContentController.cpp:
+ (WebCore::UserContentController::addUserMessageHandlerDescriptor):
+ (WebCore::UserContentController::removeUserMessageHandlerDescriptor):
+ * page/UserContentController.h:
+ (WebCore::UserContentController::userMessageHandlerDescriptors):
+ * page/UserMessageHandler.cpp: Added.
+ (WebCore::UserMessageHandler::UserMessageHandler):
+ (WebCore::UserMessageHandler::~UserMessageHandler):
+ (WebCore::UserMessageHandler::postMessage):
+ (WebCore::UserMessageHandler::name):
+ (WebCore::UserMessageHandler::world):
+ * page/UserMessageHandler.h: Added.
+ (WebCore::UserMessageHandler::create):
+ * page/UserMessageHandler.idl: Added.
+ * page/UserMessageHandlerDescriptor.cpp: Added.
+ (WebCore::UserMessageHandlerDescriptor::UserMessageHandlerDescriptor):
+ (WebCore::UserMessageHandlerDescriptor::~UserMessageHandlerDescriptor):
+ (WebCore::UserMessageHandlerDescriptor::name):
+ (WebCore::UserMessageHandlerDescriptor::world):
+ * page/UserMessageHandlerDescriptor.h: Added.
+ (WebCore::UserMessageHandlerDescriptor::Client::~Client):
+ (WebCore::UserMessageHandlerDescriptor::create):
+ (WebCore::UserMessageHandlerDescriptor::client):
+ * page/UserMessageHandlerDescriptorTypes.h: Added.
+ * page/UserMessageHandlersNamespace.cpp: Added.
+ (WebCore::UserMessageHandlersNamespace::UserMessageHandlersNamespace):
+ (WebCore::UserMessageHandlersNamespace::~UserMessageHandlersNamespace):
+ (WebCore::UserMessageHandlersNamespace::handler):
+ * page/UserMessageHandlersNamespace.h: Added.
+ (WebCore::UserMessageHandlersNamespace::create):
+ * page/UserMessageHandlersNamespace.idl: Added.
+ * page/WebKitNamespace.cpp: Added.
+ (WebCore::WebKitNamespace::WebKitNamespace):
+ (WebCore::WebKitNamespace::~WebKitNamespace):
+ (WebCore::WebKitNamespace::messageHandlers):
+ * page/WebKitNamespace.h: Added.
+ (WebCore::WebKitNamespace::create):
+ * page/WebKitNamespace.idl: Added.
+
</ins><span class="cx"> 2014-05-18 Maciej Stachowiak <mjs@apple.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION (r156546): Default media controls are laid out incorrectly when media element is styled with direction:rtl
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources.make (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources.make        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebCore/DerivedSources.make        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -480,6 +480,9 @@
</span><span class="cx"> $(WebCore)/page/SpeechInputResult.idl \
</span><span class="cx"> $(WebCore)/page/SpeechInputResultList.idl \
</span><span class="cx"> $(WebCore)/page/WebKitPoint.idl \
</span><ins>+ $(WebCore)/page/WebKitNamespace.idl \
+ $(WebCore)/page/UserMessageHandlersNamespace.idl \
+ $(WebCore)/page/UserMessageHandler.idl \
</ins><span class="cx"> $(WebCore)/page/WindowBase64.idl \
</span><span class="cx"> $(WebCore)/page/WindowTimers.idl \
</span><span class="cx"> $(WebCore)/page/WorkerNavigator.idl \
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -901,6 +901,8 @@
</span><span class="cx"> __ZN7WebCore21URLByRemovingUserInfoEP5NSURL
</span><span class="cx"> __ZN7WebCore21UserContentController13addUserScriptERNS_15DOMWrapperWorldENSt3__110unique_ptrINS_10UserScriptENS3_14default_deleteIS5_EEEE
</span><span class="cx"> __ZN7WebCore21UserContentController17removeUserScriptsERNS_15DOMWrapperWorldE
</span><ins>+__ZN7WebCore21UserContentController31addUserMessageHandlerDescriptorERNS_28UserMessageHandlerDescriptorE
+__ZN7WebCore21UserContentController34removeUserMessageHandlerDescriptorERNS_28UserMessageHandlerDescriptorE
</ins><span class="cx"> __ZN7WebCore21UserContentController6createEv
</span><span class="cx"> __ZN7WebCore21UserContentControllerD1Ev
</span><span class="cx"> __ZN7WebCore21UserContentURLPattern5parseERKN3WTF6StringE
</span><span class="lines">@@ -1011,6 +1013,8 @@
</span><span class="cx"> __ZN7WebCore27startObservingCookieChangesEPFvvE
</span><span class="cx"> __ZN7WebCore28DocumentStyleSheetCollection12addUserSheetEN3WTF7PassRefINS_18StyleSheetContentsEEE
</span><span class="cx"> __ZN7WebCore28DocumentStyleSheetCollection14addAuthorSheetEN3WTF7PassRefINS_18StyleSheetContentsEEE
</span><ins>+__ZN7WebCore28UserMessageHandlerDescriptorC1ERKN3WTF12AtomicStringERNS_15DOMWrapperWorldERNS0_6ClientE
+__ZN7WebCore28UserMessageHandlerDescriptorD1Ev
</ins><span class="cx"> __ZN7WebCore28encodeWithURLEscapeSequencesERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore28removeLanguageChangeObserverEPv
</span><span class="cx"> __ZN7WebCore29cookieRequestHeaderFieldValueERKNS_21NetworkStorageSessionERKNS_3URLES5_
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -2339,12 +2339,23 @@
</span><span class="cx">                 7BE7427381FA906FBB4F0F2C /* JSSVGGraphicsElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 950C4C02BED8936F818E2F99 /* JSSVGGraphicsElement.h */; };
</span><span class="cx">                 7C2BDD3D17C7F98C0038FF15 /* JSDOMGlobalObjectTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C2BDD3B17C7F98B0038FF15 /* JSDOMGlobalObjectTask.cpp */; };
</span><span class="cx">                 7C2BDD3E17C7F98C0038FF15 /* JSDOMGlobalObjectTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C2BDD3C17C7F98B0038FF15 /* JSDOMGlobalObjectTask.h */; };
</span><ins>+                7C3B79711908757B00B47A2D /* UserMessageHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3B796F1908757B00B47A2D /* UserMessageHandler.cpp */; };
+                7C3B79721908757B00B47A2D /* UserMessageHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3B79701908757B00B47A2D /* UserMessageHandler.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 7C3E510A18DF8F3500C112F7 /* HTMLConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3E510818DF8F3500C112F7 /* HTMLConverter.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 7C3E510B18DF8F3500C112F7 /* HTMLConverter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C3E510918DF8F3500C112F7 /* HTMLConverter.mm */; };
</span><ins>+                7C48A6D0191C9D6500026674 /* WebKitNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C48A6CE191C9D6500026674 /* WebKitNamespace.cpp */; };
+                7C48A6D1191C9D6500026674 /* WebKitNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C48A6CF191C9D6500026674 /* WebKitNamespace.h */; };
</ins><span class="cx">                 7C4902A218B825F8007D9298 /* DOMWheelEventInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85989DCA0ACC8BBD00A0BC51 /* DOMWheelEventInternal.h */; };
</span><span class="cx">                 7C522D4B15B477E8009B7C95 /* InspectorOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C522D4915B477E8009B7C95 /* InspectorOverlay.cpp */; };
</span><span class="cx">                 7C5343FC17B74B63004232F0 /* JSMediaQueryListListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C5343FA17B74B63004232F0 /* JSMediaQueryListListener.cpp */; };
</span><span class="cx">                 7C5343FD17B74B63004232F0 /* JSMediaQueryListListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C5343FB17B74B63004232F0 /* JSMediaQueryListListener.h */; };
</span><ins>+                7C73FB07191EF417007DE061 /* UserMessageHandlersNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C73FB05191EF416007DE061 /* UserMessageHandlersNamespace.cpp */; };
+                7C73FB08191EF417007DE061 /* UserMessageHandlersNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C73FB06191EF417007DE061 /* UserMessageHandlersNamespace.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                7C73FB0C191EF5A8007DE061 /* JSUserMessageHandlersNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C73FB0A191EF5A8007DE061 /* JSUserMessageHandlersNamespace.cpp */; };
+                7C73FB0D191EF5A8007DE061 /* JSUserMessageHandlersNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C73FB0B191EF5A8007DE061 /* JSUserMessageHandlersNamespace.h */; };
+                7C73FB11191EF6F4007DE061 /* JSUserMessageHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C73FB0F191EF6F4007DE061 /* JSUserMessageHandler.cpp */; };
+                7C73FB12191EF6F4007DE061 /* JSUserMessageHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C73FB10191EF6F4007DE061 /* JSUserMessageHandler.h */; };
+                7C73FB19191EF808007DE061 /* JSUserMessageHandlersNamespaceCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C73FB17191EF808007DE061 /* JSUserMessageHandlersNamespaceCustom.cpp */; };
</ins><span class="cx">                 7C74D43318823A9300E5ED57 /* UTextProviderLatin1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C74D43118823A9300E5ED57 /* UTextProviderLatin1.cpp */; };
</span><span class="cx">                 7C74D43418823A9300E5ED57 /* UTextProviderLatin1.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C74D43218823A9300E5ED57 /* UTextProviderLatin1.h */; };
</span><span class="cx">                 7C74D43718823B1900E5ED57 /* UTextProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C74D43518823B1900E5ED57 /* UTextProvider.cpp */; };
</span><span class="lines">@@ -2353,7 +2364,12 @@
</span><span class="cx">                 7C74D43C1882400400E5ED57 /* UTextProviderUTF16.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */; };
</span><span class="cx">                 7CC564B818BABEA6001B9652 /* TelephoneNumberDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC564B618BABEA6001B9652 /* TelephoneNumberDetector.h */; };
</span><span class="cx">                 7CC564BA18BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CC564B918BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp */; };
</span><ins>+                7CC69940191EC5F500AF2270 /* JSWebKitNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */; };
+                7CC69941191EC5F500AF2270 /* JSWebKitNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC6993F191EC5F500AF2270 /* JSWebKitNamespace.h */; };
</ins><span class="cx">                 7CC7E3D717208C0F003C5277 /* IDNScriptWhiteList.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */; };
</span><ins>+                7CE68344192143A800F4D928 /* UserMessageHandlerDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE68342192143A800F4D928 /* UserMessageHandlerDescriptor.cpp */; };
+                7CE68345192143A800F4D928 /* UserMessageHandlerDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE68343192143A800F4D928 /* UserMessageHandlerDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                7CE683471921821500F4D928 /* UserMessageHandlerDescriptorTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE683461921821500F4D928 /* UserMessageHandlerDescriptorTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 7CE6CBFB187F370700D46BF5 /* FormatConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE6CBFA187F370700D46BF5 /* FormatConverter.h */; };
</span><span class="cx">                 7CE6CBFD187F394900D46BF5 /* FormatConverter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE6CBFC187F394900D46BF5 /* FormatConverter.cpp */; };
</span><span class="cx">                 7D741BDA177226AA00859170 /* CSSValueKeywords.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 6565814809D13043000E61D7 /* CSSValueKeywords.h */; };
</span><span class="lines">@@ -9401,8 +9417,13 @@
</span><span class="cx">                 7AF9B20B18CFB5F300C64BEF /* JSVTTRegionList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVTTRegionList.h; sourceTree = "<group>"; };
</span><span class="cx">                 7C2BDD3B17C7F98B0038FF15 /* JSDOMGlobalObjectTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMGlobalObjectTask.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 7C2BDD3C17C7F98B0038FF15 /* JSDOMGlobalObjectTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMGlobalObjectTask.h; sourceTree = "<group>"; };
</span><ins>+                7C3B796F1908757B00B47A2D /* UserMessageHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMessageHandler.cpp; sourceTree = "<group>"; };
+                7C3B79701908757B00B47A2D /* UserMessageHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMessageHandler.h; sourceTree = "<group>"; };
</ins><span class="cx">                 7C3E510818DF8F3500C112F7 /* HTMLConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLConverter.h; sourceTree = "<group>"; };
</span><span class="cx">                 7C3E510918DF8F3500C112F7 /* HTMLConverter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HTMLConverter.mm; sourceTree = "<group>"; };
</span><ins>+                7C48A6CE191C9D6500026674 /* WebKitNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitNamespace.cpp; sourceTree = "<group>"; };
+                7C48A6CF191C9D6500026674 /* WebKitNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitNamespace.h; sourceTree = "<group>"; };
+                7C48A6D2191C9D8E00026674 /* WebKitNamespace.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebKitNamespace.idl; sourceTree = "<group>"; };
</ins><span class="cx">                 7C522D4915B477E8009B7C95 /* InspectorOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorOverlay.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 7C522D4A15B478B2009B7C95 /* InspectorOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorOverlay.h; sourceTree = "<group>"; };
</span><span class="cx">                 7C5343FA17B74B63004232F0 /* JSMediaQueryListListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaQueryListListener.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -9412,6 +9433,15 @@
</span><span class="cx">                 7C6136F71710C35200FF4A57 /* InFilesCompiler.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = InFilesCompiler.pm; path = scripts/InFilesCompiler.pm; sourceTree = "<group>"; };
</span><span class="cx">                 7C6136F81710C35200FF4A57 /* InFilesParser.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = InFilesParser.pm; path = scripts/InFilesParser.pm; sourceTree = "<group>"; };
</span><span class="cx">                 7C6136F91710C35200FF4A57 /* StaticString.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = StaticString.pm; path = scripts/StaticString.pm; sourceTree = "<group>"; };
</span><ins>+                7C73FB05191EF416007DE061 /* UserMessageHandlersNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMessageHandlersNamespace.cpp; sourceTree = "<group>"; };
+                7C73FB06191EF417007DE061 /* UserMessageHandlersNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMessageHandlersNamespace.h; sourceTree = "<group>"; };
+                7C73FB09191EF49F007DE061 /* UserMessageHandlersNamespace.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = UserMessageHandlersNamespace.idl; sourceTree = "<group>"; };
+                7C73FB0A191EF5A8007DE061 /* JSUserMessageHandlersNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUserMessageHandlersNamespace.cpp; sourceTree = "<group>"; };
+                7C73FB0B191EF5A8007DE061 /* JSUserMessageHandlersNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSUserMessageHandlersNamespace.h; sourceTree = "<group>"; };
+                7C73FB0E191EF60E007DE061 /* UserMessageHandler.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = UserMessageHandler.idl; sourceTree = "<group>"; };
+                7C73FB0F191EF6F4007DE061 /* JSUserMessageHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUserMessageHandler.cpp; sourceTree = "<group>"; };
+                7C73FB10191EF6F4007DE061 /* JSUserMessageHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSUserMessageHandler.h; sourceTree = "<group>"; };
+                7C73FB17191EF808007DE061 /* JSUserMessageHandlersNamespaceCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUserMessageHandlersNamespaceCustom.cpp; sourceTree = "<group>"; };
</ins><span class="cx">                 7C74D43118823A9300E5ED57 /* UTextProviderLatin1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProviderLatin1.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 7C74D43218823A9300E5ED57 /* UTextProviderLatin1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderLatin1.h; sourceTree = "<group>"; };
</span><span class="cx">                 7C74D43518823B1900E5ED57 /* UTextProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProvider.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -9420,7 +9450,12 @@
</span><span class="cx">                 7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderUTF16.h; sourceTree = "<group>"; };
</span><span class="cx">                 7CC564B618BABEA6001B9652 /* TelephoneNumberDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TelephoneNumberDetector.h; sourceTree = "<group>"; };
</span><span class="cx">                 7CC564B918BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TelephoneNumberDetectorCocoa.cpp; sourceTree = "<group>"; };
</span><ins>+                7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitNamespace.cpp; sourceTree = "<group>"; };
+                7CC6993F191EC5F500AF2270 /* JSWebKitNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitNamespace.h; sourceTree = "<group>"; };
</ins><span class="cx">                 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDNScriptWhiteList.txt; sourceTree = "<group>"; };
</span><ins>+                7CE68342192143A800F4D928 /* UserMessageHandlerDescriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMessageHandlerDescriptor.cpp; sourceTree = "<group>"; };
+                7CE68343192143A800F4D928 /* UserMessageHandlerDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMessageHandlerDescriptor.h; sourceTree = "<group>"; };
+                7CE683461921821500F4D928 /* UserMessageHandlerDescriptorTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMessageHandlerDescriptorTypes.h; sourceTree = "<group>"; };
</ins><span class="cx">                 7CE6CBFA187F370700D46BF5 /* FormatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormatConverter.h; sourceTree = "<group>"; };
</span><span class="cx">                 7CE6CBFC187F394900D46BF5 /* FormatConverter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormatConverter.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 7E33CD00127F340D00BE8F17 /* PurgePriority.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurgePriority.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -16473,6 +16508,18 @@
</span><span class="cx">                                 E1271A130EEEC80400F61213 /* WorkerNavigator.cpp */,
</span><span class="cx">                                 E1271A0A0EEEC77A00F61213 /* WorkerNavigator.h */,
</span><span class="cx">                                 E1271A510EEECD1C00F61213 /* WorkerNavigator.idl */,
</span><ins>+                                7C48A6CE191C9D6500026674 /* WebKitNamespace.cpp */,
+                                7C48A6CF191C9D6500026674 /* WebKitNamespace.h */,
+                                7C48A6D2191C9D8E00026674 /* WebKitNamespace.idl */,
+                                7C73FB05191EF416007DE061 /* UserMessageHandlersNamespace.cpp */,
+                                7C73FB06191EF417007DE061 /* UserMessageHandlersNamespace.h */,
+                                7C73FB09191EF49F007DE061 /* UserMessageHandlersNamespace.idl */,
+                                7C3B796F1908757B00B47A2D /* UserMessageHandler.cpp */,
+                                7C3B79701908757B00B47A2D /* UserMessageHandler.h */,
+                                7C73FB0E191EF60E007DE061 /* UserMessageHandler.idl */,
+                                7CE68342192143A800F4D928 /* UserMessageHandlerDescriptor.cpp */,
+                                7CE68343192143A800F4D928 /* UserMessageHandlerDescriptor.h */,
+                                7CE683461921821500F4D928 /* UserMessageHandlerDescriptorTypes.h */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = page;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -20589,7 +20636,6 @@
</span><span class="cx">                 BC4EDEF70C08F414007EDD49 /* Custom */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                07FBDE2B18FED178001A7CFF /* JSDataCueCustom.cpp */,
</del><span class="cx">                                 BC2ED6BB0C6BD2F000920BFF /* JSAttrCustom.cpp */,
</span><span class="cx">                                 FDEAAAEF12B02EE400DCF33B /* JSAudioBufferSourceNodeCustom.cpp */,
</span><span class="cx">                                 FDEAAAF012B02EE400DCF33B /* JSAudioContextCustom.cpp */,
</span><span class="lines">@@ -20610,6 +20656,7 @@
</span><span class="cx">                                 BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */,
</span><span class="cx">                                 AD726FEA16D9F40B003A4E6D /* JSCSSStyleDeclarationCustom.h */,
</span><span class="cx">                                 BC20FB7E0C0E8E6C00D1447F /* JSCSSValueCustom.cpp */,
</span><ins>+                                07FBDE2B18FED178001A7CFF /* JSDataCueCustom.cpp */,
</ins><span class="cx">                                 BCA83E510D7CE205003421A8 /* JSDataTransferCustom.cpp */,
</span><span class="cx">                                 4162A453101145E300DFF3ED /* JSDedicatedWorkerGlobalScopeCustom.cpp */,
</span><span class="cx">                                 31FB1A6B120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp */,
</span><span class="lines">@@ -20697,6 +20744,7 @@
</span><span class="cx">                                 07846384145B1B8E00A58DF1 /* JSTrackCustom.h */,
</span><span class="cx">                                 07B5A30A14687B8400A81ECE /* JSTrackEventCustom.cpp */,
</span><span class="cx">                                 516BB7920CE91E6800512F79 /* JSTreeWalkerCustom.cpp */,
</span><ins>+                                7C73FB17191EF808007DE061 /* JSUserMessageHandlersNamespaceCustom.cpp */,
</ins><span class="cx">                                 BE6DF708171CA2C500DD52B8 /* JSVideoTrackCustom.cpp */,
</span><span class="cx">                                 BE6DF70A171CA2C500DD52B8 /* JSVideoTrackListCustom.cpp */,
</span><span class="cx">                                 49EED14C1051971A00099FAB /* JSWebGLRenderingContextCustom.cpp */,
</span><span class="lines">@@ -20824,6 +20872,12 @@
</span><span class="cx">                                 BCEC01C10C274DDD009F4EC9 /* JSScreen.h */,
</span><span class="cx">                                 494BD79B0F55C94C00747828 /* JSWebKitPoint.cpp */,
</span><span class="cx">                                 494BD79C0F55C94C00747828 /* JSWebKitPoint.h */,
</span><ins>+                                7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */,
+                                7CC6993F191EC5F500AF2270 /* JSWebKitNamespace.h */,
+                                7C73FB0A191EF5A8007DE061 /* JSUserMessageHandlersNamespace.cpp */,
+                                7C73FB0B191EF5A8007DE061 /* JSUserMessageHandlersNamespace.h */,
+                                7C73FB0F191EF6F4007DE061 /* JSUserMessageHandler.cpp */,
+                                7C73FB10191EF6F4007DE061 /* JSUserMessageHandler.h */,
</ins><span class="cx">                         );
</span><span class="cx">                         name = Window;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -22990,6 +23044,7 @@
</span><span class="cx">                                 29A812430FBB9C1D00510293 /* AccessibilityListBox.h in Headers */,
</span><span class="cx">                                 29A812420FBB9C1D00510293 /* AccessibilityListBoxOption.h in Headers */,
</span><span class="cx">                                 07B0113F1032242200FBDC33 /* AccessibilityMediaControls.h in Headers */,
</span><ins>+                                7CE683471921821500F4D928 /* UserMessageHandlerDescriptorTypes.h in Headers */,
</ins><span class="cx">                                 76CDD2F31103DA6600680521 /* AccessibilityMenuList.h in Headers */,
</span><span class="cx">                                 76CDD2F71103DA6600680521 /* AccessibilityMenuListOption.h in Headers */,
</span><span class="cx">                                 76CDD2F51103DA6600680521 /* AccessibilityMenuListPopup.h in Headers */,
</span><span class="lines">@@ -23547,6 +23602,7 @@
</span><span class="cx">                                 2D9A247515B9C2E300D34527 /* DOMDOMSecurityPolicyInternal.h in Headers */,
</span><span class="cx">                                 9B3A8872145632F9003AE8F5 /* DOMDOMSettableTokenList.h in Headers */,
</span><span class="cx">                                 7694565B1214DB630007CBAE /* DOMDOMTokenList.h in Headers */,
</span><ins>+                                7C73FB08191EF417007DE061 /* UserMessageHandlersNamespace.h in Headers */,
</ins><span class="cx">                                 7AABA25A14BC613300AA9A11 /* DOMEditor.h in Headers */,
</span><span class="cx">                                 85ACA9C00A9B5FA500671E90 /* DOMElement.h in Headers */,
</span><span class="cx">                                 85E711980AC5D5350053270F /* DOMElementInternal.h in Headers */,
</span><span class="lines">@@ -24483,6 +24539,7 @@
</span><span class="cx">                                 F5C041E70FFCA96D00839D4A /* JSHTMLDataListElement.h in Headers */,
</span><span class="cx">                                 D359D8BF129CA55C0006E5D2 /* JSHTMLDetailsElement.h in Headers */,
</span><span class="cx">                                 76808B50159DADFA002B5233 /* JSHTMLDialogElement.h in Headers */,
</span><ins>+                                7CC69941191EC5F500AF2270 /* JSWebKitNamespace.h in Headers */,
</ins><span class="cx">                                 1A85B1E70A1B240500D8C87C /* JSHTMLDirectoryElement.h in Headers */,
</span><span class="cx">                                 1A85B2B70A1B2AC700D8C87C /* JSHTMLDivElement.h in Headers */,
</span><span class="cx">                                 1A85B1E90A1B240500D8C87C /* JSHTMLDListElement.h in Headers */,
</span><span class="lines">@@ -24650,6 +24707,7 @@
</span><span class="cx">                                 07969DBC17D14151007FF842 /* JSRTCSessionDescription.h in Headers */,
</span><span class="cx">                                 07969DBE17D14151007FF842 /* JSRTCSessionDescriptionCallback.h in Headers */,
</span><span class="cx">                                 07969DC017D14151007FF842 /* JSRTCStatsCallback.h in Headers */,
</span><ins>+                                7C73FB0D191EF5A8007DE061 /* JSUserMessageHandlersNamespace.h in Headers */,
</ins><span class="cx">                                 07969DC217D14151007FF842 /* JSRTCStatsReport.h in Headers */,
</span><span class="cx">                                 07969DC417D14151007FF842 /* JSRTCStatsResponse.h in Headers */,
</span><span class="cx">                                 BCEC01C30C274DDD009F4EC9 /* JSScreen.h in Headers */,
</span><span class="lines">@@ -24968,6 +25026,7 @@
</span><span class="cx">                                 932AD70617EFA2C40038F8FF /* MainFrame.h in Headers */,
</span><span class="cx">                                 E187056316E54A0D00585E97 /* MainThreadTask.h in Headers */,
</span><span class="cx">                                 1A8F6BC60DB55CDC001DB794 /* ManifestParser.h in Headers */,
</span><ins>+                                7C73FB12191EF6F4007DE061 /* JSUserMessageHandler.h in Headers */,
</ins><span class="cx">                                 93309DF8099E64920056E581 /* markup.h in Headers */,
</span><span class="cx">                                 9728C3141268E4390041E89B /* MarkupAccumulator.h in Headers */,
</span><span class="cx">                                 00C60E3F13D76D7E0092A275 /* MarkupTokenizerInlines.h in Headers */,
</span><span class="lines">@@ -25192,6 +25251,7 @@
</span><span class="cx">                                 FD581FB51520F93B003A7A75 /* PeriodicWave.h in Headers */,
</span><span class="cx">                                 49D5DC2E0F423A73008F20FD /* PerspectiveTransformOperation.h in Headers */,
</span><span class="cx">                                 D0FF2A5E11F8C45A007E74E0 /* PingLoader.h in Headers */,
</span><ins>+                                7C48A6D1191C9D6500026674 /* WebKitNamespace.h in Headers */,
</ins><span class="cx">                                 499B3EDD128DB50200E726C2 /* PlatformCAAnimation.h in Headers */,
</span><span class="cx">                                 0F13163E16ED0CC80035CC04 /* PlatformCAFilters.h in Headers */,
</span><span class="cx">                                 D66B2D5C186830050073C4DD /* PlatformCAFiltersMac.h in Headers */,
</span><span class="lines">@@ -25202,6 +25262,7 @@
</span><span class="cx">                                 BC5C762B1497FE1400BC4775 /* PlatformEvent.h in Headers */,
</span><span class="cx">                                 26601EBF14B3B9AD0012C0FE /* PlatformEventFactoryIOS.h in Headers */,
</span><span class="cx">                                 BCAA487014A052530088FAC4 /* PlatformEventFactoryMac.h in Headers */,
</span><ins>+                                7CE68345192143A800F4D928 /* UserMessageHandlerDescriptor.h in Headers */,
</ins><span class="cx">                                 A723F77B1484CA4C008C6DBE /* PlatformExportMacros.h in Headers */,
</span><span class="cx">                                 935C476809AC4D4300A6AAB4 /* PlatformKeyboardEvent.h in Headers */,
</span><span class="cx">                                 0562F9611573F88F0031CA16 /* PlatformLayer.h in Headers */,
</span><span class="lines">@@ -26322,6 +26383,7 @@
</span><span class="cx">                                 2E43464B0F546A8200B0F1BA /* WorkerGlobalScopeProxy.h in Headers */,
</span><span class="cx">                                 A8CCBB4D151F833B00AB7CE9 /* WorkerGlobalScopeWebDatabase.h in Headers */,
</span><span class="cx">                                 F36E07A51358A8BE00AACBC9 /* WorkerInspectorController.h in Headers */,
</span><ins>+                                7C3B79721908757B00B47A2D /* UserMessageHandler.h in Headers */,
</ins><span class="cx">                                 18F831B80FD48C7800D8C56B /* WorkerLoaderProxy.h in Headers */,
</span><span class="cx">                                 2E43464D0F546A8200B0F1BA /* WorkerLocation.h in Headers */,
</span><span class="cx">                                 2E4346500F546A8200B0F1BA /* WorkerMessagingProxy.h in Headers */,
</span><span class="lines">@@ -27220,6 +27282,7 @@
</span><span class="cx">                                 859A9C500AA5E3BD00B694B2 /* DOMHTMLStyleElement.mm in Sources */,
</span><span class="cx">                                 85DF821E0AA7849E00486AD7 /* DOMHTMLTableCaptionElement.mm in Sources */,
</span><span class="cx">                                 85DF82200AA7849E00486AD7 /* DOMHTMLTableCellElement.mm in Sources */,
</span><ins>+                                7C73FB11191EF6F4007DE061 /* JSUserMessageHandler.cpp in Sources */,
</ins><span class="cx">                                 85DF82220AA7849E00486AD7 /* DOMHTMLTableColElement.mm in Sources */,
</span><span class="cx">                                 85DF82710AA78B8B00486AD7 /* DOMHTMLTableElement.mm in Sources */,
</span><span class="cx">                                 85DF82240AA7849E00486AD7 /* DOMHTMLTableRowElement.mm in Sources */,
</span><span class="lines">@@ -27999,6 +28062,7 @@
</span><span class="cx">                                 A80E7B130A19D606007FB8C5 /* JSHTMLTitleElement.cpp in Sources */,
</span><span class="cx">                                 070756D314239A4E00414161 /* JSHTMLTrackElement.cpp in Sources */,
</span><span class="cx">                                 1A85B2100A1B258700D8C87C /* JSHTMLUListElement.cpp in Sources */,
</span><ins>+                                7C3B79711908757B00B47A2D /* UserMessageHandler.cpp in Sources */,
</ins><span class="cx">                                 6E4ABCD4138EA0B70071D291 /* JSHTMLUnknownElement.cpp in Sources */,
</span><span class="cx">                                 E44614160CD6826900FADA75 /* JSHTMLVideoElement.cpp in Sources */,
</span><span class="cx">                                 511EF2C017F0FD3500E4FA16 /* JSIDBAny.cpp in Sources */,
</span><span class="lines">@@ -28502,6 +28566,7 @@
</span><span class="cx">                                 CDA98E0D1603FE4A00FEA3B1 /* MediaKeys.cpp in Sources */,
</span><span class="cx">                                 CDA98E0E1603FE5800FEA3B1 /* MediaKeySession.cpp in Sources */,
</span><span class="cx">                                 A8EA80090A19516E00A8EF5F /* MediaList.cpp in Sources */,
</span><ins>+                                7CC69940191EC5F500AF2270 /* JSWebKitNamespace.cpp in Sources */,
</ins><span class="cx">                                 E44613E30CD6819F00FADA75 /* MediaPlayer.cpp in Sources */,
</span><span class="cx">                                 072C8B11131C518600A4FCE9 /* MediaPlayerPrivateAVFoundation.cpp in Sources */,
</span><span class="cx">                                 DF9AFD7313FC31D80015FEB7 /* MediaPlayerPrivateAVFoundationObjC.mm in Sources */,
</span><span class="lines">@@ -28548,6 +28613,7 @@
</span><span class="cx">                                 E1ADECC00E76ACF1004A1A5E /* MessagePort.cpp in Sources */,
</span><span class="cx">                                 A78E526F1346BD1700AD9C31 /* MeterShadowElement.cpp in Sources */,
</span><span class="cx">                                 37DDCD9413844FD50008B793 /* MIMEHeader.cpp in Sources */,
</span><ins>+                                7C73FB07191EF417007DE061 /* UserMessageHandlersNamespace.cpp in Sources */,
</ins><span class="cx">                                 BC772C4E0C4EB3040083285F /* MIMETypeRegistry.cpp in Sources */,
</span><span class="cx">                                 E453901D0EAFCACA003695C8 /* MIMETypeRegistryIOS.mm in Sources */,
</span><span class="cx">                                 BC772C5E0C4EB3440083285F /* MIMETypeRegistryMac.mm in Sources */,
</span><span class="lines">@@ -28702,6 +28768,7 @@
</span><span class="cx">                                 A1E1154613015C4E0054AC8C /* PointLightSource.cpp in Sources */,
</span><span class="cx">                                 97059977107D975200A50A7C /* PolicyCallback.cpp in Sources */,
</span><span class="cx">                                 97059979107D975200A50A7C /* PolicyChecker.cpp in Sources */,
</span><ins>+                                7C73FB19191EF808007DE061 /* JSUserMessageHandlersNamespaceCustom.cpp in Sources */,
</ins><span class="cx">                                 FD45A959175D417100C21EC8 /* PolygonShape.cpp in Sources */,
</span><span class="cx">                                 5189F0DE10B46B0E00F3C739 /* PopStateEvent.cpp in Sources */,
</span><span class="cx">                                 93F19AF808245E59001E9ABC /* Position.cpp in Sources */,
</span><span class="lines">@@ -29135,6 +29202,7 @@
</span><span class="cx">                                 08B5F25513B5FFF2002959EC /* SVGAnimatedPath.cpp in Sources */,
</span><span class="cx">                                 43B9336A13B261B1004584BF /* SVGAnimatedPointList.cpp in Sources */,
</span><span class="cx">                                 431A302113B89DCC007791E4 /* SVGAnimatedPreserveAspectRatio.cpp in Sources */,
</span><ins>+                                7C48A6D0191C9D6500026674 /* WebKitNamespace.cpp in Sources */,
</ins><span class="cx">                                 836FBCEC178C117F00B21A15 /* SVGAnimatedProperty.cpp in Sources */,
</span><span class="cx">                                 43142E7A13B1E97700F1C871 /* SVGAnimatedRect.cpp in Sources */,
</span><span class="cx">                                 43A6266713B3D11000AC94B8 /* SVGAnimatedString.cpp in Sources */,
</span><span class="lines">@@ -29345,6 +29413,7 @@
</span><span class="cx">                                 44C991A00F3D210E00586670 /* ThemeIOS.mm in Sources */,
</span><span class="cx">                                 BCE659E90EA92FFA007E4533 /* ThemeMac.mm in Sources */,
</span><span class="cx">                                 976D6C94122B8A3D001FD1F7 /* ThreadableBlobRegistry.cpp in Sources */,
</span><ins>+                                7CE68344192143A800F4D928 /* UserMessageHandlerDescriptor.cpp in Sources */,
</ins><span class="cx">                                 0B90561E0F257E930095FF6A /* ThreadableLoader.cpp in Sources */,
</span><span class="cx">                                 97AABD1614FA09D5007457AE /* ThreadableWebSocketChannel.cpp in Sources */,
</span><span class="cx">                                 97AABD1814FA09D5007457AE /* ThreadableWebSocketChannelClientWrapper.cpp in Sources */,
</span><span class="lines">@@ -29525,6 +29594,7 @@
</span><span class="cx">                                 CD82030B1395AB6A00F956C6 /* WebVideoFullscreenController.mm in Sources */,
</span><span class="cx">                                 3F42B31E1881191B00278AAC /* WebVideoFullscreenControllerAVKit.mm in Sources */,
</span><span class="cx">                                 CD82030D1395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm in Sources */,
</span><ins>+                                7C73FB0C191EF5A8007DE061 /* JSUserMessageHandlersNamespace.cpp in Sources */,
</ins><span class="cx">                                 3FBC4AF3189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm in Sources */,
</span><span class="cx">                                 3FBC4AEF189881380046EE38 /* WebVideoFullscreenModelMediaElement.mm in Sources */,
</span><span class="cx">                                 F12171F516A8CED2000053CA /* WebVTTElement.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMWindowBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -39,6 +39,10 @@
</span><span class="cx"> #include <runtime/Microtask.h>
</span><span class="cx"> #include <wtf/MainThread.h>
</span><span class="cx">
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+#include "JSWebKitNamespace.h"
+#endif
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> #include "ChromeClient.h"
</span><span class="cx"> #include "WebSafeGCActivityCallbackIOS.h"
</span><span class="lines">@@ -77,6 +81,11 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals));
</span><ins>+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+ if (m_impl->shouldHaveWebKitNamespaceForWorld(world()))
+ putDirect(vm, Identifier(&vm, "webkit"), toJS(globalExec(), this, m_impl->webkitNamespace()), DontDelete | ReadOnly);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void JSDOMWindowBase::destroy(JSCell* cell)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSUserMessageHandlersNamespaceCustomcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/bindings/js/JSUserMessageHandlersNamespaceCustom.cpp (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSUserMessageHandlersNamespaceCustom.cpp         (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSUserMessageHandlersNamespaceCustom.cpp        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSUserMessageHandlersNamespace.h"
+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+
+#include "JSUserMessageHandler.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+bool JSUserMessageHandlersNamespace::getOwnPropertySlotDelegate(ExecState* exec, PropertyName propertyName, PropertySlot& slot)
+{
+ if (UserMessageHandler* handler = impl().handler(propertyNameToAtomicString(propertyName), globalObject()->world())) {
+ slot.setValue(this, ReadOnly | DontDelete | DontEnum, toJS(exec, globalObject(), handler));
+ return true;
+ }
+ return false;
+}
+
+}
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
</ins></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.cpp (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.cpp        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebCore/page/DOMWindow.cpp        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -110,6 +110,12 @@
</span><span class="cx"> #include <wtf/text/Base64.h>
</span><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+#include "UserContentController.h"
+#include "UserMessageHandlerDescriptor.h"
+#include "WebKitNamespace.h"
+#endif
+
</ins><span class="cx"> #if ENABLE(PROXIMITY_EVENTS)
</span><span class="cx"> #include "DeviceProximityController.h"
</span><span class="cx"> #endif
</span><span class="lines">@@ -712,6 +718,42 @@
</span><span class="cx"> return m_location.get();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+bool DOMWindow::shouldHaveWebKitNamespaceForWorld(DOMWrapperWorld& world)
+{
+ if (!m_frame)
+ return false;
+
+ auto* page = m_frame->page();
+ if (!page)
+ return false;
+
+ auto* userContentController = page->userContentController();
+ if (!userContentController)
+ return false;
+
+ auto* descriptorMap = userContentController->userMessageHandlerDescriptors();
+ if (!descriptorMap)
+ return false;
+
+ for (auto& descriptor : descriptorMap->values()) {
+ if (&descriptor->world() == &world)
+ return true;
+ }
+
+ return false;
+}
+
+WebKitNamespace* DOMWindow::webkitNamespace() const
+{
+ if (!isCurrentlyDisplayedInFrame())
+ return nullptr;
+ if (!m_webkitNamespace)
+ m_webkitNamespace = WebKitNamespace::create(*m_frame);
+ return m_webkitNamespace.get();
+}
+#endif
+
</ins><span class="cx"> Storage* DOMWindow::sessionStorage(ExceptionCode& ec) const
</span><span class="cx"> {
</span><span class="cx"> if (!isCurrentlyDisplayedInFrame())
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.h (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.h        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebCore/page/DOMWindow.h        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -48,7 +48,9 @@
</span><span class="cx"> class DOMApplicationCache;
</span><span class="cx"> class DOMSelection;
</span><span class="cx"> class DOMURL;
</span><ins>+ class DOMWindowCSS;
</ins><span class="cx"> class DOMWindowProperty;
</span><ins>+ class DOMWrapperWorld;
</ins><span class="cx"> class Database;
</span><span class="cx"> class DatabaseCallback;
</span><span class="cx"> class Document;
</span><span class="lines">@@ -73,8 +75,8 @@
</span><span class="cx"> class SerializedScriptValue;
</span><span class="cx"> class Storage;
</span><span class="cx"> class StyleMedia;
</span><ins>+ class WebKitNamespace;
</ins><span class="cx"> class WebKitPoint;
</span><del>- class DOMWindowCSS;
</del><span class="cx">
</span><span class="cx"> #if ENABLE(REQUEST_ANIMATION_FRAME)
</span><span class="cx"> class RequestAnimationFrameCallback;
</span><span class="lines">@@ -426,6 +428,11 @@
</span><span class="cx"> bool hasTouchEventListeners() const { return m_touchEventListenerCount > 0; }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+ bool shouldHaveWebKitNamespaceForWorld(DOMWrapperWorld&);
+ WebKitNamespace* webkitNamespace() const;
+#endif
+
</ins><span class="cx"> // FIXME: When this DOMWindow is no longer the active DOMWindow (i.e.,
</span><span class="cx"> // when its document is no longer the document that is displayed in its
</span><span class="cx"> // frame), we would like to zero out m_frame to avoid being confused
</span><span class="lines">@@ -501,6 +508,10 @@
</span><span class="cx"> #if ENABLE(CSS3_CONDITIONAL_RULES)
</span><span class="cx"> mutable RefPtr<DOMWindowCSS> m_css;
</span><span class="cx"> #endif
</span><ins>+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+ mutable RefPtr<WebKitNamespace> m_webkitNamespace;
+#endif
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> inline String DOMWindow::status() const
</span></span></pre></div>
<a id="trunkSourceWebCorepageUserContentControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/UserContentController.cpp (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/UserContentController.cpp        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebCore/page/UserContentController.cpp        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -33,6 +33,10 @@
</span><span class="cx"> #include "UserScript.h"
</span><span class="cx"> #include "UserStyleSheet.h"
</span><span class="cx">
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+#include "UserMessageHandlerDescriptor.h"
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> RefPtr<UserContentController> UserContentController::create()
</span><span class="lines">@@ -151,6 +155,24 @@
</span><span class="cx"> invalidateInjectedStyleSheetCacheInAllFrames();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+void UserContentController::addUserMessageHandlerDescriptor(UserMessageHandlerDescriptor& descriptor)
+{
+ if (!m_userMessageHandlerDescriptors)
+ m_userMessageHandlerDescriptors = std::make_unique<UserMessageHandlerDescriptorMap>();
+
+ m_userMessageHandlerDescriptors->add(std::make_pair(descriptor.name(), &descriptor.world()), &descriptor);
+}
+
+void UserContentController::removeUserMessageHandlerDescriptor(UserMessageHandlerDescriptor& descriptor)
+{
+ if (!m_userMessageHandlerDescriptors)
+ return;
+
+ m_userMessageHandlerDescriptors->remove(std::make_pair(descriptor.name(), &descriptor.world()));
+}
+#endif
+
</ins><span class="cx"> void UserContentController::removeAllUserContent()
</span><span class="cx"> {
</span><span class="cx"> m_userScripts = nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCorepageUserContentControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/UserContentController.h (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/UserContentController.h        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebCore/page/UserContentController.h        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -32,6 +32,10 @@
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> #include <wtf/RefPtr.h>
</span><span class="cx">
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+#include "UserMessageHandlerDescriptorTypes.h"
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class DOMWrapperWorld;
</span><span class="lines">@@ -39,6 +43,7 @@
</span><span class="cx"> class URL;
</span><span class="cx"> class UserScript;
</span><span class="cx"> class UserStyleSheet;
</span><ins>+class UserMessageHandlerDescriptor;
</ins><span class="cx">
</span><span class="cx"> class UserContentController : public RefCounted<UserContentController> {
</span><span class="cx"> public:
</span><span class="lines">@@ -62,6 +67,13 @@
</span><span class="cx">
</span><span class="cx"> void removeAllUserContent();
</span><span class="cx">
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+ const UserMessageHandlerDescriptorMap* userMessageHandlerDescriptors() const { return m_userMessageHandlerDescriptors.get(); }
+
+ void addUserMessageHandlerDescriptor(UserMessageHandlerDescriptor&);
+ void removeUserMessageHandlerDescriptor(UserMessageHandlerDescriptor&);
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx"> UserContentController();
</span><span class="cx">
</span><span class="lines">@@ -71,6 +83,9 @@
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<UserScriptMap> m_userScripts;
</span><span class="cx"> std::unique_ptr<UserStyleSheetMap> m_userStyleSheets;
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+ std::unique_ptr<UserMessageHandlerDescriptorMap> m_userMessageHandlerDescriptors;
+#endif
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepageUserMessageHandlercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/UserMessageHandler.cpp (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/UserMessageHandler.cpp         (rev 0)
+++ trunk/Source/WebCore/page/UserMessageHandler.cpp        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "UserMessageHandler.h"
+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+
+#include "Frame.h"
+#include "SerializedScriptValue.h"
+
+namespace WebCore {
+
+UserMessageHandler::UserMessageHandler(Frame& frame, UserMessageHandlerDescriptor& descriptor)
+ : FrameDestructionObserver(&frame)
+ , m_descriptor(descriptor)
+{
+}
+
+UserMessageHandler::~UserMessageHandler()
+{
+}
+
+void UserMessageHandler::postMessage(PassRefPtr<SerializedScriptValue> value)
+{
+ m_descriptor->client().didPostMessage(*this, value.get());
+}
+
+const AtomicString& UserMessageHandler::name()
+{
+ return m_descriptor->name();
+}
+
+DOMWrapperWorld& UserMessageHandler::world()
+{
+ return m_descriptor->world();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
</ins></span></pre></div>
<a id="trunkSourceWebCorepageUserMessageHandlerh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/UserMessageHandler.h (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/UserMessageHandler.h         (rev 0)
+++ trunk/Source/WebCore/page/UserMessageHandler.h        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef UserMessageHandler_h
+#define UserMessageHandler_h
+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+
+#include "FrameDestructionObserver.h"
+#include "UserMessageHandlerDescriptor.h"
+#include <bindings/ScriptValue.h>
+
+namespace WebCore {
+
+class UserMessageHandler : public RefCounted<UserMessageHandler>, public FrameDestructionObserver {
+public:
+ static PassRef<UserMessageHandler> create(Frame& frame, UserMessageHandlerDescriptor& descriptor)
+ {
+ return adoptRef(*new UserMessageHandler(frame, descriptor));
+ }
+ virtual ~UserMessageHandler();
+
+ void postMessage(PassRefPtr<SerializedScriptValue>);
+
+ const AtomicString& name();
+ DOMWrapperWorld& world();
+
+private:
+ UserMessageHandler(Frame&, UserMessageHandlerDescriptor&);
+
+ Ref<UserMessageHandlerDescriptor> m_descriptor;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
+#endif // UserMessageHandler_h
</ins></span></pre></div>
<a id="trunkSourceWebCorepageUserMessageHandleridl"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/UserMessageHandler.idl (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/UserMessageHandler.idl         (rev 0)
+++ trunk/Source/WebCore/page/UserMessageHandler.idl        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+ Conditional=USER_MESSAGE_HANDLERS
+] interface UserMessageHandler {
+ void postMessage(SerializedScriptValue message);
+};
</ins></span></pre></div>
<a id="trunkSourceWebCorepageUserMessageHandlerDescriptorcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/UserMessageHandlerDescriptor.cpp (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/UserMessageHandlerDescriptor.cpp         (rev 0)
+++ trunk/Source/WebCore/page/UserMessageHandlerDescriptor.cpp        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "UserMessageHandlerDescriptor.h"
+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+
+#include "DOMWrapperWorld.h"
+
+namespace WebCore {
+
+UserMessageHandlerDescriptor::UserMessageHandlerDescriptor(const AtomicString& name, DOMWrapperWorld& world, Client& client)
+ : m_name(name)
+ , m_world(world)
+ , m_client(client)
+{
+}
+
+UserMessageHandlerDescriptor::~UserMessageHandlerDescriptor()
+{
+}
+
+const AtomicString& UserMessageHandlerDescriptor::name()
+{
+ return m_name;
+}
+
+DOMWrapperWorld& UserMessageHandlerDescriptor::world()
+{
+ return m_world.get();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
</ins></span></pre></div>
<a id="trunkSourceWebCorepageUserMessageHandlerDescriptorh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/UserMessageHandlerDescriptor.h (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/UserMessageHandlerDescriptor.h         (rev 0)
+++ trunk/Source/WebCore/page/UserMessageHandlerDescriptor.h        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef UserMessageHandlerDescriptor_h
+#define UserMessageHandlerDescriptor_h
+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+#include <wtf/text/AtomicString.h>
+
+namespace WebCore {
+
+class Frame;
+class DOMWrapperWorld;
+class UserMessageHandler;
+class SerializedScriptValue;
+
+class UserMessageHandlerDescriptor : public RefCounted<UserMessageHandlerDescriptor> {
+public:
+ class Client {
+ public:
+ virtual ~Client() { }
+ virtual void didPostMessage(UserMessageHandler&, SerializedScriptValue*) = 0;
+ };
+
+ static PassRefPtr<UserMessageHandlerDescriptor> create(const AtomicString& name, DOMWrapperWorld& world, Client& client)
+ {
+ return adoptRef(new UserMessageHandlerDescriptor(name, world, client));
+ }
+ ~UserMessageHandlerDescriptor();
+
+ const AtomicString& name();
+ DOMWrapperWorld& world();
+
+ Client& client() const { return m_client; }
+
+private:
+ explicit UserMessageHandlerDescriptor(const AtomicString&, DOMWrapperWorld&, Client&);
+
+ AtomicString m_name;
+ Ref<DOMWrapperWorld> m_world;
+ Client& m_client;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
+#endif // UserMessageHandlerDescriptor_h
</ins></span></pre></div>
<a id="trunkSourceWebCorepageUserMessageHandlerDescriptorTypesh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/UserMessageHandlerDescriptorTypes.h (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/UserMessageHandlerDescriptorTypes.h         (rev 0)
+++ trunk/Source/WebCore/page/UserMessageHandlerDescriptorTypes.h        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef UserMessageHandlerDescriptorTypes_h
+#define UserMessageHandlerDescriptorTypes_h
+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+
+#include <wtf/HashMap.h>
+#include <wtf/RefPtr.h>
+#include <wtf/text/AtomicString.h>
+#include <wtf/text/AtomicStringHash.h>
+
+namespace WebCore {
+
+class DOMWrapperWorld;
+class UserMessageHandlerDescriptor;
+
+typedef HashMap<std::pair<AtomicString, RefPtr<DOMWrapperWorld>>, RefPtr<UserMessageHandlerDescriptor>> UserMessageHandlerDescriptorMap;
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
+#endif // UserMessageHandlerDescriptorTypes_h
</ins></span></pre></div>
<a id="trunkSourceWebCorepageUserMessageHandlersNamespacecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/UserMessageHandlersNamespace.cpp (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/UserMessageHandlersNamespace.cpp         (rev 0)
+++ trunk/Source/WebCore/page/UserMessageHandlersNamespace.cpp        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "UserMessageHandlersNamespace.h"
+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+
+#include "DOMWrapperWorld.h"
+#include "Frame.h"
+#include "Page.h"
+#include "UserContentController.h"
+
+namespace WebCore {
+
+UserMessageHandlersNamespace::UserMessageHandlersNamespace(Frame& frame)
+ : FrameDestructionObserver(&frame)
+{
+}
+
+UserMessageHandlersNamespace::~UserMessageHandlersNamespace()
+{
+}
+
+UserMessageHandler* UserMessageHandlersNamespace::handler(const AtomicString& name, DOMWrapperWorld& world)
+{
+ // First, check if we have a handler instance already.
+ for (auto& handler : m_messageHandlers) {
+ if (handler->name() == name && &handler->world() == &world)
+ return &handler.get();
+ }
+
+ // Second, attempt to create a handler instance from a descriptor.
+ if (!frame())
+ return nullptr;
+
+ Page* page = frame()->page();
+ if (!page)
+ return nullptr;
+
+ const auto* userContentController = page->userContentController();
+ if (!userContentController)
+ return nullptr;
+
+ const auto* userMessageHandlerDescriptors = userContentController->userMessageHandlerDescriptors();
+ if (!userMessageHandlerDescriptors)
+ return nullptr;
+
+ RefPtr<UserMessageHandlerDescriptor> descriptor = userMessageHandlerDescriptors->get(std::make_pair(name, &world));
+ if (!descriptor)
+ return nullptr;
+
+ m_messageHandlers.append(UserMessageHandler::create(*frame(), *descriptor));
+ return &m_messageHandlers.last().get();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
</ins></span></pre></div>
<a id="trunkSourceWebCorepageUserMessageHandlersNamespaceh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/UserMessageHandlersNamespace.h (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/UserMessageHandlersNamespace.h         (rev 0)
+++ trunk/Source/WebCore/page/UserMessageHandlersNamespace.h        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef UserMessageHandlersNamespace_h
+#define UserMessageHandlersNamespace_h
+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+
+#include "FrameDestructionObserver.h"
+#include "UserMessageHandler.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+#include <wtf/text/AtomicString.h>
+
+namespace WebCore {
+
+class Frame;
+class UserMessageHandler;
+class DOMWrapperWorld;
+
+class UserMessageHandlersNamespace : public RefCounted<UserMessageHandlersNamespace>, public FrameDestructionObserver {
+public:
+ static PassRef<UserMessageHandlersNamespace> create(Frame& frame)
+ {
+ return adoptRef(*new UserMessageHandlersNamespace(frame));
+ }
+
+ virtual ~UserMessageHandlersNamespace();
+
+ UserMessageHandler* handler(const AtomicString&, DOMWrapperWorld&);
+
+private:
+ explicit UserMessageHandlersNamespace(Frame&);
+
+ Vector<Ref<UserMessageHandler>> m_messageHandlers;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
+#endif // UserMessageHandlersNamespace_h
</ins></span></pre></div>
<a id="trunkSourceWebCorepageUserMessageHandlersNamespaceidl"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/UserMessageHandlersNamespace.idl (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/UserMessageHandlersNamespace.idl         (rev 0)
+++ trunk/Source/WebCore/page/UserMessageHandlersNamespace.idl        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+ JSCustomGetOwnPropertySlotAndDescriptor,
+ Conditional=USER_MESSAGE_HANDLERS
+] interface UserMessageHandlersNamespace {
+};
</ins></span></pre></div>
<a id="trunkSourceWebCorepageWebKitNamespacecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/WebKitNamespace.cpp (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/WebKitNamespace.cpp         (rev 0)
+++ trunk/Source/WebCore/page/WebKitNamespace.cpp        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitNamespace.h"
+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+
+#include "DOMWindow.h"
+#include "UserMessageHandlersNamespace.h"
+
+namespace WebCore {
+
+WebKitNamespace::WebKitNamespace(Frame& frame)
+ : DOMWindowProperty(&frame)
+ , m_messageHandlerNamespace(UserMessageHandlersNamespace::create(frame))
+{
+}
+
+WebKitNamespace::~WebKitNamespace()
+{
+}
+
+UserMessageHandlersNamespace* WebKitNamespace::messageHandlers()
+{
+ return &m_messageHandlerNamespace.get();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
</ins></span></pre></div>
<a id="trunkSourceWebCorepageWebKitNamespaceh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/WebKitNamespace.h (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/WebKitNamespace.h         (rev 0)
+++ trunk/Source/WebCore/page/WebKitNamespace.h        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKitNamespace_h
+#define WebKitNamespace_h
+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+
+#include "DOMWindowProperty.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class Frame;
+class UserMessageHandlersNamespace;
+
+class WebKitNamespace : public DOMWindowProperty, public RefCounted<WebKitNamespace> {
+public:
+ static PassRefPtr<WebKitNamespace> create(Frame& frame)
+ {
+ return adoptRef(new WebKitNamespace(frame));
+ }
+
+ virtual ~WebKitNamespace();
+
+ UserMessageHandlersNamespace* messageHandlers();
+
+private:
+ explicit WebKitNamespace(Frame&);
+
+ Ref<UserMessageHandlersNamespace> m_messageHandlerNamespace;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
+#endif // WebKitNamespace_h
</ins></span></pre></div>
<a id="trunkSourceWebCorepageWebKitNamespaceidl"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/WebKitNamespace.idl (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/WebKitNamespace.idl         (rev 0)
+++ trunk/Source/WebCore/page/WebKitNamespace.idl        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+[
+ Conditional=USER_MESSAGE_HANDLERS
+] interface WebKitNamespace {
+ readonly attribute UserMessageHandlersNamespace messageHandlers;
+};
</ins></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebKit2/ChangeLog        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -1,3 +1,70 @@
</span><ins>+2014-05-18 Sam Weinig <sam@webkit.org>
+
+ [WebKit2] Implement ScriptMessageHandlers
+ https://bugs.webkit.org/show_bug.cgi?id=133053
+
+ Reviewed by Anders Carlsson.
+
+ * DerivedSources.make:
+ * Scripts/webkit2/messages.py:
+ (struct_or_class):
+ (argument_coder_headers_for_type):
+ (headers_for_type):
+ * UIProcess/API/Cocoa/WKScriptMessage.mm:
+ (-[WKScriptMessage _initWithBody:webView:name:]):
+ (-[WKScriptMessage body]):
+ (-[WKScriptMessage webView]):
+ (-[WKScriptMessage name]):
+ (-[WKScriptMessage _scriptWorld]): Deleted.
+ * UIProcess/API/Cocoa/WKScriptMessageInternal.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessagePrivate.h.
+ * UIProcess/API/Cocoa/WKScriptMessagePrivate.h: Removed.
+ * UIProcess/API/Cocoa/WKUserContentController.mm:
+ (-[WKUserContentController addScriptMessageHandler:name:]):
+ (-[WKUserContentController removeScriptMessageHandlerForName:]):
+ (-[WKUserContentController _addScriptMessageHandler:name:world:]): Deleted.
+ (-[WKUserContentController _removeScriptMessageHandlerForName:world:]): Deleted.
+ * UIProcess/API/Cocoa/WKUserContentControllerInternal.h:
+ * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h: Removed.
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (pageToViewMap):
+ (fromWebPageProxy):
+ (-[WKWebView initWithFrame:configuration:]):
+ (-[WKWebView dealloc]):
+ * UIProcess/API/Cocoa/WKWebViewInternal.h:
+ * UIProcess/UserContent/WebScriptMessageHandler.cpp: Added.
+ (WebKit::WebScriptMessageHandlerHandle::encode):
+ (WebKit::WebScriptMessageHandlerHandle::decode):
+ (WebKit::generateIdentifier):
+ (WebKit::WebScriptMessageHandler::create):
+ (WebKit::WebScriptMessageHandler::WebScriptMessageHandler):
+ (WebKit::WebScriptMessageHandler::~WebScriptMessageHandler):
+ * UIProcess/UserContent/WebScriptMessageHandler.h: Added.
+ (WebKit::WebScriptMessageHandler::Client::~Client):
+ (WebKit::WebScriptMessageHandler::handle):
+ (WebKit::WebScriptMessageHandler::identifier):
+ (WebKit::WebScriptMessageHandler::name):
+ (WebKit::WebScriptMessageHandler::client):
+ * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
+ (WebKit::WebUserContentControllerProxy::addProcess):
+ (WebKit::WebUserContentControllerProxy::removeProcess):
+ (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
+ (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
+ (WebKit::WebUserContentControllerProxy::didPostMessage):
+ * UIProcess/UserContent/WebUserContentControllerProxy.h:
+ * UIProcess/UserContent/WebUserContentControllerProxy.messages.in: Added.
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/UserContent/WebUserContentController.cpp:
+ (WebKit::WebUserMessageHandlerDescriptorProxy::create):
+ (WebKit::WebUserMessageHandlerDescriptorProxy::~WebUserMessageHandlerDescriptorProxy):
+ (WebKit::WebUserMessageHandlerDescriptorProxy::didPostMessage):
+ (WebKit::WebUserMessageHandlerDescriptorProxy::descriptor):
+ (WebKit::WebUserMessageHandlerDescriptorProxy::identifier):
+ (WebKit::WebUserMessageHandlerDescriptorProxy::WebUserMessageHandlerDescriptorProxy):
+ (WebKit::WebUserContentController::addUserScriptMessageHandlers):
+ (WebKit::WebUserContentController::removeUserScriptMessageHandler):
+ * WebProcess/UserContent/WebUserContentController.h:
+ * WebProcess/UserContent/WebUserContentController.messages.in:
+
</ins><span class="cx"> 2014-05-18 Rik Cabanier <cabanier@adobe.com>
</span><span class="cx">
</span><span class="cx"> support for navigator.hardwareConcurrency
</span></span></pre></div>
<a id="trunkSourceWebKit2DerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DerivedSources.make (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DerivedSources.make        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebKit2/DerivedSources.make        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx"> $(WebKit2)/UIProcess/Notifications \
</span><span class="cx"> $(WebKit2)/UIProcess/Plugins \
</span><span class="cx"> $(WebKit2)/UIProcess/Storage \
</span><ins>+ $(WebKit2)/UIProcess/UserContent \
</ins><span class="cx"> $(WebKit2)/UIProcess/mac \
</span><span class="cx"> $(WebKit2)/UIProcess/ios \
</span><span class="cx"> #
</span><span class="lines">@@ -135,6 +136,7 @@
</span><span class="cx"> WebResourceCacheManagerProxy \
</span><span class="cx"> WebResourceLoader \
</span><span class="cx"> WebUserContentController \
</span><ins>+ WebUserContentControllerProxy \
</ins><span class="cx"> WebVideoFullscreenManager \
</span><span class="cx"> WebVideoFullscreenManagerProxy \
</span><span class="cx"> #
</span></span></pre></div>
<a id="trunkSourceWebKit2Scriptswebkit2messagespy"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Scripts/webkit2/messages.py (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Scripts/webkit2/messages.py        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebKit2/Scripts/webkit2/messages.py        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -214,6 +214,7 @@
</span><span class="cx"> 'WebKit::WebPageCreationParameters',
</span><span class="cx"> 'WebKit::WebPreferencesStore',
</span><span class="cx"> 'WebKit::WebProcessCreationParameters',
</span><ins>+ 'WebKit::WebScriptMessageHandlerHandle',
</ins><span class="cx"> 'WebKit::WindowGeometry',
</span><span class="cx"> ])
</span><span class="cx">
</span><span class="lines">@@ -396,6 +397,7 @@
</span><span class="cx"> 'String': '"ArgumentCoders.h"',
</span><span class="cx"> 'WebKit::InjectedBundleUserMessageEncoder': '"InjectedBundleUserMessageCoders.h"',
</span><span class="cx"> 'WebKit::WebContextUserMessageEncoder': '"WebContextUserMessageCoders.h"',
</span><ins>+ 'WebKit::ScriptMessageHandlerHandle': '"WebScriptMessageHandler.h"',
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> headers = []
</span><span class="lines">@@ -439,6 +441,7 @@
</span><span class="cx"> 'WebKit::WebMouseEvent': ['"WebEvent.h"'],
</span><span class="cx"> 'WebKit::WebTouchEvent': ['"WebEvent.h"'],
</span><span class="cx"> 'WebKit::WebWheelEvent': ['"WebEvent.h"'],
</span><ins>+ 'WebKit::WebScriptMessageHandlerHandle': ['"WebScriptMessageHandler.h"'],
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> headers = []
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKScriptMessagemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessage.mm (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessage.mm        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessage.mm        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -24,43 +24,48 @@
</span><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> #import "config.h"
</span><del>-#import "WKScriptMessagePrivate.h"
</del><ins>+#import "WKScriptMessageInternal.h"
</ins><span class="cx">
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">
</span><del>-// FIXME: Consider adding the navigation as well.
</del><ins>+#import "WeakObjCPtr.h"
+#import <wtf/RetainPtr.h>
</ins><span class="cx">
</span><del>-@implementation WKScriptMessage
</del><ins>+@implementation WKScriptMessage {
+ RetainPtr<id> _body;
+ WebKit::WeakObjCPtr<WKWebView> _webView;
+ RetainPtr<NSString> _name;
+}
</ins><span class="cx">
</span><ins>+- (instancetype)_initWithBody:(id)body webView:(WKWebView *)webView name:(NSString *)name
+{
+ if (!(self = [super init]))
+ return nil;
+
+ _body = [body copy];
+ _webView = webView;
+ _name = adoptNS([name copy]);
+
+ return self;
+
+}
+
</ins><span class="cx"> - (id)body
</span><span class="cx"> {
</span><del>- // FIXME: Implement.
- return nil;
</del><ins>+ return _body.get();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (WKWebView *)webView
</span><span class="cx"> {
</span><del>- // FIXME: Implement.
- return nil;
</del><ins>+ return _webView.getAutoreleased();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSString *)name
</span><span class="cx"> {
</span><del>- // FIXME: Implement.
- return nil;
</del><ins>+ return _name.get();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span><del>-@implementation WKScriptMessage (WKPrivate)
-
-- (_WKScriptWorld *)_scriptWorld
-{
- // FIXME: Implement.
- return nil;
-}
-
-@end
-
</del><span class="cx"> #endif
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKScriptMessageInternalhfromrev168994trunkSourceWebKit2UIProcessAPICocoaWKScriptMessagePrivateh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessageInternal.h (from rev 168994, trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessagePrivate.h) (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessageInternal.h         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessageInternal.h        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WKScriptMessage.h"
+
+#if WK_API_ENABLED
+
+@interface WKScriptMessage ()
+
+- (instancetype)_initWithBody:(id)body webView:(WKWebView *)webView name:(NSString *)name;
+
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKScriptMessagePrivateh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessagePrivate.h (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessagePrivate.h        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessagePrivate.h        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -1,38 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <WebKit/WKScriptMessage.h>
-
-#if WK_API_ENABLED
-
-@class _WKScriptWorld;
-
-@interface WKScriptMessage (WKPrivate)
-
-@property (nonatomic, readonly) _WKScriptWorld *_scriptWorld;
-
-@end
-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKUserContentControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -28,9 +28,15 @@
</span><span class="cx">
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">
</span><ins>+#import "WKScriptMessageHandler.h"
+#import "WKScriptMessageInternal.h"
</ins><span class="cx"> #import "WKUserScriptInternal.h"
</span><ins>+#import "WKWebViewInternal.h"
+#import "WebScriptMessageHandler.h"
</ins><span class="cx"> #import "WebUserContentControllerProxy.h"
</span><del>-#import "_WKScriptWorld.h"
</del><ins>+#import <JavaScriptCore/JSContext.h>
+#import <JavaScriptCore/JSValue.h>
+#import <WebCore/SerializedScriptValue.h>
</ins><span class="cx"> #import <WebCore/UserScript.h>
</span><span class="cx"> #import <wtf/text/StringBuilder.h>
</span><span class="cx">
</span><span class="lines">@@ -87,28 +93,43 @@
</span><span class="cx"> _userContentControllerProxy->removeAllUserScripts();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)addScriptMessageHandler:(id <WKScriptMessageHandler>)scriptMessageHandler name:(NSString *)name
-{
- [self _addScriptMessageHandler:scriptMessageHandler name:name world:[_WKScriptWorld defaultWorld]];
-}
</del><ins>+class ScriptMessageHandlerDelegate final : public WebKit::WebScriptMessageHandler::Client {
+public:
+ ScriptMessageHandlerDelegate(WKUserContentController *controller, id <WKScriptMessageHandler> handler, NSString *name)
+ : m_controller(controller)
+ , m_handler(handler)
+ , m_name(adoptNS([name copy]))
+ {
+ }
+
+ virtual void didPostMessage(WebKit::WebPageProxy& page, WebKit::WebFrameProxy&, WebCore::SerializedScriptValue& serializedScriptValue)
+ {
+ RetainPtr<JSContext> context = adoptNS([[JSContext alloc] init]);
+ JSValueRef valueRef = serializedScriptValue.deserialize([context JSGlobalContextRef], 0);
+ JSValue *value = [JSValue valueWithJSValueRef:valueRef inContext:context.get()];
+ id body = [value toObject];
</ins><span class="cx">
</span><del>-- (void)removeScriptMessageHandlerForName:(NSString *)name
-{
- [self _removeScriptMessageHandlerForName:name world:[_WKScriptWorld defaultWorld]];
-}
</del><ins>+ RetainPtr<WKScriptMessage> message = adoptNS([[WKScriptMessage alloc] _initWithBody:body webView:fromWebPageProxy(page) name:m_name.get()]);
+
+ [m_handler userContentController:m_controller.get() didReceiveScriptMessage:message.get()];
+ }
</ins><span class="cx">
</span><del>-@end
</del><ins>+private:
+ RetainPtr<WKUserContentController> m_controller;
+ RetainPtr<id <WKScriptMessageHandler>> m_handler;
+ RetainPtr<NSString> m_name;
+};
</ins><span class="cx">
</span><del>-@implementation WKUserContentController (WKPrivate)
-
-- (void)_addScriptMessageHandler:(id <WKScriptMessageHandler>)scriptMessageHandler name:(NSString *)name world:(_WKScriptWorld *)world
</del><ins>+- (void)addScriptMessageHandler:(id <WKScriptMessageHandler>)scriptMessageHandler name:(NSString *)name
</ins><span class="cx"> {
</span><del>- // FIXME: Implement.
</del><ins>+ RefPtr<WebKit::WebScriptMessageHandler> handler = WebKit::WebScriptMessageHandler::create(std::make_unique<ScriptMessageHandlerDelegate>(self, scriptMessageHandler, name), name);
+ if (!_userContentControllerProxy->addUserScriptMessageHandler(handler.get()))
+ [NSException raise:NSInvalidArgumentException format:@"Attempt to add script message handler with name '%@' when one already exists.", name];
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)_removeScriptMessageHandlerForName:(NSString *)name world:(_WKScriptWorld *)world
</del><ins>+- (void)removeScriptMessageHandlerForName:(NSString *)name
</ins><span class="cx"> {
</span><del>- // FIXME: Implement.
</del><ins>+ _userContentControllerProxy->removeUserMessageHandlerForName(name);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKUserContentControllerInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerInternal.h (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerInternal.h        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerInternal.h        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#import "WKUserContentControllerPrivate.h"
</del><ins>+#import "WKUserContentController.h"
</ins><span class="cx">
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKUserContentControllerPrivateh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerPrivate.h (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerPrivate.h        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerPrivate.h        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -1,41 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <WebKit/WKUserContentController.h>
-
-#if WK_API_ENABLED
-
-@class _WKScriptWorld;
-
-@interface WKUserContentController (WKPrivate)
-
-- (void)_addScriptMessageHandler:(id <WKScriptMessageHandler>)scriptMessageHandler name:(NSString *)name world:(_WKScriptWorld *)world;
-- (void)_removeScriptMessageHandlerForName:(NSString *)name world:(_WKScriptWorld *)world;
-
-@end
-
-#endif
-
-
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -64,6 +64,8 @@
</span><span class="cx"> #import "_WKRemoteObjectRegistryInternal.h"
</span><span class="cx"> #import "_WKVisitedLinkProviderInternal.h"
</span><span class="cx"> #import "_WKWebsiteDataStoreInternal.h"
</span><ins>+#import <wtf/HashMap.h>
+#import <wtf/NeverDestroyed.h>
</ins><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="lines">@@ -104,6 +106,18 @@
</span><span class="cx"> #import <WebCore/ColorMac.h>
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+
+static HashMap<WebKit::WebPageProxy*, WKWebView *>& pageToViewMap()
+{
+ static NeverDestroyed<HashMap<WebKit::WebPageProxy*, WKWebView *>> map;
+ return map;
+}
+
+WKWebView* fromWebPageProxy(WebKit::WebPageProxy& page)
+{
+ return pageToViewMap().get(&page);
+}
+
</ins><span class="cx"> @implementation WKWebView {
</span><span class="cx"> std::unique_ptr<WebKit::NavigationState> _navigationState;
</span><span class="cx"> std::unique_ptr<WebKit::UIDelegate> _uiDelegate;
</span><span class="lines">@@ -232,6 +246,8 @@
</span><span class="cx">
</span><span class="cx"> _page->setFindClient(std::make_unique<WebKit::FindClient>(self));
</span><span class="cx">
</span><ins>+ pageToViewMap().add(_page.get(), self);
+
</ins><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -245,6 +261,8 @@
</span><span class="cx"> [[NSNotificationCenter defaultCenter] removeObserver:self];
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ pageToViewMap().remove(_page.get());
+
</ins><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -80,4 +80,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+WKWebView* fromWebPageProxy(WebKit::WebPageProxy&);
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessUserContentWebScriptMessageHandlercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.cpp (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.cpp         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.cpp        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebScriptMessageHandler.h"
+
+#include "ArgumentCoders.h"
+
+namespace WebKit {
+
+void WebScriptMessageHandlerHandle::encode(IPC::ArgumentEncoder& encoder) const
+{
+ encoder << identifier;
+ encoder << name;
+}
+
+bool WebScriptMessageHandlerHandle::decode(IPC::ArgumentDecoder& decoder, WebScriptMessageHandlerHandle& handle)
+{
+ if (!decoder.decode(handle.identifier))
+ return false;
+
+ if (!decoder.decode(handle.name))
+ return false;
+
+ return true;
+}
+
+static uint64_t generateIdentifier()
+{
+ static uint64_t identifier;
+
+ return ++identifier;
+}
+
+PassRefPtr<WebScriptMessageHandler> WebScriptMessageHandler::create(std::unique_ptr<Client> client, const String& name)
+{
+ return adoptRef(new WebScriptMessageHandler(std::move(client), name));
+}
+
+WebScriptMessageHandler::WebScriptMessageHandler(std::unique_ptr<Client> client, const String& name)
+ : m_identifier(generateIdentifier())
+ , m_client(std::move(client))
+ , m_name(name)
+{
+}
+
+WebScriptMessageHandler::~WebScriptMessageHandler()
+{
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessUserContentWebScriptMessageHandlerh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.h (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.h         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.h        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebScriptMessageHandler_h
+#define WebScriptMessageHandler_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace IPC {
+class ArgumentDecoder;
+class ArgumentEncoder;
+}
+
+namespace WebCore {
+class SerializedScriptValue;
+}
+
+namespace WebKit {
+
+class WebPageProxy;
+class WebFrameProxy;
+
+struct WebScriptMessageHandlerHandle {
+ void encode(IPC::ArgumentEncoder&) const;
+ static bool decode(IPC::ArgumentDecoder&, WebScriptMessageHandlerHandle&);
+
+ uint64_t identifier;
+ String name;
+};
+
+class WebScriptMessageHandler : public RefCounted<WebScriptMessageHandler> {
+public:
+ class Client {
+ public:
+ virtual ~Client() { }
+ virtual void didPostMessage(WebPageProxy&, WebFrameProxy&, WebCore::SerializedScriptValue&) = 0;
+ };
+
+ static PassRefPtr<WebScriptMessageHandler> create(std::unique_ptr<Client>, const String& name);
+ virtual ~WebScriptMessageHandler();
+
+ WebScriptMessageHandlerHandle handle() { return { m_identifier, m_name }; }
+
+ uint64_t identifier() const { return m_identifier; }
+ String name() const { return m_name; }
+
+ Client& client() const { return *m_client; }
+
+private:
+ WebScriptMessageHandler(std::unique_ptr<Client>, const String&);
+
+ uint64_t m_identifier;
+
+ std::unique_ptr<Client> m_client;
+ String m_name;
+};
+
+} // namespace API
+
+#endif // WebScriptMessageHandler_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -26,8 +26,12 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "WebUserContentControllerProxy.h"
</span><span class="cx">
</span><ins>+#include "DataReference.h"
</ins><span class="cx"> #include "WebProcessProxy.h"
</span><ins>+#include "WebScriptMessageHandler.h"
</ins><span class="cx"> #include "WebUserContentControllerMessages.h"
</span><ins>+#include "WebUserContentControllerProxyMessages.h"
+#include <WebCore/SerializedScriptValue.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><span class="lines">@@ -59,14 +63,22 @@
</span><span class="cx"> if (!m_processes.add(&webProcessProxy).isNewEntry)
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ webProcessProxy.addMessageReceiver(Messages::WebUserContentControllerProxy::messageReceiverName(), m_identifier, *this);
+
</ins><span class="cx"> webProcessProxy.connection()->send(Messages::WebUserContentController::AddUserScripts(m_userScripts), m_identifier);
</span><ins>+
+ Vector<WebScriptMessageHandlerHandle> messageHandlerHandles;
+ for (auto& handler : m_scriptMessageHandlers.values())
+ messageHandlerHandles.append(handler->handle());
+ webProcessProxy.connection()->send(Messages::WebUserContentController::AddUserScriptMessageHandlers(messageHandlerHandles), m_identifier);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebUserContentControllerProxy::removeProcess(WebProcessProxy& webProcessProxy)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_processes.contains(&webProcessProxy));
</span><span class="cx">
</span><del>- m_processes.remove(&webProcessProxy);
</del><ins>+ if (m_processes.remove(&webProcessProxy))
+ webProcessProxy.removeMessageReceiver(Messages::WebUserContentControllerProxy::messageReceiverName(), m_identifier);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebUserContentControllerProxy::addUserScript(WebCore::UserScript userScript)
</span><span class="lines">@@ -85,4 +97,55 @@
</span><span class="cx"> processAndCount.key->connection()->send(Messages::WebUserContentController::RemoveAllUserScripts(), m_identifier);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool WebUserContentControllerProxy::addUserScriptMessageHandler(WebScriptMessageHandler* handler)
+{
+ for (auto& existingHandler : m_scriptMessageHandlers.values()) {
+ if (existingHandler->name() == handler->name())
+ return false;
+ }
+
+ m_scriptMessageHandlers.add(handler->identifier(), handler);
+
+ for (auto& processAndCount : m_processes)
+ processAndCount.key->connection()->send(Messages::WebUserContentController::AddUserScriptMessageHandlers({ handler->handle() }), m_identifier);
+
+ return true;
+}
+
+void WebUserContentControllerProxy::removeUserMessageHandlerForName(const String& name)
+{
+ for (auto it = m_scriptMessageHandlers.begin(), end = m_scriptMessageHandlers.end(); it != end; ++it) {
+ if (it->value->name() == name) {
+ for (auto& processAndCount : m_processes)
+ processAndCount.key->connection()->send(Messages::WebUserContentController::RemoveUserScriptMessageHandler(it->value->identifier()), m_identifier);
+ m_scriptMessageHandlers.remove(it);
+ return;
+ }
+ }
+}
+
+void WebUserContentControllerProxy::didPostMessage(IPC::Connection* connection, uint64_t pageID, uint64_t frameID, uint64_t messageHandlerID, const IPC::DataReference& dataReference)
+{
+ WebPageProxy* page = WebProcessProxy::webPage(pageID);
+ if (!page)
+ return;
+
+ WebProcessProxy* webProcess = WebProcessProxy::fromConnection(connection);
+ WebFrameProxy* frame = webProcess->webFrame(frameID);
+ if (!frame)
+ return;
+
+ if (!HashMap<uint64_t, RefPtr<WebScriptMessageHandler>>::isValidKey(messageHandlerID))
+ return;
+
+ RefPtr<WebScriptMessageHandler> handler = m_scriptMessageHandlers.get(messageHandlerID);
+ if (!handler)
+ return;
+
+ auto buffer = dataReference.vector();
+ RefPtr<WebCore::SerializedScriptValue> value = WebCore::SerializedScriptValue::adopt(buffer);
+
+ handler->client().didPostMessage(*page, *frame, *value);
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -26,10 +26,17 @@
</span><span class="cx"> #ifndef WebUserContentControllerProxy_h
</span><span class="cx"> #define WebUserContentControllerProxy_h
</span><span class="cx">
</span><ins>+#include "MessageReceiver.h"
+#include <wtf/Forward.h>
</ins><span class="cx"> #include <wtf/HashCountedSet.h>
</span><ins>+#include <wtf/HashMap.h>
</ins><span class="cx"> #include <wtf/PassRefPtr.h>
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx">
</span><ins>+namespace IPC {
+class DataReference;
+}
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> class UserScript;
</span><span class="cx"> }
</span><span class="lines">@@ -37,8 +44,9 @@
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><span class="cx"> class WebProcessProxy;
</span><ins>+class WebScriptMessageHandler;
</ins><span class="cx">
</span><del>-class WebUserContentControllerProxy : public RefCounted<WebUserContentControllerProxy> {
</del><ins>+class WebUserContentControllerProxy : public RefCounted<WebUserContentControllerProxy>, private IPC::MessageReceiver {
</ins><span class="cx"> public:
</span><span class="cx"> static PassRefPtr<WebUserContentControllerProxy> create();
</span><span class="cx"> ~WebUserContentControllerProxy();
</span><span class="lines">@@ -51,13 +59,23 @@
</span><span class="cx"> void addUserScript(WebCore::UserScript);
</span><span class="cx"> void removeAllUserScripts();
</span><span class="cx">
</span><ins>+ // Returns false if there was a name conflict.
+ bool addUserScriptMessageHandler(WebScriptMessageHandler*);
+ void removeUserMessageHandlerForName(const String&);
+
</ins><span class="cx"> private:
</span><span class="cx"> explicit WebUserContentControllerProxy();
</span><span class="cx">
</span><ins>+ // IPC::MessageReceiver.
+ virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override;
+
+ void didPostMessage(IPC::Connection*, uint64_t pageID, uint64_t frameID, uint64_t messageHandlerID, const IPC::DataReference&);
+
</ins><span class="cx"> uint64_t m_identifier;
</span><span class="cx"> HashCountedSet<WebProcessProxy*> m_processes;
</span><span class="cx">
</span><span class="cx"> Vector<WebCore::UserScript> m_userScripts;
</span><ins>+ HashMap<uint64_t, RefPtr<WebScriptMessageHandler>> m_scriptMessageHandlers;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxymessagesin"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.messages.in (0 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.messages.in         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.messages.in        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+messages -> WebUserContentControllerProxy {
+ DidPostMessage(uint64_t pageID, uint64_t frameID, uint64_t messageHandlerID, IPC::DataReference message) WantsConnection
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -989,6 +989,10 @@
</span><span class="cx">                 7C135AA8173B0BCA00586AE2 /* WKPluginInformation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C135AA6173B0BCA00586AE2 /* WKPluginInformation.cpp */; };
</span><span class="cx">                 7C135AA9173B0BCA00586AE2 /* WKPluginInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C135AA7173B0BCA00586AE2 /* WKPluginInformation.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 7C135AAC173B0CFF00586AE2 /* PluginInformationMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C135AAA173B0CFF00586AE2 /* PluginInformationMac.mm */; };
</span><ins>+                7C361D721927FA360036A59D /* WebScriptMessageHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C361D6F1927FA360036A59D /* WebScriptMessageHandler.cpp */; };
+                7C361D731927FA360036A59D /* WebScriptMessageHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C361D701927FA360036A59D /* WebScriptMessageHandler.h */; };
+                7C361D78192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C361D76192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp */; };
+                7C361D79192803BD0036A59D /* WebUserContentControllerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C361D77192803BD0036A59D /* WebUserContentControllerProxyMessages.h */; };
</ins><span class="cx">                 7C387434172F5615001BD88A /* PageBanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C387433172F5615001BD88A /* PageBanner.cpp */; };
</span><span class="cx">                 7C3F8C90173AF52D007B7F39 /* PluginInformation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */; };
</span><span class="cx">                 7C3F8C91173AF52D007B7F39 /* PluginInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */; };
</span><span class="lines">@@ -1003,8 +1007,7 @@
</span><span class="cx">                 7CB16FF21724BA28007A0A95 /* com.macromedia.Flash Player.plugin.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 7CB16FE51724B9B5007A0A95 /* com.macromedia.Flash Player.plugin.sb */; };
</span><span class="cx">                 7CB16FF31724BA2F007A0A95 /* com.microsoft.SilverlightPlugin.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 7CB16FE61724B9B5007A0A95 /* com.microsoft.SilverlightPlugin.sb */; };
</span><span class="cx">                 7CB16FF41724BA30007A0A95 /* com.oracle.java.JavaAppletPlugin.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 7CB16FE71724B9B5007A0A95 /* com.oracle.java.JavaAppletPlugin.sb */; };
</span><del>-                7CC99A3418EF7B120048C8B4 /* WKUserContentControllerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC99A3318EF7B120048C8B4 /* WKUserContentControllerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
-                7CC99A3618EF7CBC0048C8B4 /* WKScriptMessagePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC99A3518EF7CBC0048C8B4 /* WKScriptMessagePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><ins>+                7CC99A3618EF7CBC0048C8B4 /* WKScriptMessageInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC99A3518EF7CBC0048C8B4 /* WKScriptMessageInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 7CD102DA1866770600ED429D /* AutoCorrectionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD102D91866770600ED429D /* AutoCorrectionCallback.h */; };
</span><span class="cx">                 7CD5EBB81746A15B000C1C45 /* WKObjCTypeWrapperRef.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CD5EBB61746A15B000C1C45 /* WKObjCTypeWrapperRef.mm */; };
</span><span class="cx">                 7CD5EBB91746A15B000C1C45 /* WKObjCTypeWrapperRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD5EBB71746A15B000C1C45 /* WKObjCTypeWrapperRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -2975,6 +2978,11 @@
</span><span class="cx">                 7C135AA6173B0BCA00586AE2 /* WKPluginInformation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPluginInformation.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 7C135AA7173B0BCA00586AE2 /* WKPluginInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPluginInformation.h; sourceTree = "<group>"; };
</span><span class="cx">                 7C135AAA173B0CFF00586AE2 /* PluginInformationMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginInformationMac.mm; sourceTree = "<group>"; };
</span><ins>+                7C361D6F1927FA360036A59D /* WebScriptMessageHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebScriptMessageHandler.cpp; sourceTree = "<group>"; };
+                7C361D701927FA360036A59D /* WebScriptMessageHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptMessageHandler.h; sourceTree = "<group>"; };
+                7C361D751928028B0036A59D /* WebUserContentControllerProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebUserContentControllerProxy.messages.in; sourceTree = "<group>"; };
+                7C361D76192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebUserContentControllerProxyMessageReceiver.cpp; sourceTree = "<group>"; };
+                7C361D77192803BD0036A59D /* WebUserContentControllerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebUserContentControllerProxyMessages.h; sourceTree = "<group>"; };
</ins><span class="cx">                 7C387433172F5615001BD88A /* PageBanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageBanner.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInformation.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInformation.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -2989,8 +2997,7 @@
</span><span class="cx">                 7CB16FE51724B9B5007A0A95 /* com.macromedia.Flash Player.plugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "com.macromedia.Flash Player.plugin.sb"; sourceTree = "<group>"; };
</span><span class="cx">                 7CB16FE61724B9B5007A0A95 /* com.microsoft.SilverlightPlugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.microsoft.SilverlightPlugin.sb; sourceTree = "<group>"; };
</span><span class="cx">                 7CB16FE71724B9B5007A0A95 /* com.oracle.java.JavaAppletPlugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.oracle.java.JavaAppletPlugin.sb; sourceTree = "<group>"; };
</span><del>-                7CC99A3318EF7B120048C8B4 /* WKUserContentControllerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentControllerPrivate.h; sourceTree = "<group>"; };
-                7CC99A3518EF7CBC0048C8B4 /* WKScriptMessagePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKScriptMessagePrivate.h; sourceTree = "<group>"; };
</del><ins>+                7CC99A3518EF7CBC0048C8B4 /* WKScriptMessageInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKScriptMessageInternal.h; sourceTree = "<group>"; };
</ins><span class="cx">                 7CD102D91866770600ED429D /* AutoCorrectionCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoCorrectionCallback.h; sourceTree = "<group>"; };
</span><span class="cx">                 7CD5EBB61746A15B000C1C45 /* WKObjCTypeWrapperRef.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKObjCTypeWrapperRef.mm; sourceTree = "<group>"; };
</span><span class="cx">                 7CD5EBB71746A15B000C1C45 /* WKObjCTypeWrapperRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKObjCTypeWrapperRef.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -4423,8 +4430,11 @@
</span><span class="cx">                 1AAF089E192681AC00B6390C /* UserContent */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                7C361D6F1927FA360036A59D /* WebScriptMessageHandler.cpp */,
+                                7C361D701927FA360036A59D /* WebScriptMessageHandler.h */,
</ins><span class="cx">                                 1AAF089F192681D100B6390C /* WebUserContentControllerProxy.cpp */,
</span><span class="cx">                                 1AAF08A0192681D100B6390C /* WebUserContentControllerProxy.h */,
</span><ins>+                                7C361D751928028B0036A59D /* WebUserContentControllerProxy.messages.in */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = UserContent;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -4899,13 +4909,12 @@
</span><span class="cx">                                 1A7E377718E4A4FE003D0FFF /* WKScriptMessage.h */,
</span><span class="cx">                                 1A7E377618E4A4FE003D0FFF /* WKScriptMessage.mm */,
</span><span class="cx">                                 1A7E377418E4A33A003D0FFF /* WKScriptMessageHandler.h */,
</span><del>-                                7CC99A3518EF7CBC0048C8B4 /* WKScriptMessagePrivate.h */,
</del><ins>+                                7CC99A3518EF7CBC0048C8B4 /* WKScriptMessageInternal.h */,
</ins><span class="cx">                                 1AD8790918B6C38A006CAFD7 /* WKUIDelegate.h */,
</span><span class="cx">                                 3743925718BC4C60001C8675 /* WKUIDelegatePrivate.h */,
</span><span class="cx">                                 1AFA3AC718E61C61003CCBAE /* WKUserContentController.h */,
</span><span class="cx">                                 1AFA3AC618E61C61003CCBAE /* WKUserContentController.mm */,
</span><span class="cx">                                 1AAF08A3192682DA00B6390C /* WKUserContentControllerInternal.h */,
</span><del>-                                7CC99A3318EF7B120048C8B4 /* WKUserContentControllerPrivate.h */,
</del><span class="cx">                                 1AAF089919267EE500B6390C /* WKUserScript.h */,
</span><span class="cx">                                 1AAF089819267EE500B6390C /* WKUserScript.mm */,
</span><span class="cx">                                 1AAF089C19267FC800B6390C /* WKUserScriptInternal.h */,
</span><span class="lines">@@ -6553,10 +6562,6 @@
</span><span class="cx">                 C0CE729D1247E71D00BC0EC4 /* Derived Sources */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                1AAF08B519269E6D00B6390C /* WebUserContentControllerMessageReceiver.cpp */,
-                                1AAF08B619269E6D00B6390C /* WebUserContentControllerMessages.h */,
-                                2DE6943B18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp */,
-                                2DE6943C18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h */,
</del><span class="cx">                                 512F58A012A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp */,
</span><span class="cx">                                 512F58A112A883AD00629530 /* AuthenticationManagerMessages.h */,
</span><span class="cx">                                 E115C715190F8A2500ECC516 /* com.apple.WebKit.Databases.sb */,
</span><span class="lines">@@ -6616,6 +6621,8 @@
</span><span class="cx">                                 E18E6912169B667B009B6670 /* SecItemShimMessages.h */,
</span><span class="cx">                                 E18E6913169B667B009B6670 /* SecItemShimProxyMessageReceiver.cpp */,
</span><span class="cx">                                 E18E6914169B667B009B6670 /* SecItemShimProxyMessages.h */,
</span><ins>+                                2DE6943B18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp */,
+                                2DE6943C18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h */,
</ins><span class="cx">                                 1A334DEB16DE8F88006A8E38 /* StorageAreaMapMessageReceiver.cpp */,
</span><span class="cx">                                 1A334DEC16DE8F88006A8E38 /* StorageAreaMapMessages.h */,
</span><span class="cx">                                 1AB31A9416BC688100F6DBC9 /* StorageManagerMessageReceiver.cpp */,
</span><span class="lines">@@ -6692,6 +6699,10 @@
</span><span class="cx">                                 33367654130C9ECA006C9DE2 /* WebResourceCacheManagerProxyMessages.h */,
</span><span class="cx">                                 51F060DD1654317500F3281B /* WebResourceLoaderMessageReceiver.cpp */,
</span><span class="cx">                                 51F060DE1654317500F3281B /* WebResourceLoaderMessages.h */,
</span><ins>+                                1AAF08B519269E6D00B6390C /* WebUserContentControllerMessageReceiver.cpp */,
+                                1AAF08B619269E6D00B6390C /* WebUserContentControllerMessages.h */,
+                                7C361D76192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp */,
+                                7C361D77192803BD0036A59D /* WebUserContentControllerProxyMessages.h */,
</ins><span class="cx">                                 3F418EF51887BD97002795FD /* WebVideoFullscreenManagerMessageReceiver.cpp */,
</span><span class="cx">                                 3F418EF61887BD97002795FD /* WebVideoFullscreenManagerMessages.h */,
</span><span class="cx">                                 3F418EF71887BD97002795FD /* WebVideoFullscreenManagerProxyMessageReceiver.cpp */,
</span><span class="lines">@@ -6971,6 +6982,7 @@
</span><span class="cx">                                 BCE81D8D1319F7EF00241910 /* FontInfo.h in Headers */,
</span><span class="cx">                                 1ABC3DFC1899F51C004F0626 /* WKNavigationDelegate.h in Headers */,
</span><span class="cx">                                 1AE52F9219201DA700A1FA37 /* APIContextConfiguration.h in Headers */,
</span><ins>+                                7C361D731927FA360036A59D /* WebScriptMessageHandler.h in Headers */,
</ins><span class="cx">                                 E105FE5418D7B9DE008F57A8 /* EditingRange.h in Headers */,
</span><span class="cx">                                 2D140EB018F37BE0005E75A0 /* PageOverlayController.h in Headers */,
</span><span class="cx">                                 BC17753F118BABF0007D9E9A /* GenericCallback.h in Headers */,
</span><span class="lines">@@ -7034,7 +7046,7 @@
</span><span class="cx">                                 1A2328FF162C866A00D82F7A /* MessageEncoder.h in Headers */,
</span><span class="cx">                                 1AC4C82916B876A90069DCCD /* MessageFlags.h in Headers */,
</span><span class="cx">                                 1AE00D6C18327C1200087DD7 /* StringReference.h in Headers */,
</span><del>-                                7CC99A3618EF7CBC0048C8B4 /* WKScriptMessagePrivate.h in Headers */,
</del><ins>+                                7CC99A3618EF7CBC0048C8B4 /* WKScriptMessageInternal.h in Headers */,
</ins><span class="cx">                                 1A3EED12161A53D600AEB4F5 /* MessageReceiver.h in Headers */,
</span><span class="cx">                                 1A3EED0F161A535400AEB4F5 /* MessageReceiverMap.h in Headers */,
</span><span class="cx">                                 C0E3AA7C1209E83C00A49D01 /* Module.h in Headers */,
</span><span class="lines">@@ -7418,7 +7430,6 @@
</span><span class="cx">                                 BCE2315D122C30CA00D5C35A /* APIURLRequest.h in Headers */,
</span><span class="cx">                                 BC90A1D2122DD55E00CC8C50 /* APIURLResponse.h in Headers */,
</span><span class="cx">                                 F6113E25126CE1820057D0A7 /* WebUserContentURLPattern.h in Headers */,
</span><del>-                                7CC99A3418EF7B120048C8B4 /* WKUserContentControllerPrivate.h in Headers */,
</del><span class="cx">                                 29CD55AA128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h in Headers */,
</span><span class="cx">                                 BCDDB32D124EC2E10048D13C /* WKAPICast.h in Headers */,
</span><span class="cx">                                 512E34E5130B4D0500ABD19A /* WKApplicationCacheManager.h in Headers */,
</span><span class="lines">@@ -7557,6 +7568,7 @@
</span><span class="cx">                                 BC7B633712A45ABA00D174A4 /* WKPageGroup.h in Headers */,
</span><span class="cx">                                 BC2D021912AC426C00E732A3 /* WKPageLoadTypes.h in Headers */,
</span><span class="cx">                                 93BDEB01171DD7AF00BFEE1B /* WKPageLoadTypesPrivate.h in Headers */,
</span><ins>+                                7C361D79192803BD0036A59D /* WebUserContentControllerProxyMessages.h in Headers */,
</ins><span class="cx">                                 BC177465118B9FF4007D9E9A /* WKPagePrivate.h in Headers */,
</span><span class="cx">                                 BCE17B7E1381F1170012A641 /* WKPagePrivateMac.h in Headers */,
</span><span class="cx">                                 A5EFD38C16B0E88C00B2F0E8 /* WKPageVisibilityTypes.h in Headers */,
</span><span class="lines">@@ -8659,6 +8671,7 @@
</span><span class="cx">                                 1A6FBD2911E69BC200DB1371 /* NetscapePlugin.cpp in Sources */,
</span><span class="cx">                                 00B9661918E25AE100CE1F88 /* FindClient.mm in Sources */,
</span><span class="cx">                                 1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.mm in Sources */,
</span><ins>+                                7C361D721927FA360036A59D /* WebScriptMessageHandler.cpp in Sources */,
</ins><span class="cx">                                 1A4A9C5512B816CF008FE984 /* NetscapePluginModule.cpp in Sources */,
</span><span class="cx">                                 1A4A9C9A12B821CD008FE984 /* NetscapePluginModuleMac.mm in Sources */,
</span><span class="cx">                                 1AA5889311EE70400061B882 /* NetscapePluginStream.cpp in Sources */,
</span><span class="lines">@@ -8861,6 +8874,7 @@
</span><span class="cx">                                 51871B5B127CB89D00F76232 /* WebContextMenu.cpp in Sources */,
</span><span class="cx">                                 BC111A5B112F4FBB00337BAB /* WebContextMenuClient.cpp in Sources */,
</span><span class="cx">                                 51021E9C12B16788005C033C /* WebContextMenuClientMac.mm in Sources */,
</span><ins>+                                7C361D78192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp in Sources */,
</ins><span class="cx">                                 512935D71288D19400A4B695 /* WebContextMenuItem.cpp in Sources */,
</span><span class="cx">                                 29232DF918B2AB3A00D0596F /* WKAccessibilityWebPageObjectMac.mm in Sources */,
</span><span class="cx">                                 510FBB9A1288C95E00AFFDF4 /* WebContextMenuItemData.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessUserContentWebUserContentControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -26,12 +26,22 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "WebUserContentController.h"
</span><span class="cx">
</span><ins>+#include "DataReference.h"
+#include "WebFrame.h"
+#include "WebPage.h"
</ins><span class="cx"> #include "WebProcess.h"
</span><span class="cx"> #include "WebUserContentControllerMessages.h"
</span><ins>+#include "WebUserContentControllerProxyMessages.h"
</ins><span class="cx"> #include <WebCore/DOMWrapperWorld.h>
</span><span class="cx"> #include <WebCore/ScriptController.h>
</span><ins>+#include <WebCore/SerializedScriptValue.h>
</ins><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx">
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+#include <WebCore/UserMessageHandler.h>
+#include <WebCore/UserMessageHandlerDescriptor.h>
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -82,4 +92,74 @@
</span><span class="cx"> m_userContentController->removeUserScripts(mainThreadNormalWorld());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+class WebUserMessageHandlerDescriptorProxy : public RefCounted<WebUserMessageHandlerDescriptorProxy>, public WebCore::UserMessageHandlerDescriptor::Client {
+public:
+ static PassRefPtr<WebUserMessageHandlerDescriptorProxy> create(WebUserContentController* controller, const String& name, uint64_t identifier)
+ {
+ return adoptRef(new WebUserMessageHandlerDescriptorProxy(controller, name, identifier));
+ }
+
+ virtual ~WebUserMessageHandlerDescriptorProxy()
+ {
+ }
+
+ // WebCore::UserMessageHandlerDescriptor::Client
+ virtual void didPostMessage(WebCore::UserMessageHandler& handler, WebCore::SerializedScriptValue* value)
+ {
+ WebCore::Frame* frame = handler.frame();
+ if (!frame)
+ return;
+
+ WebFrame* webFrame = WebFrame::fromCoreFrame(*frame);
+ if (!webFrame)
+ return;
+
+ WebPage* webPage = webFrame->page();
+ if (!webPage)
+ return;
+
+ WebProcess::shared().parentProcessConnection()->send(Messages::WebUserContentControllerProxy::DidPostMessage(webPage->pageID(), webFrame->frameID(), m_identifier, IPC::DataReference(value->data())), m_controller->identifier());
+ }
+
+ WebCore::UserMessageHandlerDescriptor& descriptor() { return *m_descriptor; }
+ uint64_t identifier() { return m_identifier; }
+
+private:
+ WebUserMessageHandlerDescriptorProxy(WebUserContentController* controller, const String& name, uint64_t identifier)
+ : m_controller(controller)
+ , m_descriptor(UserMessageHandlerDescriptor::create(name, mainThreadNormalWorld(), *this))
+ , m_identifier(identifier)
+ {
+ }
+
+ RefPtr<WebUserContentController> m_controller;
+ RefPtr<WebCore::UserMessageHandlerDescriptor> m_descriptor;
+ uint64_t m_identifier;
+};
+#endif
+
+void WebUserContentController::addUserScriptMessageHandlers(const Vector<WebScriptMessageHandlerHandle>& scriptMessageHandlers)
+{
+#if ENABLE(USER_MESSAGE_HANDLERS)
+ for (auto& handle : scriptMessageHandlers) {
+ RefPtr<WebUserMessageHandlerDescriptorProxy> descriptor = WebUserMessageHandlerDescriptorProxy::create(this, handle.name, handle.identifier);
+
+ m_userMessageHandlerDescriptors.add(descriptor->identifier(), descriptor);
+ m_userContentController->addUserMessageHandlerDescriptor(descriptor->descriptor());
+ }
+#endif
+}
+
+void WebUserContentController::removeUserScriptMessageHandler(uint64_t identifier)
+{
+#if ENABLE(USER_MESSAGE_HANDLERS)
+ auto it = m_userMessageHandlerDescriptors.find(identifier);
+ ASSERT(it != m_userMessageHandlerDescriptors.end());
+
+ m_userContentController->removeUserMessageHandlerDescriptor(it->value->descriptor());
+ m_userMessageHandlerDescriptors.remove(it);
+#endif
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessUserContentWebUserContentControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -27,11 +27,15 @@
</span><span class="cx"> #define WebUserContentController_h
</span><span class="cx">
</span><span class="cx"> #include "MessageReceiver.h"
</span><ins>+#include "WebScriptMessageHandler.h"
</ins><span class="cx"> #include <WebCore/UserContentController.h>
</span><ins>+#include <wtf/HashMap.h>
</ins><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><ins>+class WebUserMessageHandlerDescriptorProxy;
+
</ins><span class="cx"> class WebUserContentController final : public RefCounted<WebUserContentController>, private IPC::MessageReceiver {
</span><span class="cx"> public:
</span><span class="cx"> static PassRefPtr<WebUserContentController> getOrCreate(uint64_t identifier);
</span><span class="lines">@@ -39,6 +43,8 @@
</span><span class="cx">
</span><span class="cx"> WebCore::UserContentController& userContentController() { return m_userContentController.get(); }
</span><span class="cx">
</span><ins>+ uint64_t identifier() { return m_identifier; }
+
</ins><span class="cx"> private:
</span><span class="cx"> explicit WebUserContentController(uint64_t identifier);
</span><span class="cx">
</span><span class="lines">@@ -48,8 +54,14 @@
</span><span class="cx"> void addUserScripts(const Vector<WebCore::UserScript>& userScripts);
</span><span class="cx"> void removeAllUserScripts();
</span><span class="cx">
</span><ins>+ void addUserScriptMessageHandlers(const Vector<WebScriptMessageHandlerHandle>& scriptMessageHandlers);
+ void removeUserScriptMessageHandler(uint64_t);
+
</ins><span class="cx"> uint64_t m_identifier;
</span><span class="cx"> Ref<WebCore::UserContentController> m_userContentController;
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+ HashMap<uint64_t, RefPtr<WebUserMessageHandlerDescriptorProxy>> m_userMessageHandlerDescriptors;
+#endif
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessUserContentWebUserContentControllermessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in (169022 => 169023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in        2014-05-18 23:10:37 UTC (rev 169022)
+++ trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in        2014-05-18 23:12:37 UTC (rev 169023)
</span><span class="lines">@@ -26,4 +26,7 @@
</span><span class="cx"> messages -> WebUserContentController {
</span><span class="cx"> AddUserScripts(Vector<WebCore::UserScript> userScripts);
</span><span class="cx"> RemoveAllUserScripts()
</span><ins>+
+ AddUserScriptMessageHandlers(Vector<WebKit::WebScriptMessageHandlerHandle> scriptMessageHandlers);
+ RemoveUserScriptMessageHandler(uint64_t identifier)
</ins><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>