Title: [176544] trunk/Source
Revision
176544
Author
[email protected]
Date
2014-11-25 11:50:45 -0800 (Tue, 25 Nov 2014)

Log Message

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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (176543 => 176544)


--- 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)
@@ -1,5 +1,29 @@
 2014-11-25  Anders Carlsson  <[email protected]>
 
+        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  <[email protected]>
+
         Add a user content controller to WebViewGroup and use it for user content
         https://bugs.webkit.org/show_bug.cgi?id=139043
 

Modified: trunk/Source/WebCore/WebCore.exp.in (176543 => 176544)


--- 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)
@@ -1554,16 +1554,9 @@
 __ZN7WebCore9PageGroup16syncLocalStorageEv
 __ZN7WebCore9PageGroup17closeLocalStorageEv
 __ZN7WebCore9PageGroup18addVisitedLinkHashEy
-__ZN7WebCore9PageGroup20addUserScriptToWorldERNS_15DOMWrapperWorldERKN3WTF6StringERKNS_3URLERKNS3_6VectorIS4_Lj0ENS3_15CrashOnOverflowEEESE_NS_23UserScriptInjectionTimeENS_25UserContentInjectedFramesE
-__ZN7WebCore9PageGroup20removeAllUserContentEv
 __ZN7WebCore9PageGroup21removeAllVisitedLinksEv
-__ZN7WebCore9PageGroup24addUserStyleSheetToWorldERNS_15DOMWrapperWorldERKN3WTF6StringERKNS_3URLERKNS3_6VectorIS4_Lj0ENS3_15CrashOnOverflowEEESE_NS_25UserContentInjectedFramesENS_14UserStyleLevelENS_22UserStyleInjectionTimeE
-__ZN7WebCore9PageGroup25removeUserScriptFromWorldERNS_15DOMWrapperWorldERKNS_3URLE
-__ZN7WebCore9PageGroup26removeUserScriptsFromWorldERNS_15DOMWrapperWorldE
 __ZN7WebCore9PageGroup26setShouldTrackVisitedLinksEb
-__ZN7WebCore9PageGroup29removeUserStyleSheetFromWorldERNS_15DOMWrapperWorldERKNS_3URLE
 __ZN7WebCore9PageGroup30closeIdleLocalStorageDatabasesEv
-__ZN7WebCore9PageGroup30removeUserStyleSheetsFromWorldERNS_15DOMWrapperWorldE
 __ZN7WebCore9PageGroup9pageGroupERKN3WTF6StringE
 __ZN7WebCore9Scrollbar11mouseExitedEv
 __ZN7WebCore9Scrollbar12mouseEnteredEv

Modified: trunk/Source/WebCore/page/PageGroup.cpp (176543 => 176544)


--- 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)
@@ -39,7 +39,6 @@
 #include "SecurityOrigin.h"
 #include "Settings.h"
 #include "StorageNamespace.h"
-#include "UserContentController.h"
 #include "VisitedLinkStore.h"
 #include <wtf/StdLibExtras.h>
 
@@ -67,7 +66,6 @@
     : m_name(name)
     , m_visitedLinksPopulated(false)
     , m_identifier(getUniqueIdentifier())
-    , m_userContentController(UserContentController::create())
     , m_groupSettings(std::make_unique<GroupSettings>())
 {
 }
@@ -75,7 +73,6 @@
 PageGroup::PageGroup(Page& page)
     : m_visitedLinksPopulated(false)
     , m_identifier(getUniqueIdentifier())
-    , m_userContentController(UserContentController::create())
     , m_groupSettings(std::make_unique<GroupSettings>())
 {
     addPage(page);
@@ -83,7 +80,6 @@
 
 PageGroup::~PageGroup()
 {
-    removeAllUserContent();
 }
 
 typedef HashMap<String, PageGroup*> PageGroupMap;
@@ -166,18 +162,12 @@
 {
     ASSERT(!m_pages.contains(&page));
     m_pages.add(&page);
-
-    if (!page.userContentController())
-        page.setUserContentController(m_userContentController.get());
 }
 
 void PageGroup::removePage(Page& page)
 {
     ASSERT(m_pages.contains(&page));
     m_pages.remove(&page);
-
-    if (page.userContentController() == m_userContentController)
-        page.setUserContentController(nullptr);
 }
 
 VisitedLinkStore& PageGroup::visitedLinkStore()
@@ -286,44 +276,6 @@
     return result.iterator->value.get();
 }
 
