<!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>[169072] branches/safari-538.34-branch/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/169072">169072</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2014-05-19 14:57:03 -0700 (Mon, 19 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/169023">r169023</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari53834branchSourceWTFwtfPlatformh">branches/safari-538.34-branch/Source/WTF/wtf/Platform.h</a></li>
<li><a href="#branchessafari53834branchSourceWebCoreChangeLog">branches/safari-538.34-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari53834branchSourceWebCoreDerivedSourcesmake">branches/safari-538.34-branch/Source/WebCore/DerivedSources.make</a></li>
<li><a href="#branchessafari53834branchSourceWebCoreWebCoreexpin">branches/safari-538.34-branch/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#branchessafari53834branchSourceWebCoreWebCorexcodeprojprojectpbxproj">branches/safari-538.34-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#branchessafari53834branchSourceWebCorebindingsjsJSDOMWindowBasecpp">branches/safari-538.34-branch/Source/WebCore/bindings/js/JSDOMWindowBase.cpp</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepageDOMWindowcpp">branches/safari-538.34-branch/Source/WebCore/page/DOMWindow.cpp</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepageDOMWindowh">branches/safari-538.34-branch/Source/WebCore/page/DOMWindow.h</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepageUserContentControllercpp">branches/safari-538.34-branch/Source/WebCore/page/UserContentController.cpp</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepageUserContentControllerh">branches/safari-538.34-branch/Source/WebCore/page/UserContentController.h</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2ChangeLog">branches/safari-538.34-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2DerivedSourcesmake">branches/safari-538.34-branch/Source/WebKit2/DerivedSources.make</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2Scriptswebkit2messagespy">branches/safari-538.34-branch/Source/WebKit2/Scripts/webkit2/messages.py</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2UIProcessAPICocoaWKScriptMessagemm">branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessage.mm</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2UIProcessAPICocoaWKUserContentControllermm">branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2UIProcessAPICocoaWKUserContentControllerInternalh">branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerInternal.h</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2UIProcessAPICocoaWKWebViewmm">branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2UIProcessAPICocoaWKWebViewInternalh">branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2UIProcessUserContentWebUserContentControllerProxycpp">branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2UIProcessUserContentWebUserContentControllerProxyh">branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2WebKit2xcodeprojprojectpbxproj">branches/safari-538.34-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2WebProcessUserContentWebUserContentControllercpp">branches/safari-538.34-branch/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2WebProcessUserContentWebUserContentControllerh">branches/safari-538.34-branch/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2WebProcessUserContentWebUserContentControllermessagesin">branches/safari-538.34-branch/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari53834branchSourceWebCorebindingsjsJSUserMessageHandlersNamespaceCustomcpp">branches/safari-538.34-branch/Source/WebCore/bindings/js/JSUserMessageHandlersNamespaceCustom.cpp</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepageUserMessageHandlercpp">branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandler.cpp</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepageUserMessageHandlerh">branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandler.h</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepageUserMessageHandleridl">branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandler.idl</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepageUserMessageHandlerDescriptorcpp">branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlerDescriptor.cpp</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepageUserMessageHandlerDescriptorh">branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlerDescriptor.h</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepageUserMessageHandlerDescriptorTypesh">branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlerDescriptorTypes.h</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepageUserMessageHandlersNamespacecpp">branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlersNamespace.cpp</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepageUserMessageHandlersNamespaceh">branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlersNamespace.h</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepageUserMessageHandlersNamespaceidl">branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlersNamespace.idl</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepageWebKitNamespacecpp">branches/safari-538.34-branch/Source/WebCore/page/WebKitNamespace.cpp</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepageWebKitNamespaceh">branches/safari-538.34-branch/Source/WebCore/page/WebKitNamespace.h</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepageWebKitNamespaceidl">branches/safari-538.34-branch/Source/WebCore/page/WebKitNamespace.idl</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2UIProcessAPICocoaWKScriptMessageInternalh">branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessageInternal.h</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2UIProcessUserContentWebScriptMessageHandlercpp">branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.cpp</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2UIProcessUserContentWebScriptMessageHandlerh">branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.h</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2UIProcessUserContentWebUserContentControllerProxymessagesin">branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.messages.in</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#branchessafari53834branchSourceWebKit2UIProcessAPICocoaWKScriptMessagePrivateh">branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessagePrivate.h</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2UIProcessAPICocoaWKUserContentControllerPrivateh">branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerPrivate.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari53834branchSourceWTFwtfPlatformh"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WTF/wtf/Platform.h (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WTF/wtf/Platform.h        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WTF/wtf/Platform.h        2014-05-19 21:57:03 UTC (rev 169072)
</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="branchessafari53834branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/ChangeLog (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/ChangeLog        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebCore/ChangeLog        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -1,5 +1,66 @@
</span><span class="cx"> 2014-05-19  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r169023.
+
+    2014-05-18  Sam Weinig  &lt;sam@webkit.org&gt;
+
+            [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.
+
+2014-05-19  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r169015.
</span><span class="cx"> 
</span><span class="cx">     2014-05-18  Anders Carlsson  &lt;andersca@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/DerivedSources.make (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/DerivedSources.make        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebCore/DerivedSources.make        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -479,6 +479,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="branchessafari53834branchSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/WebCore.exp.in (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/WebCore.exp.in        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebCore/WebCore.exp.in        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -894,6 +894,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">@@ -1003,6 +1005,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="branchessafari53834branchSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -2334,12 +2334,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">@@ -2348,7 +2359,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">@@ -9387,8 +9403,13 @@
</span><span class="cx">                 7AF9B20B18CFB5F300C64BEF /* JSVTTRegionList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVTTRegionList.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C2BDD3B17C7F98B0038FF15 /* JSDOMGlobalObjectTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMGlobalObjectTask.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C2BDD3C17C7F98B0038FF15 /* JSDOMGlobalObjectTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMGlobalObjectTask.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7C3B796F1908757B00B47A2D /* UserMessageHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMessageHandler.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C3B79701908757B00B47A2D /* UserMessageHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMessageHandler.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7C3E510818DF8F3500C112F7 /* HTMLConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLConverter.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C3E510918DF8F3500C112F7 /* HTMLConverter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HTMLConverter.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7C48A6CE191C9D6500026674 /* WebKitNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitNamespace.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C48A6CF191C9D6500026674 /* WebKitNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitNamespace.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C48A6D2191C9D8E00026674 /* WebKitNamespace.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebKitNamespace.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7C522D4915B477E8009B7C95 /* InspectorOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorOverlay.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C522D4A15B478B2009B7C95 /* InspectorOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorOverlay.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C5343FA17B74B63004232F0 /* JSMediaQueryListListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaQueryListListener.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -9398,6 +9419,15 @@
</span><span class="cx">                 7C6136F71710C35200FF4A57 /* InFilesCompiler.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = InFilesCompiler.pm; path = scripts/InFilesCompiler.pm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C6136F81710C35200FF4A57 /* InFilesParser.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = InFilesParser.pm; path = scripts/InFilesParser.pm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C6136F91710C35200FF4A57 /* StaticString.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = StaticString.pm; path = scripts/StaticString.pm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7C73FB05191EF416007DE061 /* UserMessageHandlersNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMessageHandlersNamespace.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C73FB06191EF417007DE061 /* UserMessageHandlersNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMessageHandlersNamespace.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C73FB09191EF49F007DE061 /* UserMessageHandlersNamespace.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = UserMessageHandlersNamespace.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C73FB0A191EF5A8007DE061 /* JSUserMessageHandlersNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUserMessageHandlersNamespace.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C73FB0B191EF5A8007DE061 /* JSUserMessageHandlersNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSUserMessageHandlersNamespace.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C73FB0E191EF60E007DE061 /* UserMessageHandler.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = UserMessageHandler.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C73FB0F191EF6F4007DE061 /* JSUserMessageHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUserMessageHandler.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C73FB10191EF6F4007DE061 /* JSUserMessageHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSUserMessageHandler.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C73FB17191EF808007DE061 /* JSUserMessageHandlersNamespaceCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUserMessageHandlersNamespaceCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7C74D43118823A9300E5ED57 /* UTextProviderLatin1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProviderLatin1.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C74D43218823A9300E5ED57 /* UTextProviderLatin1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderLatin1.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C74D43518823B1900E5ED57 /* UTextProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProvider.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -9406,7 +9436,12 @@
</span><span class="cx">                 7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderUTF16.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CC564B618BABEA6001B9652 /* TelephoneNumberDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TelephoneNumberDetector.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CC564B918BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TelephoneNumberDetectorCocoa.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitNamespace.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7CC6993F191EC5F500AF2270 /* JSWebKitNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitNamespace.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDNScriptWhiteList.txt; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7CE68342192143A800F4D928 /* UserMessageHandlerDescriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMessageHandlerDescriptor.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7CE68343192143A800F4D928 /* UserMessageHandlerDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMessageHandlerDescriptor.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7CE683461921821500F4D928 /* UserMessageHandlerDescriptorTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMessageHandlerDescriptorTypes.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7CE6CBFA187F370700D46BF5 /* FormatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormatConverter.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CE6CBFC187F394900D46BF5 /* FormatConverter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormatConverter.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7E33CD00127F340D00BE8F17 /* PurgePriority.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurgePriority.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -16452,6 +16487,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 = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -20564,7 +20611,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">@@ -20585,6 +20631,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">@@ -20672,6 +20719,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">@@ -20799,6 +20847,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 = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -22964,6 +23018,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">@@ -23520,6 +23575,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">@@ -24456,6 +24512,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">@@ -24623,6 +24680,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">@@ -24941,6 +24999,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">@@ -25165,6 +25224,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">@@ -25175,6 +25235,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">@@ -26295,6 +26356,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">@@ -27192,6 +27254,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">@@ -27967,6 +28030,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">@@ -28469,6 +28533,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">@@ -28515,6 +28580,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">@@ -28669,6 +28735,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">@@ -29103,6 +29170,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">@@ -29313,6 +29381,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">@@ -29493,6 +29562,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="branchessafari53834branchSourceWebCorebindingsjsJSDOMWindowBasecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/bindings/js/JSDOMWindowBase.cpp        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebCore/bindings/js/JSDOMWindowBase.cpp        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -39,6 +39,10 @@
</span><span class="cx"> #include &lt;runtime/Microtask.h&gt;
</span><span class="cx"> #include &lt;wtf/MainThread.h&gt;
</span><span class="cx"> 
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+#include &quot;JSWebKitNamespace.h&quot;
+#endif
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> #include &quot;ChromeClient.h&quot;
</span><span class="cx"> #include &quot;WebSafeGCActivityCallbackIOS.h&quot;
</span><span class="lines">@@ -76,6 +80,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-&gt;shouldHaveWebKitNamespaceForWorld(world()))
+        putDirect(vm, Identifier(&amp;vm, &quot;webkit&quot;), toJS(globalExec(), this, m_impl-&gt;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="branchessafari53834branchSourceWebCorebindingsjsJSUserMessageHandlersNamespaceCustomcppfromrev169023trunkSourceWebCorebindingsjsJSUserMessageHandlersNamespaceCustomcpp"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebCore/bindings/js/JSUserMessageHandlersNamespaceCustom.cpp (from rev 169023, trunk/Source/WebCore/bindings/js/JSUserMessageHandlersNamespaceCustom.cpp) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/bindings/js/JSUserMessageHandlersNamespaceCustom.cpp                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebCore/bindings/js/JSUserMessageHandlersNamespaceCustom.cpp        2014-05-19 21:57:03 UTC (rev 169072)
</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 &quot;config.h&quot;
+#include &quot;JSUserMessageHandlersNamespace.h&quot;
+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+
+#include &quot;JSUserMessageHandler.h&quot;
+
+using namespace JSC;
+
+namespace WebCore {
+
+bool JSUserMessageHandlersNamespace::getOwnPropertySlotDelegate(ExecState* exec, PropertyName propertyName, PropertySlot&amp; slot)
+{
+    if (UserMessageHandler* handler = impl().handler(propertyNameToAtomicString(propertyName), globalObject()-&gt;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="branchessafari53834branchSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/page/DOMWindow.cpp (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/DOMWindow.cpp        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebCore/page/DOMWindow.cpp        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -110,6 +110,12 @@
</span><span class="cx"> #include &lt;wtf/text/Base64.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+#include &quot;UserContentController.h&quot;
+#include &quot;UserMessageHandlerDescriptor.h&quot;
+#include &quot;WebKitNamespace.h&quot;
+#endif
+
</ins><span class="cx"> #if ENABLE(PROXIMITY_EVENTS)
</span><span class="cx"> #include &quot;DeviceProximityController.h&quot;
</span><span class="cx"> #endif
</span><span class="lines">@@ -711,6 +717,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&amp; world)
+{
+    if (!m_frame)
+        return false;
+
+    auto* page = m_frame-&gt;page();
+    if (!page)
+        return false;
+
+    auto* userContentController = page-&gt;userContentController();
+    if (!userContentController)
+        return false;
+
+    auto* descriptorMap = userContentController-&gt;userMessageHandlerDescriptors();
+    if (!descriptorMap)
+        return false;
+
+    for (auto&amp; descriptor : descriptorMap-&gt;values()) {
+        if (&amp;descriptor-&gt;world() == &amp;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&amp; ec) const
</span><span class="cx"> {
</span><span class="cx">     if (!isCurrentlyDisplayedInFrame())
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebCorepageDOMWindowh"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/page/DOMWindow.h (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/DOMWindow.h        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebCore/page/DOMWindow.h        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -47,7 +47,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">@@ -72,8 +74,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">@@ -425,6 +427,11 @@
</span><span class="cx">         bool hasTouchEventListeners() const { return m_touchEventListenerCount &gt; 0; }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+        bool shouldHaveWebKitNamespaceForWorld(DOMWrapperWorld&amp;);
+        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">@@ -500,6 +507,10 @@
</span><span class="cx"> #if ENABLE(CSS3_CONDITIONAL_RULES)
</span><span class="cx">         mutable RefPtr&lt;DOMWindowCSS&gt; m_css;
</span><span class="cx"> #endif
</span><ins>+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+        mutable RefPtr&lt;WebKitNamespace&gt; 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="branchessafari53834branchSourceWebCorepageUserContentControllercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/page/UserContentController.cpp (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/UserContentController.cpp        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebCore/page/UserContentController.cpp        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -33,6 +33,10 @@
</span><span class="cx"> #include &quot;UserScript.h&quot;
</span><span class="cx"> #include &quot;UserStyleSheet.h&quot;
</span><span class="cx"> 
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+#include &quot;UserMessageHandlerDescriptor.h&quot;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;UserContentController&gt; 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&amp; descriptor)
+{
+    if (!m_userMessageHandlerDescriptors)
+        m_userMessageHandlerDescriptors = std::make_unique&lt;UserMessageHandlerDescriptorMap&gt;();
+
+    m_userMessageHandlerDescriptors-&gt;add(std::make_pair(descriptor.name(), &amp;descriptor.world()), &amp;descriptor);
+}
+
+void UserContentController::removeUserMessageHandlerDescriptor(UserMessageHandlerDescriptor&amp; descriptor)
+{
+    if (!m_userMessageHandlerDescriptors)
+        return;
+
+    m_userMessageHandlerDescriptors-&gt;remove(std::make_pair(descriptor.name(), &amp;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="branchessafari53834branchSourceWebCorepageUserContentControllerh"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/page/UserContentController.h (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/UserContentController.h        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebCore/page/UserContentController.h        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -32,6 +32,10 @@
</span><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</span><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="cx"> 
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+#include &quot;UserMessageHandlerDescriptorTypes.h&quot;
+#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&lt;UserContentController&gt; {
</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&amp;);
+    void removeUserMessageHandlerDescriptor(UserMessageHandlerDescriptor&amp;);
+#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&lt;UserScriptMap&gt; m_userScripts;
</span><span class="cx">     std::unique_ptr&lt;UserStyleSheetMap&gt; m_userStyleSheets;
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+    std::unique_ptr&lt;UserMessageHandlerDescriptorMap&gt; m_userMessageHandlerDescriptors;
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebCorepageUserMessageHandlercppfromrev169023trunkSourceWebCorepageUserMessageHandlercpp"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandler.cpp (from rev 169023, trunk/Source/WebCore/page/UserMessageHandler.cpp) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandler.cpp                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandler.cpp        2014-05-19 21:57:03 UTC (rev 169072)
</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 &quot;config.h&quot;
+#include &quot;UserMessageHandler.h&quot;
+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+
+#include &quot;Frame.h&quot;
+#include &quot;SerializedScriptValue.h&quot;
+
+namespace WebCore {
+
+UserMessageHandler::UserMessageHandler(Frame&amp; frame, UserMessageHandlerDescriptor&amp; descriptor)
+    : FrameDestructionObserver(&amp;frame)
+    , m_descriptor(descriptor)
+{
+}
+
+UserMessageHandler::~UserMessageHandler()
+{
+}
+
+void UserMessageHandler::postMessage(PassRefPtr&lt;SerializedScriptValue&gt; value)
+{
+    m_descriptor-&gt;client().didPostMessage(*this, value.get());
+}
+
+const AtomicString&amp; UserMessageHandler::name()
+{
+    return m_descriptor-&gt;name();
+}
+
+DOMWrapperWorld&amp; UserMessageHandler::world()
+{
+    return m_descriptor-&gt;world();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
</ins></span></pre></div>
<a id="branchessafari53834branchSourceWebCorepageUserMessageHandlerhfromrev169023trunkSourceWebCorepageUserMessageHandlerh"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandler.h (from rev 169023, trunk/Source/WebCore/page/UserMessageHandler.h) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandler.h                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandler.h        2014-05-19 21:57:03 UTC (rev 169072)
</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 &quot;FrameDestructionObserver.h&quot;
+#include &quot;UserMessageHandlerDescriptor.h&quot;
+#include &lt;bindings/ScriptValue.h&gt;
+
+namespace WebCore {
+
+class UserMessageHandler : public RefCounted&lt;UserMessageHandler&gt;, public FrameDestructionObserver {
+public:
+    static PassRef&lt;UserMessageHandler&gt; create(Frame&amp; frame, UserMessageHandlerDescriptor&amp; descriptor)
+    {
+        return adoptRef(*new UserMessageHandler(frame, descriptor));
+    }
+    virtual ~UserMessageHandler();
+
+    void postMessage(PassRefPtr&lt;SerializedScriptValue&gt;);
+
+    const AtomicString&amp; name();
+    DOMWrapperWorld&amp; world();
+
+private:
+    UserMessageHandler(Frame&amp;, UserMessageHandlerDescriptor&amp;);
+    
+    Ref&lt;UserMessageHandlerDescriptor&gt; m_descriptor;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
+#endif // UserMessageHandler_h
</ins></span></pre></div>
<a id="branchessafari53834branchSourceWebCorepageUserMessageHandleridlfromrev169023trunkSourceWebCorepageUserMessageHandleridl"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandler.idl (from rev 169023, trunk/Source/WebCore/page/UserMessageHandler.idl) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandler.idl                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandler.idl        2014-05-19 21:57:03 UTC (rev 169072)
</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="branchessafari53834branchSourceWebCorepageUserMessageHandlerDescriptorcppfromrev169023trunkSourceWebCorepageUserMessageHandlerDescriptorcpp"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlerDescriptor.cpp (from rev 169023, trunk/Source/WebCore/page/UserMessageHandlerDescriptor.cpp) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlerDescriptor.cpp                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlerDescriptor.cpp        2014-05-19 21:57:03 UTC (rev 169072)
</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 &quot;config.h&quot;
+#include &quot;UserMessageHandlerDescriptor.h&quot;
+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+
+#include &quot;DOMWrapperWorld.h&quot;
+
+namespace WebCore {
+
+UserMessageHandlerDescriptor::UserMessageHandlerDescriptor(const AtomicString&amp; name, DOMWrapperWorld&amp; world, Client&amp; client)
+    : m_name(name)
+    , m_world(world)
+    , m_client(client)
+{
+}
+
+UserMessageHandlerDescriptor::~UserMessageHandlerDescriptor()
+{
+}
+
+const AtomicString&amp; UserMessageHandlerDescriptor::name()
+{
+    return m_name;
+}
+
+DOMWrapperWorld&amp; UserMessageHandlerDescriptor::world()
+{
+    return m_world.get();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
</ins></span></pre></div>
<a id="branchessafari53834branchSourceWebCorepageUserMessageHandlerDescriptorhfromrev169023trunkSourceWebCorepageUserMessageHandlerDescriptorh"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlerDescriptor.h (from rev 169023, trunk/Source/WebCore/page/UserMessageHandlerDescriptor.h) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlerDescriptor.h                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlerDescriptor.h        2014-05-19 21:57:03 UTC (rev 169072)
</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 &lt;wtf/PassRefPtr.h&gt;
+#include &lt;wtf/RefCounted.h&gt;
+#include &lt;wtf/RefPtr.h&gt;
+#include &lt;wtf/text/AtomicString.h&gt;
+
+namespace WebCore {
+
+class Frame;
+class DOMWrapperWorld;
+class UserMessageHandler;
+class SerializedScriptValue;
+
+class UserMessageHandlerDescriptor : public RefCounted&lt;UserMessageHandlerDescriptor&gt; {
+public:
+    class Client {
+    public:
+        virtual ~Client() { }
+        virtual void didPostMessage(UserMessageHandler&amp;, SerializedScriptValue*) = 0;
+    };
+
+    static PassRefPtr&lt;UserMessageHandlerDescriptor&gt; create(const AtomicString&amp; name, DOMWrapperWorld&amp; world, Client&amp; client)
+    {
+        return adoptRef(new UserMessageHandlerDescriptor(name, world, client));
+    }
+    ~UserMessageHandlerDescriptor();
+
+    const AtomicString&amp; name();
+    DOMWrapperWorld&amp; world();
+    
+    Client&amp; client() const { return m_client; }
+
+private:
+    explicit UserMessageHandlerDescriptor(const AtomicString&amp;, DOMWrapperWorld&amp;, Client&amp;);
+    
+    AtomicString m_name;
+    Ref&lt;DOMWrapperWorld&gt; m_world;
+    Client&amp; m_client;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
+#endif // UserMessageHandlerDescriptor_h
</ins></span></pre></div>
<a id="branchessafari53834branchSourceWebCorepageUserMessageHandlerDescriptorTypeshfromrev169023trunkSourceWebCorepageUserMessageHandlerDescriptorTypesh"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlerDescriptorTypes.h (from rev 169023, trunk/Source/WebCore/page/UserMessageHandlerDescriptorTypes.h) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlerDescriptorTypes.h                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlerDescriptorTypes.h        2014-05-19 21:57:03 UTC (rev 169072)
</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 &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/RefPtr.h&gt;
+#include &lt;wtf/text/AtomicString.h&gt;
+#include &lt;wtf/text/AtomicStringHash.h&gt;
+
+namespace WebCore {
+
+class DOMWrapperWorld;
+class UserMessageHandlerDescriptor;
+
+typedef HashMap&lt;std::pair&lt;AtomicString, RefPtr&lt;DOMWrapperWorld&gt;&gt;, RefPtr&lt;UserMessageHandlerDescriptor&gt;&gt; UserMessageHandlerDescriptorMap;
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
+#endif // UserMessageHandlerDescriptorTypes_h
</ins></span></pre></div>
<a id="branchessafari53834branchSourceWebCorepageUserMessageHandlersNamespacecppfromrev169023trunkSourceWebCorepageUserMessageHandlersNamespacecpp"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlersNamespace.cpp (from rev 169023, trunk/Source/WebCore/page/UserMessageHandlersNamespace.cpp) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlersNamespace.cpp                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlersNamespace.cpp        2014-05-19 21:57:03 UTC (rev 169072)
</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 &quot;config.h&quot;
+#include &quot;UserMessageHandlersNamespace.h&quot;
+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+
+#include &quot;DOMWrapperWorld.h&quot;
+#include &quot;Frame.h&quot;
+#include &quot;Page.h&quot;
+#include &quot;UserContentController.h&quot;
+
+namespace WebCore {
+
+UserMessageHandlersNamespace::UserMessageHandlersNamespace(Frame&amp; frame)
+    : FrameDestructionObserver(&amp;frame)
+{
+}
+
+UserMessageHandlersNamespace::~UserMessageHandlersNamespace()
+{
+}
+
+UserMessageHandler* UserMessageHandlersNamespace::handler(const AtomicString&amp; name, DOMWrapperWorld&amp; world)
+{
+    // First, check if we have a handler instance already.
+    for (auto&amp; handler : m_messageHandlers) {
+        if (handler-&gt;name() == name &amp;&amp; &amp;handler-&gt;world() == &amp;world)
+            return &amp;handler.get();
+    }
+
+    // Second, attempt to create a handler instance from a descriptor.
+    if (!frame())
+        return nullptr;
+
+    Page* page = frame()-&gt;page();
+    if (!page)
+        return nullptr;
+    
+    const auto* userContentController = page-&gt;userContentController();
+    if (!userContentController)
+        return nullptr;
+
+    const auto* userMessageHandlerDescriptors = userContentController-&gt;userMessageHandlerDescriptors();
+    if (!userMessageHandlerDescriptors)
+        return nullptr;
+
+    RefPtr&lt;UserMessageHandlerDescriptor&gt; descriptor = userMessageHandlerDescriptors-&gt;get(std::make_pair(name, &amp;world));
+    if (!descriptor)
+        return nullptr;
+
+    m_messageHandlers.append(UserMessageHandler::create(*frame(), *descriptor));
+    return &amp;m_messageHandlers.last().get();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
</ins></span></pre></div>
<a id="branchessafari53834branchSourceWebCorepageUserMessageHandlersNamespacehfromrev169023trunkSourceWebCorepageUserMessageHandlersNamespaceh"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlersNamespace.h (from rev 169023, trunk/Source/WebCore/page/UserMessageHandlersNamespace.h) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlersNamespace.h                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlersNamespace.h        2014-05-19 21:57:03 UTC (rev 169072)
</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 &quot;FrameDestructionObserver.h&quot;
+#include &quot;UserMessageHandler.h&quot;
+#include &lt;wtf/PassRefPtr.h&gt;
+#include &lt;wtf/RefCounted.h&gt;
+#include &lt;wtf/RefPtr.h&gt;
+#include &lt;wtf/Vector.h&gt;
+#include &lt;wtf/text/AtomicString.h&gt;
+
+namespace WebCore {
+
+class Frame;
+class UserMessageHandler;
+class DOMWrapperWorld;
+
+class UserMessageHandlersNamespace : public RefCounted&lt;UserMessageHandlersNamespace&gt;, public FrameDestructionObserver {
+public:
+    static PassRef&lt;UserMessageHandlersNamespace&gt; create(Frame&amp; frame)
+    {
+        return adoptRef(*new UserMessageHandlersNamespace(frame));
+    }
+
+    virtual ~UserMessageHandlersNamespace();
+
+    UserMessageHandler* handler(const AtomicString&amp;, DOMWrapperWorld&amp;);
+
+private:
+    explicit UserMessageHandlersNamespace(Frame&amp;);
+
+    Vector&lt;Ref&lt;UserMessageHandler&gt;&gt; m_messageHandlers;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
+#endif // UserMessageHandlersNamespace_h
</ins></span></pre></div>
<a id="branchessafari53834branchSourceWebCorepageUserMessageHandlersNamespaceidlfromrev169023trunkSourceWebCorepageUserMessageHandlersNamespaceidl"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlersNamespace.idl (from rev 169023, trunk/Source/WebCore/page/UserMessageHandlersNamespace.idl) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlersNamespace.idl                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebCore/page/UserMessageHandlersNamespace.idl        2014-05-19 21:57:03 UTC (rev 169072)
</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="branchessafari53834branchSourceWebCorepageWebKitNamespacecppfromrev169023trunkSourceWebCorepageWebKitNamespacecpp"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebCore/page/WebKitNamespace.cpp (from rev 169023, trunk/Source/WebCore/page/WebKitNamespace.cpp) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/WebKitNamespace.cpp                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebCore/page/WebKitNamespace.cpp        2014-05-19 21:57:03 UTC (rev 169072)
</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 &quot;config.h&quot;
+#include &quot;WebKitNamespace.h&quot;
+
+#if ENABLE(USER_MESSAGE_HANDLERS)
+
+#include &quot;DOMWindow.h&quot;
+#include &quot;UserMessageHandlersNamespace.h&quot;
+
+namespace WebCore {
+
+WebKitNamespace::WebKitNamespace(Frame&amp; frame)
+    : DOMWindowProperty(&amp;frame)
+    , m_messageHandlerNamespace(UserMessageHandlersNamespace::create(frame))
+{
+}
+
+WebKitNamespace::~WebKitNamespace()
+{
+}
+
+UserMessageHandlersNamespace* WebKitNamespace::messageHandlers()
+{
+    return &amp;m_messageHandlerNamespace.get();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
</ins></span></pre></div>
<a id="branchessafari53834branchSourceWebCorepageWebKitNamespacehfromrev169023trunkSourceWebCorepageWebKitNamespaceh"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebCore/page/WebKitNamespace.h (from rev 169023, trunk/Source/WebCore/page/WebKitNamespace.h) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/WebKitNamespace.h                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebCore/page/WebKitNamespace.h        2014-05-19 21:57:03 UTC (rev 169072)
</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 &quot;DOMWindowProperty.h&quot;
+#include &lt;wtf/PassRefPtr.h&gt;
+#include &lt;wtf/Ref.h&gt;
+#include &lt;wtf/RefCounted.h&gt;
+
+namespace WebCore {
+
+class Frame;
+class UserMessageHandlersNamespace;
+
+class WebKitNamespace : public DOMWindowProperty, public RefCounted&lt;WebKitNamespace&gt; {
+public:
+    static PassRefPtr&lt;WebKitNamespace&gt; create(Frame&amp; frame)
+    {
+        return adoptRef(new WebKitNamespace(frame));
+    }
+
+    virtual ~WebKitNamespace();
+
+    UserMessageHandlersNamespace* messageHandlers();
+
+private:
+    explicit WebKitNamespace(Frame&amp;);
+
+    Ref&lt;UserMessageHandlersNamespace&gt; m_messageHandlerNamespace;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(USER_MESSAGE_HANDLERS)
+#endif // WebKitNamespace_h
</ins></span></pre></div>
<a id="branchessafari53834branchSourceWebCorepageWebKitNamespaceidlfromrev169023trunkSourceWebCorepageWebKitNamespaceidl"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebCore/page/WebKitNamespace.idl (from rev 169023, trunk/Source/WebCore/page/WebKitNamespace.idl) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/WebKitNamespace.idl                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebCore/page/WebKitNamespace.idl        2014-05-19 21:57:03 UTC (rev 169072)
</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="branchessafari53834branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/ChangeLog (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/ChangeLog        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebKit2/ChangeLog        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -1,5 +1,76 @@
</span><span class="cx"> 2014-05-19  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r169023.
+
+    2014-05-18  Sam Weinig  &lt;sam@webkit.org&gt;
+
+            [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:
+
+2014-05-19  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r169000.
</span><span class="cx"> 
</span><span class="cx">     2014-05-17  Anders Carlsson  &lt;andersca@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2DerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/DerivedSources.make (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/DerivedSources.make        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebKit2/DerivedSources.make        2014-05-19 21:57:03 UTC (rev 169072)
</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="branchessafari53834branchSourceWebKit2Scriptswebkit2messagespy"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/Scripts/webkit2/messages.py (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/Scripts/webkit2/messages.py        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebKit2/Scripts/webkit2/messages.py        2014-05-19 21:57:03 UTC (rev 169072)
</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': '&quot;ArgumentCoders.h&quot;',
</span><span class="cx">         'WebKit::InjectedBundleUserMessageEncoder': '&quot;InjectedBundleUserMessageCoders.h&quot;',
</span><span class="cx">         'WebKit::WebContextUserMessageEncoder': '&quot;WebContextUserMessageCoders.h&quot;',
</span><ins>+        'WebKit::ScriptMessageHandlerHandle': '&quot;WebScriptMessageHandler.h&quot;',
</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': ['&quot;WebEvent.h&quot;'],
</span><span class="cx">         'WebKit::WebTouchEvent': ['&quot;WebEvent.h&quot;'],
</span><span class="cx">         'WebKit::WebWheelEvent': ['&quot;WebEvent.h&quot;'],
</span><ins>+        'WebKit::WebScriptMessageHandlerHandle': ['&quot;WebScriptMessageHandler.h&quot;'],
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     headers = []
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2UIProcessAPICocoaWKScriptMessagemm"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessage.mm (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessage.mm        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessage.mm        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -24,43 +24,48 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #import &quot;config.h&quot;
</span><del>-#import &quot;WKScriptMessagePrivate.h&quot;
</del><ins>+#import &quot;WKScriptMessageInternal.h&quot;
</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 &quot;WeakObjCPtr.h&quot;
+#import &lt;wtf/RetainPtr.h&gt;
</ins><span class="cx"> 
</span><del>-@implementation WKScriptMessage
</del><ins>+@implementation WKScriptMessage {
+    RetainPtr&lt;id&gt; _body;
+    WebKit::WeakObjCPtr&lt;WKWebView&gt; _webView;
+    RetainPtr&lt;NSString&gt; _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="branchessafari53834branchSourceWebKit2UIProcessAPICocoaWKScriptMessageInternalhfromrev169023trunkSourceWebKit2UIProcessAPICocoaWKScriptMessageInternalh"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessageInternal.h (from rev 169023, trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessageInternal.h) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessageInternal.h                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessageInternal.h        2014-05-19 21:57:03 UTC (rev 169072)
</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 &quot;WKScriptMessage.h&quot;
+
+#if WK_API_ENABLED
+
+@interface WKScriptMessage ()
+
+- (instancetype)_initWithBody:(id)body webView:(WKWebView *)webView name:(NSString *)name;
+
+@end
+
+#endif
</ins></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2UIProcessAPICocoaWKScriptMessagePrivateh"></a>
<div class="delfile"><h4>Deleted: branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessagePrivate.h (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessagePrivate.h        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessagePrivate.h        2014-05-19 21:57:03 UTC (rev 169072)
</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 &lt;WebKit/WKScriptMessage.h&gt;
-
-#if WK_API_ENABLED
-
-@class _WKScriptWorld;
-
-@interface WKScriptMessage (WKPrivate)
-
-@property (nonatomic, readonly) _WKScriptWorld *_scriptWorld;
-
-@end
-
-#endif
</del></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2UIProcessAPICocoaWKUserContentControllermm"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm        2014-05-19 21:57:03 UTC (rev 169072)
</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 &quot;WKScriptMessageHandler.h&quot;
+#import &quot;WKScriptMessageInternal.h&quot;
</ins><span class="cx"> #import &quot;WKUserScriptInternal.h&quot;
</span><ins>+#import &quot;WKWebViewInternal.h&quot;
+#import &quot;WebScriptMessageHandler.h&quot;
</ins><span class="cx"> #import &quot;WebUserContentControllerProxy.h&quot;
</span><del>-#import &quot;_WKScriptWorld.h&quot;
</del><ins>+#import &lt;JavaScriptCore/JSContext.h&gt;
+#import &lt;JavaScriptCore/JSValue.h&gt;
+#import &lt;WebCore/SerializedScriptValue.h&gt;
</ins><span class="cx"> #import &lt;WebCore/UserScript.h&gt;
</span><span class="cx"> #import &lt;wtf/text/StringBuilder.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -87,28 +93,43 @@
</span><span class="cx">     _userContentControllerProxy-&gt;removeAllUserScripts();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)addScriptMessageHandler:(id &lt;WKScriptMessageHandler&gt;)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 &lt;WKScriptMessageHandler&gt; handler, NSString *name)
+        : m_controller(controller)
+        , m_handler(handler)
+        , m_name(adoptNS([name copy]))
+    {
+    }
+    
+    virtual void didPostMessage(WebKit::WebPageProxy&amp; page, WebKit::WebFrameProxy&amp;, WebCore::SerializedScriptValue&amp; serializedScriptValue)
+    {
+        RetainPtr&lt;JSContext&gt; 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&lt;WKScriptMessage&gt; 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&lt;WKUserContentController&gt; m_controller;
+    RetainPtr&lt;id &lt;WKScriptMessageHandler&gt;&gt; m_handler;
+    RetainPtr&lt;NSString&gt; m_name;
+};
</ins><span class="cx"> 
</span><del>-@implementation WKUserContentController (WKPrivate)
-
-- (void)_addScriptMessageHandler:(id &lt;WKScriptMessageHandler&gt;)scriptMessageHandler name:(NSString *)name world:(_WKScriptWorld *)world
</del><ins>+- (void)addScriptMessageHandler:(id &lt;WKScriptMessageHandler&gt;)scriptMessageHandler name:(NSString *)name
</ins><span class="cx"> {
</span><del>-    // FIXME: Implement.
</del><ins>+    RefPtr&lt;WebKit::WebScriptMessageHandler&gt; handler = WebKit::WebScriptMessageHandler::create(std::make_unique&lt;ScriptMessageHandlerDelegate&gt;(self, scriptMessageHandler, name), name);
+    if (!_userContentControllerProxy-&gt;addUserScriptMessageHandler(handler.get()))
+        [NSException raise:NSInvalidArgumentException format:@&quot;Attempt to add script message handler with name '%@' when one already exists.&quot;, 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-&gt;removeUserMessageHandlerForName(name);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2UIProcessAPICocoaWKUserContentControllerInternalh"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerInternal.h (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerInternal.h        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerInternal.h        2014-05-19 21:57:03 UTC (rev 169072)
</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 &quot;WKUserContentControllerPrivate.h&quot;
</del><ins>+#import &quot;WKUserContentController.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2UIProcessAPICocoaWKUserContentControllerPrivateh"></a>
<div class="delfile"><h4>Deleted: branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerPrivate.h (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerPrivate.h        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerPrivate.h        2014-05-19 21:57:03 UTC (rev 169072)
</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 &lt;WebKit/WKUserContentController.h&gt;
-
-#if WK_API_ENABLED
-
-@class _WKScriptWorld;
-
-@interface WKUserContentController (WKPrivate)
-
-- (void)_addScriptMessageHandler:(id &lt;WKScriptMessageHandler&gt;)scriptMessageHandler name:(NSString *)name world:(_WKScriptWorld *)world;
-- (void)_removeScriptMessageHandlerForName:(NSString *)name world:(_WKScriptWorld *)world;
-
-@end
-
-#endif
-
-
</del></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -64,6 +64,8 @@
</span><span class="cx"> #import &quot;_WKRemoteObjectRegistryInternal.h&quot;
</span><span class="cx"> #import &quot;_WKVisitedLinkProviderInternal.h&quot;
</span><span class="cx"> #import &quot;_WKWebsiteDataStoreInternal.h&quot;
</span><ins>+#import &lt;wtf/HashMap.h&gt;
+#import &lt;wtf/NeverDestroyed.h&gt;
</ins><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="lines">@@ -103,6 +105,18 @@
</span><span class="cx"> #import &lt;WebCore/ColorMac.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+
+static HashMap&lt;WebKit::WebPageProxy*, WKWebView *&gt;&amp; pageToViewMap()
+{
+    static NeverDestroyed&lt;HashMap&lt;WebKit::WebPageProxy*, WKWebView *&gt;&gt; map;
+    return map;
+}
+
+WKWebView* fromWebPageProxy(WebKit::WebPageProxy&amp; page)
+{
+    return pageToViewMap().get(&amp;page);
+}
+
</ins><span class="cx"> @implementation WKWebView {
</span><span class="cx">     std::unique_ptr&lt;WebKit::NavigationState&gt; _navigationState;
</span><span class="cx">     std::unique_ptr&lt;WebKit::UIDelegate&gt; _uiDelegate;
</span><span class="lines">@@ -230,6 +244,8 @@
</span><span class="cx"> 
</span><span class="cx">     _page-&gt;setFindClient(std::make_unique&lt;WebKit::FindClient&gt;(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">@@ -241,6 +257,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="branchessafari53834branchSourceWebKit2UIProcessAPICocoaWKWebViewInternalh"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -76,4 +76,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> @end
</span><span class="cx"> 
</span><ins>+WKWebView* fromWebPageProxy(WebKit::WebPageProxy&amp;);
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2UIProcessUserContentWebScriptMessageHandlercppfromrev169023trunkSourceWebKit2UIProcessUserContentWebScriptMessageHandlercpp"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.cpp (from rev 169023, trunk/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.cpp) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.cpp                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.cpp        2014-05-19 21:57:03 UTC (rev 169072)
</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 &quot;config.h&quot;
+#include &quot;WebScriptMessageHandler.h&quot;
+
+#include &quot;ArgumentCoders.h&quot;
+
+namespace WebKit {
+
+void WebScriptMessageHandlerHandle::encode(IPC::ArgumentEncoder&amp; encoder) const
+{
+    encoder &lt;&lt; identifier;
+    encoder &lt;&lt; name;
+}
+
+bool WebScriptMessageHandlerHandle::decode(IPC::ArgumentDecoder&amp; decoder, WebScriptMessageHandlerHandle&amp; 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&lt;WebScriptMessageHandler&gt; WebScriptMessageHandler::create(std::unique_ptr&lt;Client&gt; client, const String&amp; name)
+{
+    return adoptRef(new WebScriptMessageHandler(std::move(client), name));
+}
+
+WebScriptMessageHandler::WebScriptMessageHandler(std::unique_ptr&lt;Client&gt; client, const String&amp; name)
+    : m_identifier(generateIdentifier())
+    , m_client(std::move(client))
+    , m_name(name)
+{
+}
+
+WebScriptMessageHandler::~WebScriptMessageHandler()
+{
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2UIProcessUserContentWebScriptMessageHandlerhfromrev169023trunkSourceWebKit2UIProcessUserContentWebScriptMessageHandlerh"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.h (from rev 169023, trunk/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.h) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.h                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebScriptMessageHandler.h        2014-05-19 21:57:03 UTC (rev 169072)
</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 &lt;wtf/PassRefPtr.h&gt;
+#include &lt;wtf/RefCounted.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace IPC {
+class ArgumentDecoder;
+class ArgumentEncoder;
+}
+
+namespace WebCore {
+class SerializedScriptValue;
+}
+
+namespace WebKit {
+
+class WebPageProxy;
+class WebFrameProxy;
+
+struct WebScriptMessageHandlerHandle {
+    void encode(IPC::ArgumentEncoder&amp;) const;
+    static bool decode(IPC::ArgumentDecoder&amp;, WebScriptMessageHandlerHandle&amp;);
+
+    uint64_t identifier;
+    String name;
+};
+
+class WebScriptMessageHandler : public RefCounted&lt;WebScriptMessageHandler&gt; {
+public:
+    class Client {
+    public:
+        virtual ~Client() { }
+        virtual void didPostMessage(WebPageProxy&amp;, WebFrameProxy&amp;, WebCore::SerializedScriptValue&amp;) = 0;
+    };
+
+    static PassRefPtr&lt;WebScriptMessageHandler&gt; create(std::unique_ptr&lt;Client&gt;, const String&amp; name);    
+    virtual ~WebScriptMessageHandler();
+
+    WebScriptMessageHandlerHandle handle() { return { m_identifier, m_name }; }
+
+    uint64_t identifier() const { return m_identifier; }
+    String name() const { return m_name; }
+
+    Client&amp; client() const { return *m_client; }
+
+private:
+    WebScriptMessageHandler(std::unique_ptr&lt;Client&gt;, const String&amp;);
+    
+    uint64_t m_identifier;
+
+    std::unique_ptr&lt;Client&gt; m_client;
+    String m_name;
+};
+
+} // namespace API
+    
+#endif // WebScriptMessageHandler_h
</ins></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2UIProcessUserContentWebUserContentControllerProxycpp"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -26,8 +26,12 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;WebUserContentControllerProxy.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;DataReference.h&quot;
</ins><span class="cx"> #include &quot;WebProcessProxy.h&quot;
</span><ins>+#include &quot;WebScriptMessageHandler.h&quot;
</ins><span class="cx"> #include &quot;WebUserContentControllerMessages.h&quot;
</span><ins>+#include &quot;WebUserContentControllerProxyMessages.h&quot;
+#include &lt;WebCore/SerializedScriptValue.h&gt;
</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(&amp;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()-&gt;send(Messages::WebUserContentController::AddUserScripts(m_userScripts), m_identifier);
</span><ins>+    
+    Vector&lt;WebScriptMessageHandlerHandle&gt; messageHandlerHandles;
+    for (auto&amp; handler : m_scriptMessageHandlers.values())
+        messageHandlerHandles.append(handler-&gt;handle());
+    webProcessProxy.connection()-&gt;send(Messages::WebUserContentController::AddUserScriptMessageHandlers(messageHandlerHandles), m_identifier);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebUserContentControllerProxy::removeProcess(WebProcessProxy&amp; webProcessProxy)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_processes.contains(&amp;webProcessProxy));
</span><span class="cx"> 
</span><del>-    m_processes.remove(&amp;webProcessProxy);
</del><ins>+    if (m_processes.remove(&amp;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-&gt;connection()-&gt;send(Messages::WebUserContentController::RemoveAllUserScripts(), m_identifier);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool WebUserContentControllerProxy::addUserScriptMessageHandler(WebScriptMessageHandler* handler)
+{
+    for (auto&amp; existingHandler : m_scriptMessageHandlers.values()) {
+        if (existingHandler-&gt;name() == handler-&gt;name())
+            return false;
+    }
+
+    m_scriptMessageHandlers.add(handler-&gt;identifier(), handler);
+
+    for (auto&amp; processAndCount : m_processes)
+        processAndCount.key-&gt;connection()-&gt;send(Messages::WebUserContentController::AddUserScriptMessageHandlers({ handler-&gt;handle() }), m_identifier);
+    
+    return true;
+}
+
+void WebUserContentControllerProxy::removeUserMessageHandlerForName(const String&amp; name)
+{
+    for (auto it = m_scriptMessageHandlers.begin(), end = m_scriptMessageHandlers.end(); it != end; ++it) {
+        if (it-&gt;value-&gt;name() == name) {
+            for (auto&amp; processAndCount : m_processes)
+                processAndCount.key-&gt;connection()-&gt;send(Messages::WebUserContentController::RemoveUserScriptMessageHandler(it-&gt;value-&gt;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&amp; dataReference)
+{
+    WebPageProxy* page = WebProcessProxy::webPage(pageID);
+    if (!page)
+        return;
+
+    WebProcessProxy* webProcess = WebProcessProxy::fromConnection(connection);
+    WebFrameProxy* frame = webProcess-&gt;webFrame(frameID);
+    if (!frame)
+        return;
+
+    if (!HashMap&lt;uint64_t, RefPtr&lt;WebScriptMessageHandler&gt;&gt;::isValidKey(messageHandlerID))
+        return;
+
+    RefPtr&lt;WebScriptMessageHandler&gt; handler = m_scriptMessageHandlers.get(messageHandlerID);
+    if (!handler)
+        return;
+
+    auto buffer = dataReference.vector();
+    RefPtr&lt;WebCore::SerializedScriptValue&gt; value = WebCore::SerializedScriptValue::adopt(buffer);
+
+    handler-&gt;client().didPostMessage(*page, *frame, *value);
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2UIProcessUserContentWebUserContentControllerProxyh"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h        2014-05-19 21:57:03 UTC (rev 169072)
</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 &quot;MessageReceiver.h&quot;
+#include &lt;wtf/Forward.h&gt;
</ins><span class="cx"> #include &lt;wtf/HashCountedSet.h&gt;
</span><ins>+#include &lt;wtf/HashMap.h&gt;
</ins><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</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&lt;WebUserContentControllerProxy&gt; {
</del><ins>+class WebUserContentControllerProxy : public RefCounted&lt;WebUserContentControllerProxy&gt;, private IPC::MessageReceiver {
</ins><span class="cx"> public:
</span><span class="cx">     static PassRefPtr&lt;WebUserContentControllerProxy&gt; 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&amp;);
+
</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&amp;) override;
+
+    void didPostMessage(IPC::Connection*, uint64_t pageID, uint64_t frameID, uint64_t messageHandlerID, const IPC::DataReference&amp;);
+
</ins><span class="cx">     uint64_t m_identifier;
</span><span class="cx">     HashCountedSet&lt;WebProcessProxy*&gt; m_processes;
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;WebCore::UserScript&gt; m_userScripts;
</span><ins>+    HashMap&lt;uint64_t, RefPtr&lt;WebScriptMessageHandler&gt;&gt; m_scriptMessageHandlers;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2UIProcessUserContentWebUserContentControllerProxymessagesinfromrev169023trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxymessagesin"></a>
<div class="copfile"><h4>Copied: branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.messages.in (from rev 169023, trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.messages.in) (0 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.messages.in                                (rev 0)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.messages.in        2014-05-19 21:57:03 UTC (rev 169072)
</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 -&gt; WebUserContentControllerProxy {
+    DidPostMessage(uint64_t pageID, uint64_t frameID, uint64_t messageHandlerID, IPC::DataReference message) WantsConnection
+}
</ins></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -984,6 +984,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">@@ -998,8 +1002,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">@@ -2900,6 +2903,11 @@
</span><span class="cx">                 7C135AA6173B0BCA00586AE2 /* WKPluginInformation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPluginInformation.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C135AA7173B0BCA00586AE2 /* WKPluginInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPluginInformation.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C135AAA173B0CFF00586AE2 /* PluginInformationMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginInformationMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7C361D6F1927FA360036A59D /* WebScriptMessageHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebScriptMessageHandler.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C361D701927FA360036A59D /* WebScriptMessageHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptMessageHandler.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C361D751928028B0036A59D /* WebUserContentControllerProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebUserContentControllerProxy.messages.in; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C361D76192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebUserContentControllerProxyMessageReceiver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C361D77192803BD0036A59D /* WebUserContentControllerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebUserContentControllerProxyMessages.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7C387433172F5615001BD88A /* PageBanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageBanner.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInformation.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInformation.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -2914,8 +2922,7 @@
</span><span class="cx">                 7CB16FE51724B9B5007A0A95 /* com.macromedia.Flash Player.plugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = &quot;com.macromedia.Flash Player.plugin.sb&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CB16FE61724B9B5007A0A95 /* com.microsoft.SilverlightPlugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.microsoft.SilverlightPlugin.sb; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CB16FE71724B9B5007A0A95 /* com.oracle.java.JavaAppletPlugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.oracle.java.JavaAppletPlugin.sb; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                7CC99A3318EF7B120048C8B4 /* WKUserContentControllerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentControllerPrivate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                7CC99A3518EF7CBC0048C8B4 /* WKScriptMessagePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKScriptMessagePrivate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                7CC99A3518EF7CBC0048C8B4 /* WKScriptMessageInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKScriptMessageInternal.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7CD102D91866770600ED429D /* AutoCorrectionCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoCorrectionCallback.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CD5EBB61746A15B000C1C45 /* WKObjCTypeWrapperRef.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKObjCTypeWrapperRef.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CD5EBB71746A15B000C1C45 /* WKObjCTypeWrapperRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKObjCTypeWrapperRef.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -4344,8 +4351,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 = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -4820,13 +4830,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">@@ -6469,10 +6478,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">@@ -6532,6 +6537,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">@@ -6608,6 +6615,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">@@ -6886,6 +6897,7 @@
</span><span class="cx">                                 515E7728183DD6F60007203F /* AsyncRequest.h in Headers */,
</span><span class="cx">                                 BCE81D8D1319F7EF00241910 /* FontInfo.h in Headers */,
</span><span class="cx">                                 1ABC3DFC1899F51C004F0626 /* WKNavigationDelegate.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">@@ -6948,7 +6960,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">@@ -7330,7 +7342,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">@@ -7469,6 +7480,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">@@ -8562,6 +8574,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">@@ -8763,6 +8776,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="branchessafari53834branchSourceWebKit2WebProcessUserContentWebUserContentControllercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -26,12 +26,22 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;WebUserContentController.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;DataReference.h&quot;
+#include &quot;WebFrame.h&quot;
+#include &quot;WebPage.h&quot;
</ins><span class="cx"> #include &quot;WebProcess.h&quot;
</span><span class="cx"> #include &quot;WebUserContentControllerMessages.h&quot;
</span><ins>+#include &quot;WebUserContentControllerProxyMessages.h&quot;
</ins><span class="cx"> #include &lt;WebCore/DOMWrapperWorld.h&gt;
</span><span class="cx"> #include &lt;WebCore/ScriptController.h&gt;
</span><ins>+#include &lt;WebCore/SerializedScriptValue.h&gt;
</ins><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> 
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+#include &lt;WebCore/UserMessageHandler.h&gt;
+#include &lt;WebCore/UserMessageHandlerDescriptor.h&gt;
+#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-&gt;removeUserScripts(mainThreadNormalWorld());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+class WebUserMessageHandlerDescriptorProxy : public RefCounted&lt;WebUserMessageHandlerDescriptorProxy&gt;, public WebCore::UserMessageHandlerDescriptor::Client {
+public:
+    static PassRefPtr&lt;WebUserMessageHandlerDescriptorProxy&gt; create(WebUserContentController* controller, const String&amp; name, uint64_t identifier)
+    {
+        return adoptRef(new WebUserMessageHandlerDescriptorProxy(controller, name, identifier));
+    }
+
+    virtual ~WebUserMessageHandlerDescriptorProxy()
+    {
+    }
+
+    // WebCore::UserMessageHandlerDescriptor::Client
+    virtual void didPostMessage(WebCore::UserMessageHandler&amp; handler, WebCore::SerializedScriptValue* value)
+    {
+        WebCore::Frame* frame = handler.frame();
+        if (!frame)
+            return;
+    
+        WebFrame* webFrame = WebFrame::fromCoreFrame(*frame);
+        if (!webFrame)
+            return;
+
+        WebPage* webPage = webFrame-&gt;page();
+        if (!webPage)
+            return;
+
+        WebProcess::shared().parentProcessConnection()-&gt;send(Messages::WebUserContentControllerProxy::DidPostMessage(webPage-&gt;pageID(), webFrame-&gt;frameID(), m_identifier, IPC::DataReference(value-&gt;data())), m_controller-&gt;identifier());
+    }
+
+    WebCore::UserMessageHandlerDescriptor&amp; descriptor() { return *m_descriptor; }
+    uint64_t identifier() { return m_identifier; }
+
+private:
+    WebUserMessageHandlerDescriptorProxy(WebUserContentController* controller, const String&amp; name, uint64_t identifier)
+        : m_controller(controller)
+        , m_descriptor(UserMessageHandlerDescriptor::create(name, mainThreadNormalWorld(), *this))
+        , m_identifier(identifier)
+    {
+    }
+
+    RefPtr&lt;WebUserContentController&gt; m_controller;
+    RefPtr&lt;WebCore::UserMessageHandlerDescriptor&gt; m_descriptor;
+    uint64_t m_identifier;
+};
+#endif
+
+void WebUserContentController::addUserScriptMessageHandlers(const Vector&lt;WebScriptMessageHandlerHandle&gt;&amp; scriptMessageHandlers)
+{
+#if ENABLE(USER_MESSAGE_HANDLERS)
+    for (auto&amp; handle : scriptMessageHandlers) {
+        RefPtr&lt;WebUserMessageHandlerDescriptorProxy&gt; descriptor = WebUserMessageHandlerDescriptorProxy::create(this, handle.name, handle.identifier);
+
+        m_userMessageHandlerDescriptors.add(descriptor-&gt;identifier(), descriptor);
+        m_userContentController-&gt;addUserMessageHandlerDescriptor(descriptor-&gt;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-&gt;removeUserMessageHandlerDescriptor(it-&gt;value-&gt;descriptor());
+    m_userMessageHandlerDescriptors.remove(it);
+#endif
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2WebProcessUserContentWebUserContentControllerh"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -27,11 +27,15 @@
</span><span class="cx"> #define WebUserContentController_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;MessageReceiver.h&quot;
</span><ins>+#include &quot;WebScriptMessageHandler.h&quot;
</ins><span class="cx"> #include &lt;WebCore/UserContentController.h&gt;
</span><ins>+#include &lt;wtf/HashMap.h&gt;
</ins><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</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&lt;WebUserContentController&gt;, private IPC::MessageReceiver  {
</span><span class="cx"> public:
</span><span class="cx">     static PassRefPtr&lt;WebUserContentController&gt; getOrCreate(uint64_t identifier);
</span><span class="lines">@@ -39,6 +43,8 @@
</span><span class="cx"> 
</span><span class="cx">     WebCore::UserContentController&amp; 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&lt;WebCore::UserScript&gt;&amp; userScripts);
</span><span class="cx">     void removeAllUserScripts();
</span><span class="cx"> 
</span><ins>+    void addUserScriptMessageHandlers(const Vector&lt;WebScriptMessageHandlerHandle&gt;&amp; scriptMessageHandlers);
+    void removeUserScriptMessageHandler(uint64_t);
+
</ins><span class="cx">     uint64_t m_identifier;
</span><span class="cx">     Ref&lt;WebCore::UserContentController&gt; m_userContentController;
</span><ins>+#if ENABLE(USER_MESSAGE_HANDLERS)
+    HashMap&lt;uint64_t, RefPtr&lt;WebUserMessageHandlerDescriptorProxy&gt;&gt; m_userMessageHandlerDescriptors;
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2WebProcessUserContentWebUserContentControllermessagesin"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in (169071 => 169072)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in        2014-05-19 21:46:37 UTC (rev 169071)
+++ branches/safari-538.34-branch/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in        2014-05-19 21:57:03 UTC (rev 169072)
</span><span class="lines">@@ -26,4 +26,7 @@
</span><span class="cx"> messages -&gt; WebUserContentController {
</span><span class="cx">     AddUserScripts(Vector&lt;WebCore::UserScript&gt; userScripts);
</span><span class="cx">     RemoveAllUserScripts()
</span><ins>+
+    AddUserScriptMessageHandlers(Vector&lt;WebKit::WebScriptMessageHandlerHandle&gt; scriptMessageHandlers);
+    RemoveUserScriptMessageHandler(uint64_t identifier)
</ins><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>