<!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>[176544] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/176544">176544</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-11-25 11:50:45 -0800 (Tue, 25 Nov 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove user content handling from PageGroup
https://bugs.webkit.org/show_bug.cgi?id=139051

Reviewed by Antti Koivisto.

Source/WebCore:

Remove m_userContentController from PageGroup and the related functions and symbol exports.

* WebCore.exp.in:
* page/PageGroup.cpp:
(WebCore::PageGroup::PageGroup):
(WebCore::PageGroup::~PageGroup):
(WebCore::PageGroup::addPage):
(WebCore::PageGroup::removePage):
(WebCore::PageGroup::addUserScriptToWorld): Deleted.
(WebCore::PageGroup::addUserStyleSheetToWorld): Deleted.
(WebCore::PageGroup::removeUserScriptFromWorld): Deleted.
(WebCore::PageGroup::removeUserStyleSheetFromWorld): Deleted.
(WebCore::PageGroup::removeUserScriptsFromWorld): Deleted.
(WebCore::PageGroup::removeUserStyleSheetsFromWorld): Deleted.
(WebCore::PageGroup::removeAllUserContent): Deleted.
* page/PageGroup.h:

Source/WebKit/mac:

Use the user content controller in the web view group.

* WebView/WebView.mm:
(-[WebView _injectOutlookQuirksScript]):

Source/WebKit2:

* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::addUserScript):
(WebKit::InjectedBundle::addUserStyleSheet):
(WebKit::InjectedBundle::removeUserScript):
(WebKit::InjectedBundle::removeUserStyleSheet):
(WebKit::InjectedBundle::removeUserScripts):
(WebKit::InjectedBundle::removeUserStyleSheets):
(WebKit::InjectedBundle::removeAllUserContent):
Talk to the user content controller from the passed in WebPageGroupProxy.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
Create the WebPageGroupProxy before creating the page so we can get its user content controller and
pass it to the page configuration if necessary.

* WebProcess/WebPage/WebPageGroupProxy.cpp:
(WebKit::WebPageGroupProxy::userContentController):
New function that lazily creates a user content controller. We don't want to create this eagerly since
it's not used with the modern API.

(WebKit::WebPageGroupProxy::addUserStyleSheet):
(WebKit::WebPageGroupProxy::addUserScript):
(WebKit::WebPageGroupProxy::removeAllUserStyleSheets):
(WebKit::WebPageGroupProxy::removeAllUserScripts):
(WebKit::WebPageGroupProxy::removeAllUserContent):
Call through to the user content controller.