-void PageGroup::addUserScriptToWorld(DOMWrapperWorld& world, const String& source, const URL& url, const Vector<String>& whitelist, const Vector<String>& blacklist, UserScriptInjectionTime injectionTime, UserContentInjectedFrames injectedFrames)
-{
-    auto userScript = std::make_unique<UserScript>(source, url, whitelist, blacklist, injectionTime, injectedFrames);
-    m_userContentController->addUserScript(world, WTF::move(userScript));
-}
-
-void PageGroup::addUserStyleSheetToWorld(DOMWrapperWorld& world, const String& source, const URL& url, const Vector<String>& whitelist, const Vector<String>& blacklist, UserContentInjectedFrames injectedFrames, UserStyleLevel level, UserStyleInjectionTime injectionTime)
-{
-    auto userStyleSheet = std::make_unique<UserStyleSheet>(source, url, whitelist, blacklist, injectedFrames, level);
-    m_userContentController->addUserStyleSheet(world, WTF::move(userStyleSheet), injectionTime);
-
-}
-
-void PageGroup::removeUserScriptFromWorld(DOMWrapperWorld& world, const URL& url)
-{
-    m_userContentController->removeUserScript(world, url);
-}
-
-void PageGroup::removeUserStyleSheetFromWorld(DOMWrapperWorld& world, const URL& url)
-{
-    m_userContentController->removeUserStyleSheet(world, url);
-}
-
-void PageGroup::removeUserScriptsFromWorld(DOMWrapperWorld& world)
-{
-    m_userContentController->removeUserScripts(world);
-}
-
-void PageGroup::removeUserStyleSheetsFromWorld(DOMWrapperWorld& world)
-{
-    m_userContentController->removeUserStyleSheets(world);
-}
-
-void PageGroup::removeAllUserContent()
-{
-    m_userContentController->removeAllUserContent();
-}
-
 #if ENABLE(VIDEO_TRACK)
 void PageGroup::captionPreferencesChanged()
 {

Modified: trunk/Source/WebCore/page/PageGroup.h (176543 => 176544)


--- 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)
@@ -43,7 +43,6 @@
     class SecurityOrigin;
     class StorageNamespace;
     class VisitedLinkStore;
-    class UserContentController;
 
 #if ENABLE(VIDEO_TRACK)
     class CaptionPreferencesChangedListener;
@@ -93,14 +92,6 @@
 
         StorageNamespace* transientLocalStorage(SecurityOrigin* topOrigin);
 
-        WEBCORE_EXPORT void addUserScriptToWorld(DOMWrapperWorld&, const String& source, const URL&, const Vector<String>& whitelist, const Vector<String>& blacklist, UserScriptInjectionTime, UserContentInjectedFrames);
-        WEBCORE_EXPORT void addUserStyleSheetToWorld(DOMWrapperWorld&, const String& source, const URL&, const Vector<String>& whitelist, const Vector<String>& blacklist, UserContentInjectedFrames, UserStyleLevel = UserStyleUserLevel, UserStyleInjectionTime = InjectInExistingDocuments);
-        WEBCORE_EXPORT void removeUserStyleSheetFromWorld(DOMWrapperWorld&, const URL&);
-        WEBCORE_EXPORT void removeUserScriptFromWorld(DOMWrapperWorld&, const URL&);
-        WEBCORE_EXPORT void removeUserScriptsFromWorld(DOMWrapperWorld&);
-        WEBCORE_EXPORT void removeUserStyleSheetsFromWorld(DOMWrapperWorld&);
-        WEBCORE_EXPORT void removeAllUserContent();
-
         GroupSettings& groupSettings() const { return *m_groupSettings; }
 
 #if ENABLE(VIDEO_TRACK)
@@ -123,8 +114,6 @@
         RefPtr<StorageNamespace> m_localStorage;
         HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageNamespace>> m_transientLocalStorageMap;
 
-        RefPtr<UserContentController> m_userContentController;
-
         const std::unique_ptr<GroupSettings> m_groupSettings;
 
 #if ENABLE(VIDEO_TRACK)

Modified: trunk/Source/WebKit/mac/ChangeLog (176543 => 176544)


--- 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)
@@ -1,5 +1,17 @@
 2014-11-25  Anders Carlsson  <[email protected]>
 
+        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  <[email protected]>
+
         Add a user content controller to WebViewGroup and use it for user content
         https://bugs.webkit.org/show_bug.cgi?id=139043
 

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (176543 => 176544)


--- 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)
@@ -780,8 +780,8 @@
 -(void)_injectOutlookQuirksScript
 {
     static NSString *outlookQuirksScriptContents = leakOutlookQuirksUserScriptContents();
-    core(self)->group().addUserScriptToWorld(*core([WebScriptWorld world]),
-        outlookQuirksScriptContents, URL(), Vector<String>(), Vector<String>(), InjectAtDocumentEnd, InjectInAllFrames);
+    _private->group->userContentController().addUserScript(*core([WebScriptWorld world]), std::make_unique<UserScript>(outlookQuirksScriptContents, URL(), Vector<String>(), Vector<String>(), InjectAtDocumentEnd, InjectInAllFrames));
+
 }
 #endif
 