* WebProcess/WebPage/WebPageGroupProxy.h:
Add an m_userContentController member.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCorepagePageGroupcpp">trunk/Source/WebCore/page/PageGroup.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageGrouph">trunk/Source/WebCore/page/PageGroup.h</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlecpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageGroupProxycpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageGroupProxyh">trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176543 => 176544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-11-25 18:05:39 UTC (rev 176543)
+++ trunk/Source/WebCore/ChangeLog        2014-11-25 19:50:45 UTC (rev 176544)
</span><span class="lines">@@ -1,5 +1,29 @@
</span><span class="cx"> 2014-11-25  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Remove user content handling from PageGroup
+        https://bugs.webkit.org/show_bug.cgi?id=139051
+
+        Reviewed by Antti Koivisto.
+
+        Remove m_userContentController from PageGroup and the related functions and symbol exports.
+
+        * WebCore.exp.in:
+        * page/PageGroup.cpp:
+        (WebCore::PageGroup::PageGroup):
+        (WebCore::PageGroup::~PageGroup):
+        (WebCore::PageGroup::addPage):
+        (WebCore::PageGroup::removePage):
+        (WebCore::PageGroup::addUserScriptToWorld): Deleted.
+        (WebCore::PageGroup::addUserStyleSheetToWorld): Deleted.
+        (WebCore::PageGroup::removeUserScriptFromWorld): Deleted.
+        (WebCore::PageGroup::removeUserStyleSheetFromWorld): Deleted.
+        (WebCore::PageGroup::removeUserScriptsFromWorld): Deleted.
+        (WebCore::PageGroup::removeUserStyleSheetsFromWorld): Deleted.
+        (WebCore::PageGroup::removeAllUserContent): Deleted.
+        * page/PageGroup.h:
+
+2014-11-25  Anders Carlsson  &lt;andersca@apple.com&gt;
+
</ins><span class="cx">         Add a user content controller to WebViewGroup and use it for user content
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=139043
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (176543 => 176544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-11-25 18:05:39 UTC (rev 176543)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-11-25 19:50:45 UTC (rev 176544)
</span><span class="lines">@@ -1554,16 +1554,9 @@
</span><span class="cx"> __ZN7WebCore9PageGroup16syncLocalStorageEv
</span><span class="cx"> __ZN7WebCore9PageGroup17closeLocalStorageEv
</span><span class="cx"> __ZN7WebCore9PageGroup18addVisitedLinkHashEy
</span><del>-__ZN7WebCore9PageGroup20addUserScriptToWorldERNS_15DOMWrapperWorldERKN3WTF6StringERKNS_3URLERKNS3_6VectorIS4_Lj0ENS3_15CrashOnOverflowEEESE_NS_23UserScriptInjectionTimeENS_25UserContentInjectedFramesE
-__ZN7WebCore9PageGroup20removeAllUserContentEv
</del><span class="cx"> __ZN7WebCore9PageGroup21removeAllVisitedLinksEv
</span><del>-__ZN7WebCore9PageGroup24addUserStyleSheetToWorldERNS_15DOMWrapperWorldERKN3WTF6StringERKNS_3URLERKNS3_6VectorIS4_Lj0ENS3_15CrashOnOverflowEEESE_NS_25UserContentInjectedFramesENS_14UserStyleLevelENS_22UserStyleInjectionTimeE
-__ZN7WebCore9PageGroup25removeUserScriptFromWorldERNS_15DOMWrapperWorldERKNS_3URLE
-__ZN7WebCore9PageGroup26removeUserScriptsFromWorldERNS_15DOMWrapperWorldE
</del><span class="cx"> __ZN7WebCore9PageGroup26setShouldTrackVisitedLinksEb
</span><del>-__ZN7WebCore9PageGroup29removeUserStyleSheetFromWorldERNS_15DOMWrapperWorldERKNS_3URLE
</del><span class="cx"> __ZN7WebCore9PageGroup30closeIdleLocalStorageDatabasesEv
</span><del>-__ZN7WebCore9PageGroup30removeUserStyleSheetsFromWorldERNS_15DOMWrapperWorldE
</del><span class="cx"> __ZN7WebCore9PageGroup9pageGroupERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore9Scrollbar11mouseExitedEv
</span><span class="cx"> __ZN7WebCore9Scrollbar12mouseEnteredEv
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageGroupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageGroup.cpp (176543 => 176544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageGroup.cpp        2014-11-25 18:05:39 UTC (rev 176543)
+++ trunk/Source/WebCore/page/PageGroup.cpp        2014-11-25 19:50:45 UTC (rev 176544)
</span><span class="lines">@@ -39,7 +39,6 @@
</span><span class="cx"> #include &quot;SecurityOrigin.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> #include &quot;StorageNamespace.h&quot;
</span><del>-#include &quot;UserContentController.h&quot;
</del><span class="cx"> #include &quot;VisitedLinkStore.h&quot;
</span><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -67,7 +66,6 @@
</span><span class="cx">     : m_name(name)
</span><span class="cx">     , m_visitedLinksPopulated(false)
</span><span class="cx">     , m_identifier(getUniqueIdentifier())
</span><del>-    , m_userContentController(UserContentController::create())
</del><span class="cx">     , m_groupSettings(std::make_unique&lt;GroupSettings&gt;())
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -75,7 +73,6 @@
</span><span class="cx"> PageGroup::PageGroup(Page&amp; page)
</span><span class="cx">     : m_visitedLinksPopulated(false)
</span><span class="cx">     , m_identifier(getUniqueIdentifier())
</span><del>-    , m_userContentController(UserContentController::create())
</del><span class="cx">     , m_groupSettings(std::make_unique&lt;GroupSettings&gt;())
</span><span class="cx"> {
</span><span class="cx">     addPage(page);
</span><span class="lines">@@ -83,7 +80,6 @@
</span><span class="cx"> 
</span><span class="cx"> PageGroup::~PageGroup()
</span><span class="cx"> {
</span><del>-    removeAllUserContent();
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> typedef HashMap&lt;String, PageGroup*&gt; PageGroupMap;
</span><span class="lines">@@ -166,18 +162,12 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_pages.contains(&amp;page));
</span><span class="cx">     m_pages.add(&amp;page);
</span><del>-
-    if (!page.userContentController())
-        page.setUserContentController(m_userContentController.get());
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PageGroup::removePage(Page&amp; page)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_pages.contains(&amp;page));
</span><span class="cx">     m_pages.remove(&amp;page);
</span><del>-
-    if (page.userContentController() == m_userContentController)
-        page.setUserContentController(nullptr);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> VisitedLinkStore&amp; PageGroup::visitedLinkStore()
</span><span class="lines">@@ -286,44 +276,6 @@
</span><span class="cx">     return result.iterator-&gt;value.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PageGroup::addUserScriptToWorld(DOMWrapperWorld&amp; world, const String&amp; source, const URL&amp; url, const Vector&lt;String&gt;&amp; whitelist, const Vector&lt;String&gt;&amp; blacklist, UserScriptInjectionTime injectionTime, UserContentInjectedFrames injectedFrames)
-{
-    auto userScript = std::make_unique&lt;UserScript&gt;(source, url, whitelist, blacklist, injectionTime, injectedFrames);
-    m_userContentController-&gt;addUserScript(world, WTF::move(userScript));
-}
-
-void PageGroup::addUserStyleSheetToWorld(DOMWrapperWorld&amp; world, const String&amp; source, const URL&amp; url, const Vector&lt;String&gt;&amp; whitelist, const Vector&lt;String&gt;&amp; blacklist, UserContentInjectedFrames injectedFrames, UserStyleLevel level, UserStyleInjectionTime injectionTime)
-{
-    auto userStyleSheet = std::make_unique&lt;UserStyleSheet&gt;(source, url, whitelist, blacklist, injectedFrames, level);
-    m_userContentController-&gt;addUserStyleSheet(world, WTF::move(userStyleSheet), injectionTime);
-
-}
-
-void PageGroup::removeUserScriptFromWorld(DOMWrapperWorld&amp; world, const URL&amp; url)
-{
-    m_userContentController-&gt;removeUserScript(world, url);
-}
-
-void PageGroup::removeUserStyleSheetFromWorld(DOMWrapperWorld&amp; world, const URL&amp; url)
-{
-    m_userContentController-&gt;removeUserStyleSheet(world, url);
-}
-
-void PageGroup::removeUserScriptsFromWorld(DOMWrapperWorld&amp; world)
-{
-    m_userContentController-&gt;removeUserScripts(world);
-}
-
-void PageGroup::removeUserStyleSheetsFromWorld(DOMWrapperWorld&amp; world)
-{
-    m_userContentController-&gt;removeUserStyleSheets(world);
-}
-
-void PageGroup::removeAllUserContent()
-{
-    m_userContentController-&gt;removeAllUserContent();
-}
-
</del><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> void PageGroup::captionPreferencesChanged()
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageGrouph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageGroup.h (176543 => 176544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageGroup.h        2014-11-25 18:05:39 UTC (rev 176543)
+++ trunk/Source/WebCore/page/PageGroup.h        2014-11-25 19:50:45 UTC (rev 176544)
</span><span class="lines">@@ -43,7 +43,6 @@
</span><span class="cx">     class SecurityOrigin;
</span><span class="cx">     class StorageNamespace;
</span><span class="cx">     class VisitedLinkStore;
</span><del>-    class UserContentController;
</del><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx">     class CaptionPreferencesChangedListener;
</span><span class="lines">@@ -93,14 +92,6 @@
</span><span class="cx"> 
</span><span class="cx">         StorageNamespace* transientLocalStorage(SecurityOrigin* topOrigin);
</span><span class="cx"> 
</span><del>-        WEBCORE_EXPORT void addUserScriptToWorld(DOMWrapperWorld&amp;, const String&amp; source, const URL&amp;, const Vector&lt;String&gt;&amp; whitelist, const Vector&lt;String&gt;&amp; blacklist, UserScriptInjectionTime, UserContentInjectedFrames);
-        WEBCORE_EXPORT void addUserStyleSheetToWorld(DOMWrapperWorld&amp;, const String&amp; source, const URL&amp;, const Vector&lt;String&gt;&amp; whitelist, const Vector&lt;String&gt;&amp; blacklist, UserContentInjectedFrames, UserStyleLevel = UserStyleUserLevel, UserStyleInjectionTime = InjectInExistingDocuments);
-        WEBCORE_EXPORT void removeUserStyleSheetFromWorld(DOMWrapperWorld&amp;, const URL&amp;);
-        WEBCORE_EXPORT void removeUserScriptFromWorld(DOMWrapperWorld&amp;, const URL&amp;);
-        WEBCORE_EXPORT void removeUserScriptsFromWorld(DOMWrapperWorld&amp;);
-        WEBCORE_EXPORT void removeUserStyleSheetsFromWorld(DOMWrapperWorld&amp;);
-        WEBCORE_EXPORT void removeAllUserContent();
-
</del><span class="cx">         GroupSettings&amp; groupSettings() const { return *m_groupSettings; }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="lines">@@ -123,8 +114,6 @@
</span><span class="cx">         RefPtr&lt;StorageNamespace&gt; m_localStorage;
</span><span class="cx">         HashMap&lt;RefPtr&lt;SecurityOrigin&gt;, RefPtr&lt;StorageNamespace&gt;&gt; m_transientLocalStorageMap;
</span><span class="cx"> 
</span><del>-        RefPtr&lt;UserContentController&gt; m_userContentController;
-
</del><span class="cx">         const std::unique_ptr&lt;GroupSettings&gt; m_groupSettings;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (176543 => 176544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-11-25 18:05:39 UTC (rev 176543)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-11-25 19:50:45 UTC (rev 176544)
</span><span class="lines">@@ -1,5 +1,17 @@
</span><span class="cx"> 2014-11-25  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Remove user content handling from PageGroup
+        https://bugs.webkit.org/show_bug.cgi?id=139051
+
+        Reviewed by Antti Koivisto.
+
+        Use the user content controller in the web view group.
+
+        * WebView/WebView.mm:
+        (-[WebView _injectOutlookQuirksScript]):
+
+2014-11-25  Anders Carlsson  &lt;andersca@apple.com&gt;
+
</ins><span class="cx">         Add a user content controller to WebViewGroup and use it for user content
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=139043
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (176543 => 176544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2014-11-25 18:05:39 UTC (rev 176543)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2014-11-25 19:50:45 UTC (rev 176544)
</span><span class="lines">@@ -780,8 +780,8 @@
</span><span class="cx"> -(void)_injectOutlookQuirksScript
</span><span class="cx"> {
</span><span class="cx">     static NSString *outlookQuirksScriptContents = leakOutlookQuirksUserScriptContents();
</span><del>-    core(self)-&gt;group().addUserScriptToWorld(*core([WebScriptWorld world]),
-        outlookQuirksScriptContents, URL(), Vector&lt;String&gt;(), Vector&lt;String&gt;(), InjectAtDocumentEnd, InjectInAllFrames);
</del><ins>+    _private-&gt;group-&gt;userContentController().addUserScript(*core([WebScriptWorld world]), std::make_unique&lt;UserScript&gt;(outlookQuirksScriptContents, URL(), Vector&lt;String&gt;(), Vector&lt;String&gt;(), InjectAtDocumentEnd, InjectInAllFrames));
+
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (176543 => 176544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-11-25 18:05:39 UTC (rev 176543)
+++ trunk/Source/WebKit2/ChangeLog        2014-11-25 19:50:45 UTC (rev 176544)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2014-11-25  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Remove user content handling from PageGroup
+        https://bugs.webkit.org/show_bug.cgi?id=139051
+
+        Reviewed by Antti Koivisto.
+
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::addUserScript):
+        (WebKit::InjectedBundle::addUserStyleSheet):
+        (WebKit::InjectedBundle::removeUserScript):
+        (WebKit::InjectedBundle::removeUserStyleSheet):
+        (WebKit::InjectedBundle::removeUserScripts):
+        (WebKit::InjectedBundle::removeUserStyleSheets):
+        (WebKit::InjectedBundle::removeAllUserContent):
+        Talk to the user content controller from the passed in WebPageGroupProxy.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+        Create the WebPageGroupProxy before creating the page so we can get its user content controller and
+        pass it to the page configuration if necessary.
+        
+        * WebProcess/WebPage/WebPageGroupProxy.cpp:
+        (WebKit::WebPageGroupProxy::userContentController):
+        New function that lazily creates a user content controller. We don't want to create this eagerly since
+        it's not used with the modern API.
+
+        (WebKit::WebPageGroupProxy::addUserStyleSheet):
+        (WebKit::WebPageGroupProxy::addUserScript):
+        (WebKit::WebPageGroupProxy::removeAllUserStyleSheets):
+        (WebKit::WebPageGroupProxy::removeAllUserScripts):
+        (WebKit::WebPageGroupProxy::removeAllUserContent):
+        Call through to the user content controller.
+
+        * WebProcess/WebPage/WebPageGroupProxy.h:
+        Add an m_userContentController member.
+
</ins><span class="cx"> 2014-11-25  Ting-Wei Lan  &lt;lantw44@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Use LD_LIBRARY_PATH to make g-ir-scanner use the newly-built
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (176543 => 176544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp        2014-11-25 18:05:39 UTC (rev 176543)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp        2014-11-25 19:50:45 UTC (rev 176544)
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx"> #include &lt;WebCore/SecurityPolicy.h&gt;
</span><span class="cx"> #include &lt;WebCore/SessionID.h&gt;
</span><span class="cx"> #include &lt;WebCore/Settings.h&gt;
</span><ins>+#include &lt;WebCore/UserContentController.h&gt;
</ins><span class="cx"> #include &lt;WebCore/UserGestureIndicator.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS_REGIONS) || ENABLE(CSS_COMPOSITING)
</span><span class="lines">@@ -475,40 +476,44 @@
</span><span class="cx"> void InjectedBundle::addUserScript(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String&amp; source, const String&amp; url, API::Array* whitelist, API::Array* blacklist, WebCore::UserScriptInjectionTime injectionTime, WebCore::UserContentInjectedFrames injectedFrames)
</span><span class="cx"> {
</span><span class="cx">     // url is not from URL::string(), i.e. it has not already been parsed by URL, so we have to use the relative URL constructor for URL instead of the ParsedURLStringTag version.
</span><del>-    PageGroup::pageGroup(pageGroup-&gt;identifier())-&gt;addUserScriptToWorld(scriptWorld-&gt;coreWorld(), source, URL(URL(), url), whitelist ? whitelist-&gt;toStringVector() : Vector&lt;String&gt;(), blacklist ? blacklist-&gt;toStringVector() : Vector&lt;String&gt;(), injectionTime, injectedFrames);
</del><ins>+    auto userScript = std::make_unique&lt;UserScript&gt;(source, URL(URL(), url), whitelist ? whitelist-&gt;toStringVector() : Vector&lt;String&gt;(), blacklist ? blacklist-&gt;toStringVector() : Vector&lt;String&gt;(), injectionTime, injectedFrames);
+
+    pageGroup-&gt;userContentController().addUserScript(scriptWorld-&gt;coreWorld(), WTF::move(userScript));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InjectedBundle::addUserStyleSheet(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String&amp; source, const String&amp; url, API::Array* whitelist, API::Array* blacklist, WebCore::UserContentInjectedFrames injectedFrames)
</span><span class="cx"> {
</span><span class="cx">     // url is not from URL::string(), i.e. it has not already been parsed by URL, so we have to use the relative URL constructor for URL instead of the ParsedURLStringTag version.
</span><del>-    PageGroup::pageGroup(pageGroup-&gt;identifier())-&gt;addUserStyleSheetToWorld(scriptWorld-&gt;coreWorld(), source, URL(URL(), url), whitelist ? whitelist-&gt;toStringVector() : Vector&lt;String&gt;(), blacklist ? blacklist-&gt;toStringVector() : Vector&lt;String&gt;(), injectedFrames);
</del><ins>+    auto userStyleSheet = std::make_unique&lt;UserStyleSheet&gt;(source, URL(URL(), url), whitelist ? whitelist-&gt;toStringVector() : Vector&lt;String&gt;(), blacklist ? blacklist-&gt;toStringVector() : Vector&lt;String&gt;(), injectedFrames, UserStyleUserLevel);
+
+    pageGroup-&gt;userContentController().addUserStyleSheet(scriptWorld-&gt;coreWorld(), WTF::move(userStyleSheet), InjectInExistingDocuments);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InjectedBundle::removeUserScript(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String&amp; url)
</span><span class="cx"> {
</span><span class="cx">     // url is not from URL::string(), i.e. it has not already been parsed by URL, so we have to use the relative URL constructor for URL instead of the ParsedURLStringTag version.
</span><del>-    PageGroup::pageGroup(pageGroup-&gt;identifier())-&gt;removeUserScriptFromWorld(scriptWorld-&gt;coreWorld(), URL(URL(), url));
</del><ins>+    pageGroup-&gt;userContentController().removeUserScript(scriptWorld-&gt;coreWorld(), URL(URL(), url));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InjectedBundle::removeUserStyleSheet(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String&amp; url)
</span><span class="cx"> {
</span><span class="cx">     // url is not from URL::string(), i.e. it has not already been parsed by URL, so we have to use the relative URL constructor for URL instead of the ParsedURLStringTag version.
</span><del>-    PageGroup::pageGroup(pageGroup-&gt;identifier())-&gt;removeUserStyleSheetFromWorld(scriptWorld-&gt;coreWorld(), URL(URL(), url));
</del><ins>+    pageGroup-&gt;userContentController().removeUserStyleSheet(scriptWorld-&gt;coreWorld(), URL(URL(), url));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InjectedBundle::removeUserScripts(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld)
</span><span class="cx"> {
</span><del>-    PageGroup::pageGroup(pageGroup-&gt;identifier())-&gt;removeUserScriptsFromWorld(scriptWorld-&gt;coreWorld());
</del><ins>+    pageGroup-&gt;userContentController().removeUserScripts(scriptWorld-&gt;coreWorld());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InjectedBundle::removeUserStyleSheets(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld)
</span><span class="cx"> {
</span><del>-    PageGroup::pageGroup(pageGroup-&gt;identifier())-&gt;removeUserStyleSheetsFromWorld(scriptWorld-&gt;coreWorld());
</del><ins>+    pageGroup-&gt;userContentController().removeUserStyleSheets(scriptWorld-&gt;coreWorld());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InjectedBundle::removeAllUserContent(WebPageGroupProxy* pageGroup)
</span><span class="cx"> {
</span><del>-    PageGroup::pageGroup(pageGroup-&gt;identifier())-&gt;removeAllUserContent();
</del><ins>+    pageGroup-&gt;userContentController().removeAllUserContent();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InjectedBundle::garbageCollectJavaScriptObjects()
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (176543 => 176544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-11-25 18:05:39 UTC (rev 176543)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-11-25 19:50:45 UTC (rev 176544)
</span><span class="lines">@@ -337,6 +337,8 @@
</span><span class="cx">     // 4ms should be adopted project-wide now, https://bugs.webkit.org/show_bug.cgi?id=61214
</span><span class="cx">     Settings::setDefaultMinDOMTimerInterval(0.004);
</span><span class="cx"> 
</span><ins>+    m_pageGroup = WebProcess::shared().webPageGroup(parameters.pageGroupData);
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     Settings::setShouldManageAudioSessionCategory(true);
</span><span class="cx"> #endif
</span><span class="lines">@@ -363,7 +365,7 @@
</span><span class="cx">     pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(*this);
</span><span class="cx">     pageConfiguration.diagnosticLoggingClient = new WebDiagnosticLoggingClient(*this);
</span><span class="cx"> 
</span><del>-    pageConfiguration.userContentController = m_userContentController ? &amp;m_userContentController-&gt;userContentController() : nullptr;
</del><ins>+    pageConfiguration.userContentController = m_userContentController ? &amp;m_userContentController-&gt;userContentController() : &amp;m_pageGroup-&gt;userContentController();
</ins><span class="cx">     pageConfiguration.visitedLinkStore = VisitedLinkTableController::getOrCreate(parameters.visitedLinkTableID);
</span><span class="cx"> 
</span><span class="cx">     m_page = std::make_unique&lt;Page&gt;(pageConfiguration);
</span><span class="lines">@@ -406,7 +408,6 @@
</span><span class="cx">     m_page-&gt;setCanStartMedia(false);
</span><span class="cx">     m_mayStartMediaWhenInWindow = parameters.mayStartMediaWhenInWindow;
</span><span class="cx"> 
</span><del>-    m_pageGroup = WebProcess::shared().webPageGroup(parameters.pageGroupData);
</del><span class="cx">     m_page-&gt;setGroupName(m_pageGroup-&gt;identifier());
</span><span class="cx">     m_page-&gt;setDeviceScaleFactor(parameters.deviceScaleFactor);
</span><span class="cx"> #if PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageGroupProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp (176543 => 176544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp        2014-11-25 18:05:39 UTC (rev 176543)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp        2014-11-25 19:50:45 UTC (rev 176544)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;InjectedBundle.h&quot;
</span><span class="cx"> #include &lt;WebCore/DOMWrapperWorld.h&gt;
</span><span class="cx"> #include &lt;WebCore/PageGroup.h&gt;
</span><ins>+#include &lt;WebCore/UserContentController.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="lines">@@ -43,10 +44,6 @@
</span><span class="cx">     return pageGroup.release();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WebPageGroupProxy::~WebPageGroupProxy()
-{
-}
-
</del><span class="cx"> WebPageGroupProxy::WebPageGroupProxy(const WebPageGroupData&amp; data)
</span><span class="cx">     : m_data(data)
</span><span class="cx">     , m_pageGroup(WebCore::PageGroup::pageGroup(m_data.identifer))
</span><span class="lines">@@ -57,29 +54,41 @@
</span><span class="cx">         addUserScript(data.userScripts[i]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+WebPageGroupProxy::~WebPageGroupProxy()
+{
+}
+
+WebCore::UserContentController&amp; WebPageGroupProxy::userContentController()
+{
+    if (!m_userContentController)
+        m_userContentController = WebCore::UserContentController::create();
+
+    return *m_userContentController;
+}
+
</ins><span class="cx"> void WebPageGroupProxy::addUserStyleSheet(const WebCore::UserStyleSheet&amp; userStyleSheet)
</span><span class="cx"> {
</span><del>-    m_pageGroup-&gt;addUserStyleSheetToWorld(WebCore::mainThreadNormalWorld(), userStyleSheet.source(), userStyleSheet.url(), userStyleSheet.whitelist(), userStyleSheet.blacklist(), userStyleSheet.injectedFrames(), userStyleSheet.level());
</del><ins>+    userContentController().addUserStyleSheet(WebCore::mainThreadNormalWorld(), std::make_unique&lt;WebCore::UserStyleSheet&gt;(userStyleSheet), WebCore::InjectInExistingDocuments);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageGroupProxy::addUserScript(const WebCore::UserScript&amp; userScript)
</span><span class="cx"> {
</span><del>-    m_pageGroup-&gt;addUserScriptToWorld(WebCore::mainThreadNormalWorld(), userScript.source(), userScript.url(), userScript.whitelist(), userScript.blacklist(), userScript.injectionTime(), userScript.injectedFrames());
</del><ins>+    userContentController().addUserScript(WebCore::mainThreadNormalWorld(), std::make_unique&lt;WebCore::UserScript&gt;(userScript));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageGroupProxy::removeAllUserStyleSheets()
</span><span class="cx"> {
</span><del>-    m_pageGroup-&gt;removeUserStyleSheetsFromWorld(WebCore::mainThreadNormalWorld());
</del><ins>+    userContentController().removeUserStyleSheets(WebCore::mainThreadNormalWorld());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageGroupProxy::removeAllUserScripts()
</span><span class="cx"> {
</span><del>-    m_pageGroup-&gt;removeUserScriptsFromWorld(WebCore::mainThreadNormalWorld());
</del><ins>+    userContentController().removeUserScripts(WebCore::mainThreadNormalWorld());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageGroupProxy::removeAllUserContent()
</span><span class="cx"> {
</span><del>-    m_pageGroup-&gt;removeAllUserContent();
</del><ins>+    userContentController().removeAllUserContent();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageGroupProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h (176543 => 176544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h        2014-11-25 18:05:39 UTC (rev 176543)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h        2014-11-25 19:50:45 UTC (rev 176544)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> class PageGroup;
</span><ins>+class UserContentController;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -52,19 +53,23 @@
</span><span class="cx">     bool isVisibleToHistoryClient() const { return m_data.visibleToHistoryClient; }
</span><span class="cx">     WebCore::PageGroup* corePageGroup() const { return m_pageGroup; }
</span><span class="cx"> 
</span><ins>+    WebCore::UserContentController&amp; userContentController();
+
</ins><span class="cx">     void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&amp;);
</span><span class="cx"> 
</span><del>-private:
-    WebPageGroupProxy(const WebPageGroupData&amp;);
-
</del><span class="cx">     void addUserStyleSheet(const WebCore::UserStyleSheet&amp;);
</span><span class="cx">     void addUserScript(const WebCore::UserScript&amp;);
</span><span class="cx">     void removeAllUserStyleSheets();
</span><span class="cx">     void removeAllUserScripts();
</span><span class="cx">     void removeAllUserContent();
</span><span class="cx"> 
</span><ins>+private:
+    WebPageGroupProxy(const WebPageGroupData&amp;);
+
</ins><span class="cx">     WebPageGroupData m_data;
</span><span class="cx">     WebCore::PageGroup* m_pageGroup;
</span><ins>+
+    RefPtr&lt;WebCore::UserContentController&gt; m_userContentController;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre>
</div>
</div>

</body>
</html>