Modified: trunk/Source/WebKit2/ChangeLog (176543 => 176544)


--- 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)
@@ -1,3 +1,40 @@
+2014-11-25  Anders Carlsson  <[email protected]>
+
+        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.
+
 2014-11-25  Ting-Wei Lan  <[email protected]>
 
         [GTK] Use LD_LIBRARY_PATH to make g-ir-scanner use the newly-built

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (176543 => 176544)


--- 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)
@@ -70,6 +70,7 @@
 #include <WebCore/SecurityPolicy.h>
 #include <WebCore/SessionID.h>
 #include <WebCore/Settings.h>
+#include <WebCore/UserContentController.h>
 #include <WebCore/UserGestureIndicator.h>
 
 #if ENABLE(CSS_REGIONS) || ENABLE(CSS_COMPOSITING)
@@ -475,40 +476,44 @@
 void InjectedBundle::addUserScript(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String& source, const String& url, API::Array* whitelist, API::Array* blacklist, WebCore::UserScriptInjectionTime injectionTime, WebCore::UserContentInjectedFrames injectedFrames)
 {
     // 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.
-    PageGroup::pageGroup(pageGroup->identifier())->addUserScriptToWorld(scriptWorld->coreWorld(), source, URL(URL(), url), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), injectionTime, injectedFrames);
+    auto userScript = std::make_unique<UserScript>(source, URL(URL(), url), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), injectionTime, injectedFrames);
+
+    pageGroup->userContentController().addUserScript(scriptWorld->coreWorld(), WTF::move(userScript));
 }
 
 void InjectedBundle::addUserStyleSheet(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String& source, const String& url, API::Array* whitelist, API::Array* blacklist, WebCore::UserContentInjectedFrames injectedFrames)
 {
     // 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.
-    PageGroup::pageGroup(pageGroup->identifier())->addUserStyleSheetToWorld(scriptWorld->coreWorld(), source, URL(URL(), url), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), injectedFrames);
+    auto userStyleSheet = std::make_unique<UserStyleSheet>(source, URL(URL(), url), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), injectedFrames, UserStyleUserLevel);
+
+    pageGroup->userContentController().addUserStyleSheet(scriptWorld->coreWorld(), WTF::move(userStyleSheet), InjectInExistingDocuments);
 }
 
 void InjectedBundle::removeUserScript(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String& url)
 {
     // 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.
-    PageGroup::pageGroup(pageGroup->identifier())->removeUserScriptFromWorld(scriptWorld->coreWorld(), URL(URL(), url));
+    pageGroup->userContentController().removeUserScript(scriptWorld->coreWorld(), URL(URL(), url));
 }
 
 void InjectedBundle::removeUserStyleSheet(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String& url)
 {
     // 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.
-    PageGroup::pageGroup(pageGroup->identifier())->removeUserStyleSheetFromWorld(scriptWorld->coreWorld(), URL(URL(), url));
+    pageGroup->userContentController().removeUserStyleSheet(scriptWorld->coreWorld(), URL(URL(), url));
 }
 
 void InjectedBundle::removeUserScripts(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld)
 {
-    PageGroup::pageGroup(pageGroup->identifier())->removeUserScriptsFromWorld(scriptWorld->coreWorld());
+    pageGroup->userContentController().removeUserScripts(scriptWorld->coreWorld());
 }
 
 void InjectedBundle::removeUserStyleSheets(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld)
 {
-    PageGroup::pageGroup(pageGroup->identifier())->removeUserStyleSheetsFromWorld(scriptWorld->coreWorld());
+    pageGroup->userContentController().removeUserStyleSheets(scriptWorld->coreWorld());
 }
 
 void InjectedBundle::removeAllUserContent(WebPageGroupProxy* pageGroup)
 {
-    PageGroup::pageGroup(pageGroup->identifier())->removeAllUserContent();
+    pageGroup->userContentController().removeAllUserContent();
 }
 
 void InjectedBundle::garbageCollectJavaScriptObjects()

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (176543 => 176544)


--- 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)
@@ -337,6 +337,8 @@
     // 4ms should be adopted project-wide now, https://bugs.webkit.org/show_bug.cgi?id=61214
     Settings::setDefaultMinDOMTimerInterval(0.004);
 
+    m_pageGroup = WebProcess::shared().webPageGroup(parameters.pageGroupData);
+
 #if PLATFORM(IOS)
     Settings::setShouldManageAudioSessionCategory(true);
 #endif
@@ -363,7 +365,7 @@
     pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(*this);
     pageConfiguration.diagnosticLoggingClient = new WebDiagnosticLoggingClient(*this);
 
-    pageConfiguration.userContentController = m_userContentController ? &m_userContentController->userContentController() : nullptr;
+    pageConfiguration.userContentController = m_userContentController ? &m_userContentController->userContentController() : &m_pageGroup->userContentController();
     pageConfiguration.visitedLinkStore = VisitedLinkTableController::getOrCreate(parameters.visitedLinkTableID);
 
     m_page = std::make_unique<Page>(pageConfiguration);
@@ -406,7 +408,6 @@
     m_page->setCanStartMedia(false);
     m_mayStartMediaWhenInWindow = parameters.mayStartMediaWhenInWindow;
 
-    m_pageGroup = WebProcess::shared().webPageGroup(parameters.pageGroupData);
     m_page->setGroupName(m_pageGroup->identifier());
     m_page->setDeviceScaleFactor(parameters.deviceScaleFactor);
 #if PLATFORM(IOS)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp (176543 => 176544)


--- 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)
@@ -30,6 +30,7 @@
 #include "InjectedBundle.h"
 #include <WebCore/DOMWrapperWorld.h>
 #include <WebCore/PageGroup.h>
+#include <WebCore/UserContentController.h>
 
 namespace WebKit {
 
@@ -43,10 +44,6 @@
     return pageGroup.release();
 }
 
-WebPageGroupProxy::~WebPageGroupProxy()
-{
-}
-
 WebPageGroupProxy::WebPageGroupProxy(const WebPageGroupData& data)
     : m_data(data)
     , m_pageGroup(WebCore::PageGroup::pageGroup(m_data.identifer))
@@ -57,29 +54,41 @@
         addUserScript(data.userScripts[i]);
 }
 
+WebPageGroupProxy::~WebPageGroupProxy()
+{
+}
+
+WebCore::UserContentController& WebPageGroupProxy::userContentController()
+{
+    if (!m_userContentController)
+        m_userContentController = WebCore::UserContentController::create();
+
+    return *m_userContentController;
+}
+
 void WebPageGroupProxy::addUserStyleSheet(const WebCore::UserStyleSheet& userStyleSheet)
 {
-    m_pageGroup->addUserStyleSheetToWorld(WebCore::mainThreadNormalWorld(), userStyleSheet.source(), userStyleSheet.url(), userStyleSheet.whitelist(), userStyleSheet.blacklist(), userStyleSheet.injectedFrames(), userStyleSheet.level());
+    userContentController().addUserStyleSheet(WebCore::mainThreadNormalWorld(), std::make_unique<WebCore::UserStyleSheet>(userStyleSheet), WebCore::InjectInExistingDocuments);
 }
 
 void WebPageGroupProxy::addUserScript(const WebCore::UserScript& userScript)
 {
-    m_pageGroup->addUserScriptToWorld(WebCore::mainThreadNormalWorld(), userScript.source(), userScript.url(), userScript.whitelist(), userScript.blacklist(), userScript.injectionTime(), userScript.injectedFrames());
+    userContentController().addUserScript(WebCore::mainThreadNormalWorld(), std::make_unique<WebCore::UserScript>(userScript));
 }
 
 void WebPageGroupProxy::removeAllUserStyleSheets()
 {
-    m_pageGroup->removeUserStyleSheetsFromWorld(WebCore::mainThreadNormalWorld());
+    userContentController().removeUserStyleSheets(WebCore::mainThreadNormalWorld());
 }
 
 void WebPageGroupProxy::removeAllUserScripts()
 {
-    m_pageGroup->removeUserScriptsFromWorld(WebCore::mainThreadNormalWorld());
+    userContentController().removeUserScripts(WebCore::mainThreadNormalWorld());
 }
 
 void WebPageGroupProxy::removeAllUserContent()
 {
-    m_pageGroup->removeAllUserContent();
+    userContentController().removeAllUserContent();
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h (176543 => 176544)


--- 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)
@@ -37,6 +37,7 @@
 
 namespace WebCore {
 class PageGroup;
+class UserContentController;
 }
 
 namespace WebKit {
@@ -52,19 +53,23 @@
     bool isVisibleToHistoryClient() const { return m_data.visibleToHistoryClient; }
     WebCore::PageGroup* corePageGroup() const { return m_pageGroup; }
 
+    WebCore::UserContentController& userContentController();
+
     void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&);
 
-private:
-    WebPageGroupProxy(const WebPageGroupData&);
-
     void addUserStyleSheet(const WebCore::UserStyleSheet&);
     void addUserScript(const WebCore::UserScript&);
     void removeAllUserStyleSheets();
     void removeAllUserScripts();
     void removeAllUserContent();
 
+private:
+    WebPageGroupProxy(const WebPageGroupData&);
+
     WebPageGroupData m_data;
     WebCore::PageGroup* m_pageGroup;
+
+    RefPtr<WebCore::UserContentController> m_userContentController;
 };
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to