Title: [259159] trunk
Revision
259159
Author
[email protected]
Date
2020-03-28 09:45:56 -0700 (Sat, 28 Mar 2020)

Log Message

Deprecate injected bundle page group SPI
https://bugs.webkit.org/show_bug.cgi?id=209687

Patch by Alex Christensen <[email protected]> on 2020-03-28
Reviewed by Timothy Hatcher.

Source/WebKit:

This old code is problematic, and the use of it is being removed in rdar://problem/60987265

* Shared/WebPageGroupData.cpp:
(WebKit::WebPageGroupData::encode const):
(WebKit::WebPageGroupData::decode):
* Shared/WebPageGroupData.h:
* UIProcess/WebPageGroup.cpp:
(WebKit::WebPageGroup::WebPageGroup):
* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleAddUserScript):
(WKBundleAddUserStyleSheet):
(WKBundleRemoveUserScript):
(WKBundleRemoveUserStyleSheet):
(WKBundleRemoveUserScripts):
(WKBundleRemoveUserStyleSheets):
(WKBundleRemoveAllUserContent):
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::addUserScript): Deleted.
(WebKit::InjectedBundle::addUserStyleSheet): Deleted.
(WebKit::InjectedBundle::removeUserScript): Deleted.
(WebKit::InjectedBundle::removeUserStyleSheet): Deleted.
(WebKit::InjectedBundle::removeUserScripts): Deleted.
(WebKit::InjectedBundle::removeUserStyleSheets): Deleted.
(WebKit::InjectedBundle::removeAllUserContent): Deleted.
* WebProcess/InjectedBundle/InjectedBundle.h:
* WebProcess/WebPage/WebPageGroupProxy.cpp:
(WebKit::WebPageGroupProxy::WebPageGroupProxy):
(WebKit::WebPageGroupProxy::userContentController): Deleted.
* WebProcess/WebPage/WebPageGroupProxy.h:

Tools:

* TestWebKitAPI/Tests/WebKit/DOMWindowExtensionBasic_Bundle.cpp:
(TestWebKitAPI::DOMWindowExtensionBasic::didCreatePage):
(TestWebKitAPI::DOMWindowExtensionBasic::initialize): Deleted.
* TestWebKitAPI/Tests/WebKit/DOMWindowExtensionNoCache_Bundle.cpp:
(TestWebKitAPI::DOMWindowExtensionNoCache::didCreatePage):
(TestWebKitAPI::DOMWindowExtensionNoCache::initialize): Deleted.
* TestWebKitAPI/Tests/WebKit/DocumentStartUserScriptAlertCrash_Bundle.cpp:
(TestWebKitAPI::DocumentStartUserScriptAlertCrashTest::didCreatePage):
(TestWebKitAPI::DocumentStartUserScriptAlertCrashTest::initialize): Deleted.
* TestWebKitAPI/Tests/WebKit/InjectedBundleDisableOverrideBuiltinsBehavior_Bundle.cpp:
(TestWebKitAPI::InjectedBundleNoDisableOverrideBuiltinsBehaviorTest::initialize): Deleted.
(TestWebKitAPI::InjectedBundleDisableOverrideBuiltinsBehaviorTest::initialize): Deleted.
* TestWebKitAPI/Tests/WebKit/InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp:
(TestWebKitAPI::InjectedBundleMakeAllShadowRootOpenTest::didCreatePage):
(TestWebKitAPI::InjectedBundleMakeAllShadowRootOpenTest::initialize): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (259158 => 259159)


--- trunk/Source/WebKit/ChangeLog	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Source/WebKit/ChangeLog	2020-03-28 16:45:56 UTC (rev 259159)
@@ -1,3 +1,41 @@
+2020-03-28  Alex Christensen  <[email protected]>
+
+        Deprecate injected bundle page group SPI
+        https://bugs.webkit.org/show_bug.cgi?id=209687
+
+        Reviewed by Timothy Hatcher.
+
+        This old code is problematic, and the use of it is being removed in rdar://problem/60987265
+
+        * Shared/WebPageGroupData.cpp:
+        (WebKit::WebPageGroupData::encode const):
+        (WebKit::WebPageGroupData::decode):
+        * Shared/WebPageGroupData.h:
+        * UIProcess/WebPageGroup.cpp:
+        (WebKit::WebPageGroup::WebPageGroup):
+        * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+        (WKBundleAddUserScript):
+        (WKBundleAddUserStyleSheet):
+        (WKBundleRemoveUserScript):
+        (WKBundleRemoveUserStyleSheet):
+        (WKBundleRemoveUserScripts):
+        (WKBundleRemoveUserStyleSheets):
+        (WKBundleRemoveAllUserContent):
+        * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::addUserScript): Deleted.
+        (WebKit::InjectedBundle::addUserStyleSheet): Deleted.
+        (WebKit::InjectedBundle::removeUserScript): Deleted.
+        (WebKit::InjectedBundle::removeUserStyleSheet): Deleted.
+        (WebKit::InjectedBundle::removeUserScripts): Deleted.
+        (WebKit::InjectedBundle::removeUserStyleSheets): Deleted.
+        (WebKit::InjectedBundle::removeAllUserContent): Deleted.
+        * WebProcess/InjectedBundle/InjectedBundle.h:
+        * WebProcess/WebPage/WebPageGroupProxy.cpp:
+        (WebKit::WebPageGroupProxy::WebPageGroupProxy):
+        (WebKit::WebPageGroupProxy::userContentController): Deleted.
+        * WebProcess/WebPage/WebPageGroupProxy.h:
+
 2020-03-27  Wenson Hsieh  <[email protected]>
 
         Web content processes should not be able to arbitrarily request pasteboard data from the UI process

Modified: trunk/Source/WebKit/Shared/WebPageGroupData.cpp (259158 => 259159)


--- trunk/Source/WebKit/Shared/WebPageGroupData.cpp	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Source/WebKit/Shared/WebPageGroupData.cpp	2020-03-28 16:45:56 UTC (rev 259159)
@@ -34,7 +34,6 @@
 {
     encoder << identifier;
     encoder << pageGroupID;
-    encoder << userContentControllerIdentifier;
 }
 
 Optional<WebPageGroupData> WebPageGroupData::decode(IPC::Decoder& decoder)
@@ -48,13 +47,8 @@
     decoder >> pageGroupID;
     if (!pageGroupID)
         return WTF::nullopt;
-    
-    Optional<UserContentControllerIdentifier> userContentControllerIdentifier;
-    decoder >> userContentControllerIdentifier;
-    if (!userContentControllerIdentifier)
-        return WTF::nullopt;
-    
-    return {{ WTFMove(*identifier), *pageGroupID, *userContentControllerIdentifier }};
+        
+    return {{ WTFMove(*identifier), *pageGroupID }};
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/Shared/WebPageGroupData.h (259158 => 259159)


--- trunk/Source/WebKit/Shared/WebPageGroupData.h	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Source/WebKit/Shared/WebPageGroupData.h	2020-03-28 16:45:56 UTC (rev 259159)
@@ -41,8 +41,6 @@
 
     String identifier;
     uint64_t pageGroupID;
-
-    UserContentControllerIdentifier userContentControllerIdentifier;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/WebPageGroup.cpp (259158 => 259159)


--- trunk/Source/WebKit/UIProcess/WebPageGroup.cpp	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Source/WebKit/UIProcess/WebPageGroup.cpp	2020-03-28 16:45:56 UTC (rev 259159)
@@ -85,8 +85,6 @@
     , m_preferences(WebPreferences::createWithLegacyDefaults(m_data.identifier, ".WebKit2", "WebKit2."))
     , m_userContentController(WebUserContentControllerProxy::create())
 {
-    m_data.userContentControllerIdentifier = m_userContentController->identifier();
-
     webPageGroupMap().set(m_data.pageGroupID, this);
 }
 

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundle.cpp (259158 => 259159)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2020-03-28 16:45:56 UTC (rev 259159)
@@ -96,39 +96,32 @@
     return WebKit::toImpl(bundleRef)->_javascript_ObjectsCount();
 }
 
-void WKBundleAddUserScript(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef, WKStringRef sourceRef, WKURLRef urlRef, WKArrayRef whitelistRef, WKArrayRef blacklistRef, _WKUserScriptInjectionTime injectionTimeRef, WKUserContentInjectedFrames injectedFramesRef)
+void WKBundleAddUserScript(WKBundleRef, WKBundlePageGroupRef, WKBundleScriptWorldRef, WKStringRef, WKURLRef, WKArrayRef, WKArrayRef, _WKUserScriptInjectionTime, WKUserContentInjectedFrames)
 {
-    WebKit::toImpl(bundleRef)->addUserScript(WebKit::toImpl(pageGroupRef), WebKit::toImpl(scriptWorldRef), WebKit::toWTFString(sourceRef), WebKit::toWTFString(urlRef), WebKit::toImpl(whitelistRef), WebKit::toImpl(blacklistRef), WebKit::toUserScriptInjectionTime(injectionTimeRef), WebKit::toUserContentInjectedFrames(injectedFramesRef));
 }
 
-void WKBundleAddUserStyleSheet(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef, WKStringRef sourceRef, WKURLRef urlRef, WKArrayRef whitelistRef, WKArrayRef blacklistRef, WKUserContentInjectedFrames injectedFramesRef)
+void WKBundleAddUserStyleSheet(WKBundleRef, WKBundlePageGroupRef, WKBundleScriptWorldRef, WKStringRef, WKURLRef, WKArrayRef, WKArrayRef, WKUserContentInjectedFrames)
 {
-    WebKit::toImpl(bundleRef)->addUserStyleSheet(WebKit::toImpl(pageGroupRef), WebKit::toImpl(scriptWorldRef), WebKit::toWTFString(sourceRef), WebKit::toWTFString(urlRef), WebKit::toImpl(whitelistRef), WebKit::toImpl(blacklistRef), WebKit::toUserContentInjectedFrames(injectedFramesRef));
 }
 
-void WKBundleRemoveUserScript(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef, WKURLRef urlRef)
+void WKBundleRemoveUserScript(WKBundleRef, WKBundlePageGroupRef, WKBundleScriptWorldRef, WKURLRef)
 {
-    WebKit::toImpl(bundleRef)->removeUserScript(WebKit::toImpl(pageGroupRef), WebKit::toImpl(scriptWorldRef), WebKit::toWTFString(urlRef));
 }
 
-void WKBundleRemoveUserStyleSheet(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef, WKURLRef urlRef)
+void WKBundleRemoveUserStyleSheet(WKBundleRef, WKBundlePageGroupRef, WKBundleScriptWorldRef, WKURLRef)
 {
-    WebKit::toImpl(bundleRef)->removeUserStyleSheet(WebKit::toImpl(pageGroupRef), WebKit::toImpl(scriptWorldRef), WebKit::toWTFString(urlRef));
 }
 
-void WKBundleRemoveUserScripts(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef)
+void WKBundleRemoveUserScripts(WKBundleRef, WKBundlePageGroupRef, WKBundleScriptWorldRef)
 {
-    WebKit::toImpl(bundleRef)->removeUserScripts(WebKit::toImpl(pageGroupRef), WebKit::toImpl(scriptWorldRef));
 }
 
-void WKBundleRemoveUserStyleSheets(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef)
+void WKBundleRemoveUserStyleSheets(WKBundleRef, WKBundlePageGroupRef, WKBundleScriptWorldRef)
 {
-    WebKit::toImpl(bundleRef)->removeUserStyleSheets(WebKit::toImpl(pageGroupRef), WebKit::toImpl(scriptWorldRef));
 }
 
-void WKBundleRemoveAllUserContent(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef)
+void WKBundleRemoveAllUserContent(WKBundleRef, WKBundlePageGroupRef)
 {
-    WebKit::toImpl(bundleRef)->removeAllUserContent(WebKit::toImpl(pageGroupRef));
 }
 
 void WKBundleOverrideBoolPreferenceForTestRunner(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKStringRef preference, bool enabled)

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (259158 => 259159)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2020-03-28 16:45:56 UTC (rev 259159)
@@ -40,6 +40,7 @@
 #include "InjectedBundlePageLoaderClient.h"
 #include "InjectedBundlePageResourceLoadClient.h"
 #include "InjectedBundlePageUIClient.h"
+#include "InjectedBundleScriptWorld.h"
 #include "PageBanner.h"
 #include "WKAPICast.h"
 #include "WKArray.h"
@@ -788,9 +789,14 @@
 
 void WKBundlePageAddUserScript(WKBundlePageRef pageRef, WKStringRef source, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames)
 {
-    WebKit::toImpl(pageRef)->addUserScript(WebKit::toWTFString(source), WebKit::toUserContentInjectedFrames(injectedFrames), WebKit::toUserScriptInjectionTime(injectionTime));
+    WebKit::toImpl(pageRef)->addUserScript(WebKit::toWTFString(source), WebKit::InjectedBundleScriptWorld::normalWorld(), WebKit::toUserContentInjectedFrames(injectedFrames), WebKit::toUserScriptInjectionTime(injectionTime));
 }
 
+void WKBundlePageAddUserScriptInWorld(WKBundlePageRef page, WKStringRef source, WKBundleScriptWorldRef scriptWorld, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames)
+{
+    WebKit::toImpl(page)->addUserScript(WebKit::toWTFString(source), *WebKit::toImpl(scriptWorld), WebKit::toUserContentInjectedFrames(injectedFrames), WebKit::toUserScriptInjectionTime(injectionTime));
+}
+
 void WKBundlePageAddUserStyleSheet(WKBundlePageRef pageRef, WKStringRef source, WKUserContentInjectedFrames injectedFrames)
 {
     WebKit::toImpl(pageRef)->addUserStyleSheet(WebKit::toWTFString(source), WebKit::toUserContentInjectedFrames(injectedFrames));

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h (259158 => 259159)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h	2020-03-28 16:45:56 UTC (rev 259159)
@@ -116,6 +116,7 @@
 
 // UserContent API (compatible with Modern API, for WKTR)
 WK_EXPORT void WKBundlePageAddUserScript(WKBundlePageRef page, WKStringRef source, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames);
+WK_EXPORT void WKBundlePageAddUserScriptInWorld(WKBundlePageRef page, WKStringRef source, WKBundleScriptWorldRef scriptWorld, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames);
 WK_EXPORT void WKBundlePageAddUserStyleSheet(WKBundlePageRef page, WKStringRef source, WKUserContentInjectedFrames injectedFrames);
 WK_EXPORT void WKBundlePageRemoveAllUserContent(WKBundlePageRef page);
 

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h (259158 => 259159)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h	2020-03-28 16:45:56 UTC (rev 259159)
@@ -33,6 +33,7 @@
 #endif
 
 #include <_javascript_Core/JSBase.h>
+#include <WebKit/WKDeprecated.h>
 #include <WebKit/WKUserContentInjectedFrames.h>
 #include <WebKit/WKUserScriptInjectionTime.h>
 
@@ -69,13 +70,13 @@
 WK_EXPORT WKArrayRef WKBundleGetLiveDocumentURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool excludeDocumentsInPageGroupPages);
 
 // UserContent API
-WK_EXPORT void WKBundleAddUserScript(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKStringRef source, WKURLRef url, WKArrayRef whitelist, WKArrayRef blacklist, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames);
-WK_EXPORT void WKBundleAddUserStyleSheet(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKStringRef source, WKURLRef url, WKArrayRef whitelist, WKArrayRef blacklist, WKUserContentInjectedFrames injectedFrames);
-WK_EXPORT void WKBundleRemoveUserScript(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKURLRef url);
-WK_EXPORT void WKBundleRemoveUserStyleSheet(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKURLRef url);
-WK_EXPORT void WKBundleRemoveUserScripts(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld);
-WK_EXPORT void WKBundleRemoveUserStyleSheets(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld);
-WK_EXPORT void WKBundleRemoveAllUserContent(WKBundleRef bundle, WKBundlePageGroupRef pageGroup);
+WK_EXPORT void WKBundleAddUserScript(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKStringRef source, WKURLRef url, WKArrayRef whitelist, WKArrayRef blacklist, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames) WK_C_API_DEPRECATED_WITH_REPLACEMENT(WKBundlePageAddUserScript);
+WK_EXPORT void WKBundleAddUserStyleSheet(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKStringRef source, WKURLRef url, WKArrayRef whitelist, WKArrayRef blacklist, WKUserContentInjectedFrames injectedFrames) WK_C_API_DEPRECATED_WITH_REPLACEMENT(WKBundlePageAddUserStyleSheet);
+WK_EXPORT void WKBundleRemoveUserScript(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKURLRef url) WK_C_API_DEPRECATED;
+WK_EXPORT void WKBundleRemoveUserStyleSheet(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKURLRef url) WK_C_API_DEPRECATED;
+WK_EXPORT void WKBundleRemoveUserScripts(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld) WK_C_API_DEPRECATED;
+WK_EXPORT void WKBundleRemoveUserStyleSheets(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld) WK_C_API_DEPRECATED;
+WK_EXPORT void WKBundleRemoveAllUserContent(WKBundleRef bundle, WKBundlePageGroupRef pageGroup) WK_C_API_DEPRECATED_WITH_REPLACEMENT(WKBundlePageRemoveAllUserContent);
 
 // Local storage API
 WK_EXPORT void WKBundleClearAllDatabases(WKBundleRef bundle);

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp (259158 => 259159)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp	2020-03-28 16:45:56 UTC (rev 259159)
@@ -475,45 +475,6 @@
     return UserGestureIndicator::processingUserGesture();
 }
 
-void InjectedBundle::addUserScript(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, String&& source, String&& url, API::Array* whitelist, API::Array* blacklist, WebCore::UserScriptInjectionTime injectionTime, WebCore::UserContentInjectedFrames injectedFrames)
-{
-    UserScript userScript { WTFMove(source), URL(URL(), url), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), injectionTime, injectedFrames };
-
-    pageGroup->userContentController().addUserScript(*scriptWorld, WTFMove(userScript));
-}
-
-void InjectedBundle::addUserStyleSheet(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String& source, const String& url, API::Array* whitelist, API::Array* blacklist, WebCore::UserContentInjectedFrames injectedFrames)
-{
-    UserStyleSheet userStyleSheet{ source, URL(URL(), url), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), injectedFrames, UserStyleUserLevel };
-
-    pageGroup->userContentController().addUserStyleSheet(*scriptWorld, WTFMove(userStyleSheet));
-}
-
-void InjectedBundle::removeUserScript(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String& url)
-{
-    pageGroup->userContentController().removeUserScriptWithURL(*scriptWorld, URL(URL(), url));
-}
-
-void InjectedBundle::removeUserStyleSheet(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String& url)
-{
-    pageGroup->userContentController().removeUserStyleSheetWithURL(*scriptWorld, URL(URL(), url));
-}
-
-void InjectedBundle::removeUserScripts(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld)
-{
-    pageGroup->userContentController().removeUserScripts(*scriptWorld);
-}
-
-void InjectedBundle::removeUserStyleSheets(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld)
-{
-    pageGroup->userContentController().removeUserStyleSheets(*scriptWorld);
-}
-
-void InjectedBundle::removeAllUserContent(WebPageGroupProxy* pageGroup)
-{
-    pageGroup->userContentController().removeAllUserContent();
-}
-
 void InjectedBundle::garbageCollectJavaScriptObjects()
 {
     GCController::singleton().garbageCollectNow();

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.h (259158 => 259159)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.h	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.h	2020-03-28 16:45:56 UTC (rev 259159)
@@ -124,15 +124,6 @@
     typedef HashMap<uint64_t, String> DocumentIDToURLMap;
     DocumentIDToURLMap liveDocumentURLs(WebPageGroupProxy*, bool excludeDocumentsInPageGroupPages);
 
-    // UserContent API
-    void addUserScript(WebPageGroupProxy*, InjectedBundleScriptWorld*, String&& source, String&& url, API::Array* whitelist, API::Array* blacklist, WebCore::UserScriptInjectionTime, WebCore::UserContentInjectedFrames);
-    void addUserStyleSheet(WebPageGroupProxy*, InjectedBundleScriptWorld*, const String& source, const String& url, API::Array* whitelist, API::Array* blacklist, WebCore::UserContentInjectedFrames);
-    void removeUserScript(WebPageGroupProxy*, InjectedBundleScriptWorld*, const String& url);
-    void removeUserStyleSheet(WebPageGroupProxy*, InjectedBundleScriptWorld*, const String& url);
-    void removeUserScripts(WebPageGroupProxy*, InjectedBundleScriptWorld*);
-    void removeUserStyleSheets(WebPageGroupProxy*, InjectedBundleScriptWorld*);
-    void removeAllUserContent(WebPageGroupProxy*);
-
     // Garbage collection API
     void garbageCollectJavaScriptObjects();
     void garbageCollectJavaScriptObjectsOnAlternateThreadForDebugging(bool waitUntilDone);

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (259158 => 259159)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-03-28 16:45:56 UTC (rev 259159)
@@ -6410,11 +6410,11 @@
     send(Messages::WebPageProxy::ImageOrMediaDocumentSizeChanged(newSize));
 }
 
-void WebPage::addUserScript(String&& source, WebCore::UserContentInjectedFrames injectedFrames, WebCore::UserScriptInjectionTime injectionTime)
+void WebPage::addUserScript(String&& source, InjectedBundleScriptWorld& world, WebCore::UserContentInjectedFrames injectedFrames, WebCore::UserScriptInjectionTime injectionTime)
 {
     WebCore::UserScript userScript { WTFMove(source), URL(aboutBlankURL()), Vector<String>(), Vector<String>(), injectionTime, injectedFrames };
 
-    m_userContentController->addUserScript(InjectedBundleScriptWorld::normalWorld(), WTFMove(userScript));
+    m_userContentController->addUserScript(world, WTFMove(userScript));
 }
 
 void WebPage::addUserStyleSheet(const String& source, WebCore::UserContentInjectedFrames injectedFrames)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (259158 => 259159)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2020-03-28 16:45:56 UTC (rev 259159)
@@ -1133,7 +1133,7 @@
     void requestInstallMissingMediaPlugins(const String& details, const String& description, WebCore::MediaPlayerRequestInstallMissingPluginsCallback&);
 #endif
 
-    void addUserScript(String&& source, WebCore::UserContentInjectedFrames, WebCore::UserScriptInjectionTime);
+    void addUserScript(String&& source, InjectedBundleScriptWorld&, WebCore::UserContentInjectedFrames, WebCore::UserScriptInjectionTime);
     void addUserStyleSheet(const String& source, WebCore::UserContentInjectedFrames);
     void removeAllUserContent();
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPageGroupProxy.cpp (259158 => 259159)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPageGroupProxy.cpp	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPageGroupProxy.cpp	2020-03-28 16:45:56 UTC (rev 259159)
@@ -48,7 +48,6 @@
 WebPageGroupProxy::WebPageGroupProxy(const WebPageGroupData& data)
     : m_data(data)
     , m_pageGroup(WebCore::PageGroup::pageGroup(m_data.identifier))
-    , m_userContentController(WebUserContentController::getOrCreate(m_data.userContentControllerIdentifier))
 {
 }
 
@@ -56,9 +55,4 @@
 {
 }
 
-WebUserContentController& WebPageGroupProxy::userContentController()
-{
-    return m_userContentController;
-}
-
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPageGroupProxy.h (259158 => 259159)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPageGroupProxy.h	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPageGroupProxy.h	2020-03-28 16:45:56 UTC (rev 259159)
@@ -48,14 +48,11 @@
     StorageNamespaceIdentifier localStorageNamespaceIdentifier() const { return makeObjectIdentifier<StorageNamespaceIdentifierType>(pageGroupID()); }
     WebCore::PageGroup* corePageGroup() const { return m_pageGroup; }
 
-    WebUserContentController& userContentController();
-
 private:
     WebPageGroupProxy(const WebPageGroupData&);
 
     WebPageGroupData m_data;
     WebCore::PageGroup* m_pageGroup;
-    Ref<WebUserContentController> m_userContentController;
 };
 
 } // namespace WebKit

Modified: trunk/Tools/ChangeLog (259158 => 259159)


--- trunk/Tools/ChangeLog	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Tools/ChangeLog	2020-03-28 16:45:56 UTC (rev 259159)
@@ -1,3 +1,26 @@
+2020-03-28  Alex Christensen  <[email protected]>
+
+        Deprecate injected bundle page group SPI
+        https://bugs.webkit.org/show_bug.cgi?id=209687
+
+        Reviewed by Timothy Hatcher.
+
+        * TestWebKitAPI/Tests/WebKit/DOMWindowExtensionBasic_Bundle.cpp:
+        (TestWebKitAPI::DOMWindowExtensionBasic::didCreatePage):
+        (TestWebKitAPI::DOMWindowExtensionBasic::initialize): Deleted.
+        * TestWebKitAPI/Tests/WebKit/DOMWindowExtensionNoCache_Bundle.cpp:
+        (TestWebKitAPI::DOMWindowExtensionNoCache::didCreatePage):
+        (TestWebKitAPI::DOMWindowExtensionNoCache::initialize): Deleted.
+        * TestWebKitAPI/Tests/WebKit/DocumentStartUserScriptAlertCrash_Bundle.cpp:
+        (TestWebKitAPI::DocumentStartUserScriptAlertCrashTest::didCreatePage):
+        (TestWebKitAPI::DocumentStartUserScriptAlertCrashTest::initialize): Deleted.
+        * TestWebKitAPI/Tests/WebKit/InjectedBundleDisableOverrideBuiltinsBehavior_Bundle.cpp:
+        (TestWebKitAPI::InjectedBundleNoDisableOverrideBuiltinsBehaviorTest::initialize): Deleted.
+        (TestWebKitAPI::InjectedBundleDisableOverrideBuiltinsBehaviorTest::initialize): Deleted.
+        * TestWebKitAPI/Tests/WebKit/InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp:
+        (TestWebKitAPI::InjectedBundleMakeAllShadowRootOpenTest::didCreatePage):
+        (TestWebKitAPI::InjectedBundleMakeAllShadowRootOpenTest::initialize): Deleted.
+
 2020-03-28  ChangSeok Oh  <[email protected]>
 
         [GTK] No libsystemd-devel for DNF

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit/DOMWindowExtensionBasic_Bundle.cpp (259158 => 259159)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit/DOMWindowExtensionBasic_Bundle.cpp	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/DOMWindowExtensionBasic_Bundle.cpp	2020-03-28 16:45:56 UTC (rev 259159)
@@ -32,6 +32,7 @@
 #include <WebKit/WKBundleFrame.h>
 #include <WebKit/WKBundlePage.h>
 #include <WebKit/WKBundlePageGroup.h>
+#include <WebKit/WKBundlePagePrivate.h>
 #include <WebKit/WKBundlePrivate.h>
 #include <WebKit/WKBundleScriptWorld.h>
 #include <WebKit/WKRetainPtr.h>
@@ -68,9 +69,8 @@
 public:
     DOMWindowExtensionBasic(const std::string& identifier);
     
-    virtual void initialize(WKBundleRef, WKTypeRef userData);
-    virtual void didCreatePage(WKBundleRef, WKBundlePageRef);
-    virtual void willDestroyPage(WKBundleRef, WKBundlePageRef);
+    void didCreatePage(WKBundleRef, WKBundlePageRef) override;
+    void willDestroyPage(WKBundleRef, WKBundlePageRef) override;
     
     void globalObjectIsAvailableForFrame(WKBundleFrameRef, WKBundleScriptWorldRef);
     void willDisconnectDOMWindowExtensionFromGlobalObject(WKBundleDOMWindowExtensionRef);
@@ -142,19 +142,13 @@
     WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
 }
 
-void DOMWindowExtensionBasic::initialize(WKBundleRef bundle, WKTypeRef userData)
-{
-    assert(WKGetTypeID(userData) == WKBundlePageGroupGetTypeID());
-    WKBundlePageGroupRef pageGroup = static_cast<WKBundlePageGroupRef>(userData);
-
-    WKRetainPtr<WKStringRef> source = adoptWK(WKStringCreateWithUTF8CString("alert('Unimportant alert');"));
-    WKBundleAddUserScript(bundle, pageGroup, WKBundleScriptWorldCreateWorld(), source.get(), 0, 0, 0, kWKInjectAtDocumentStart, kWKInjectInAllFrames);
-}
-
 void DOMWindowExtensionBasic::didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
 {    
     m_bundle = bundle;
 
+    auto source = adoptWK(WKStringCreateWithUTF8CString("alert('Unimportant alert');"));
+    WKBundlePageAddUserScriptInWorld(page, source.get(), WKBundleScriptWorldCreateWorld(), kWKInjectAtDocumentStart, kWKInjectInAllFrames);
+    
     WKBundlePageLoaderClientV1 pageLoaderClient;
     memset(&pageLoaderClient, 0, sizeof(pageLoaderClient));
     

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit/DOMWindowExtensionNoCache_Bundle.cpp (259158 => 259159)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit/DOMWindowExtensionNoCache_Bundle.cpp	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/DOMWindowExtensionNoCache_Bundle.cpp	2020-03-28 16:45:56 UTC (rev 259159)
@@ -32,6 +32,7 @@
 #include <WebKit/WKBundleFrame.h>
 #include <WebKit/WKBundlePage.h>
 #include <WebKit/WKBundlePageGroup.h>
+#include <WebKit/WKBundlePagePrivate.h>
 #include <WebKit/WKBundlePrivate.h>
 #include <WebKit/WKBundleScriptWorld.h>
 #include <WebKit/WKRetainPtr.h>
@@ -67,9 +68,8 @@
 public:
     DOMWindowExtensionNoCache(const std::string& identifier);
 
-    virtual void initialize(WKBundleRef, WKTypeRef userData);
-    virtual void didCreatePage(WKBundleRef, WKBundlePageRef);
-    virtual void willDestroyPage(WKBundleRef, WKBundlePageRef);
+    void didCreatePage(WKBundleRef, WKBundlePageRef) override;
+    void willDestroyPage(WKBundleRef, WKBundlePageRef) override;
 
     void globalObjectIsAvailableForFrame(WKBundleFrameRef, WKBundleScriptWorldRef);
     void willDisconnectDOMWindowExtensionFromGlobalObject(WKBundleDOMWindowExtensionRef);
@@ -149,19 +149,13 @@
     WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
 }
 
-void DOMWindowExtensionNoCache::initialize(WKBundleRef bundle, WKTypeRef userData)
-{
-    assert(WKGetTypeID(userData) == WKBundlePageGroupGetTypeID());
-    WKBundlePageGroupRef pageGroup = static_cast<WKBundlePageGroupRef>(userData);
-
-    WKRetainPtr<WKStringRef> source = adoptWK(WKStringCreateWithUTF8CString("alert('Unimportant alert');"));
-    WKBundleAddUserScript(bundle, pageGroup, WKBundleScriptWorldCreateWorld(), source.get(), 0, 0, 0, kWKInjectAtDocumentStart, kWKInjectInAllFrames);
-}
-
 void DOMWindowExtensionNoCache::didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
 {
     m_bundle = bundle;
 
+    auto source = adoptWK(WKStringCreateWithUTF8CString("alert('Unimportant alert');"));
+    WKBundlePageAddUserScriptInWorld(page, source.get(), WKBundleScriptWorldCreateWorld(), kWKInjectAtDocumentStart, kWKInjectInAllFrames);
+
     WKBundlePageLoaderClientV7 pageLoaderClient;
     memset(&pageLoaderClient, 0, sizeof(pageLoaderClient));
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit/DocumentStartUserScriptAlertCrash_Bundle.cpp (259158 => 259159)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit/DocumentStartUserScriptAlertCrash_Bundle.cpp	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/DocumentStartUserScriptAlertCrash_Bundle.cpp	2020-03-28 16:45:56 UTC (rev 259159)
@@ -29,6 +29,7 @@
 
 #include "InjectedBundleTest.h"
 #include <WebKit/WKBundlePageGroup.h>
+#include <WebKit/WKBundlePagePrivate.h>
 #include <WebKit/WKBundlePrivate.h>
 #include <WebKit/WKBundleScriptWorld.h>
 #include <WebKit/WKRetainPtr.h>
@@ -43,13 +44,10 @@
     {
     }
 
-    virtual void initialize(WKBundleRef bundle, WKTypeRef userData)
+    void didCreatePage(WKBundleRef, WKBundlePageRef page) override
     {
-        assert(WKGetTypeID(userData) == WKBundlePageGroupGetTypeID());
-        WKBundlePageGroupRef pageGroup = static_cast<WKBundlePageGroupRef>(userData);
-
         WKRetainPtr<WKStringRef> source = adoptWK(WKStringCreateWithUTF8CString("alert('an alert');"));
-        WKBundleAddUserScript(bundle, pageGroup, WKBundleScriptWorldNormalWorld(), source.get(), 0, 0, 0, kWKInjectAtDocumentStart, kWKInjectInAllFrames);
+        WKBundlePageAddUserScript(page, source.get(), kWKInjectAtDocumentStart, kWKInjectInAllFrames);
     }
 };
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit/InjectedBundleDisableOverrideBuiltinsBehavior_Bundle.cpp (259158 => 259159)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit/InjectedBundleDisableOverrideBuiltinsBehavior_Bundle.cpp	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/InjectedBundleDisableOverrideBuiltinsBehavior_Bundle.cpp	2020-03-28 16:45:56 UTC (rev 259159)
@@ -29,6 +29,7 @@
 
 #include "InjectedBundleTest.h"
 #include <WebKit/WKBundlePageGroup.h>
+#include <WebKit/WKBundlePagePrivate.h>
 #include <WebKit/WKBundlePrivate.h>
 #include <WebKit/WKBundleScriptWorld.h>
 #include <WebKit/WKRetainPtr.h>
@@ -42,12 +43,9 @@
         : InjectedBundleTest(identifier)
     { }
 
-    virtual void initialize(WKBundleRef bundle, WKTypeRef userData)
+    void didCreatePage(WKBundleRef bundle, WKBundlePageRef page) override
     {
-        assert(WKGetTypeID(userData) == WKBundlePageGroupGetTypeID());
-        WKBundlePageGroupRef pageGroup = static_cast<WKBundlePageGroupRef>(userData);
-
-        WKRetainPtr<WKStringRef> source = adoptWK(WKStringCreateWithUTF8CString(
+        auto source = adoptWK(WKStringCreateWithUTF8CString(
             "window._onload_ = function () {\n"
             "    const form = document.getElementById('test').parentNode;\n"
             "    alert(form.tagName != 'FORM' ? 'PASS: [OverrideBuiltins] was not disabled' : 'FAIL: [OverrideBuiltins] was disabled');\n"
@@ -54,10 +52,10 @@
             "}\n"));
 
         auto normalWorld = WKBundleScriptWorldNormalWorld();
-        WKBundleAddUserScript(bundle, pageGroup, normalWorld, source.get(), 0, 0, 0, kWKInjectAtDocumentEnd, kWKInjectInAllFrames);
+        WKBundlePageAddUserScriptInWorld(page, source.get(), normalWorld, kWKInjectAtDocumentEnd, kWKInjectInAllFrames);
 
         auto isolatedWorld = WKBundleScriptWorldCreateWorld();
-        WKBundleAddUserScript(bundle, pageGroup, isolatedWorld, source.get(), 0, 0, 0, kWKInjectAtDocumentEnd, kWKInjectInAllFrames);
+        WKBundlePageAddUserScriptInWorld(page, source.get(), isolatedWorld, kWKInjectAtDocumentEnd, kWKInjectInAllFrames);
     }
 };
 
@@ -67,12 +65,9 @@
         : InjectedBundleTest(identifier)
     { }
 
-    virtual void initialize(WKBundleRef bundle, WKTypeRef userData)
+    void didCreatePage(WKBundleRef bundle, WKBundlePageRef page) override
     {
-        assert(WKGetTypeID(userData) == WKBundlePageGroupGetTypeID());
-        WKBundlePageGroupRef pageGroup = static_cast<WKBundlePageGroupRef>(userData);
-
-        WKRetainPtr<WKStringRef> source = adoptWK(WKStringCreateWithUTF8CString(
+        auto source = adoptWK(WKStringCreateWithUTF8CString(
             "window._onload_ = function () {\n"
             "    const form = document.getElementById('test').parentNode;\n"
             "    alert(form.tagName === 'FORM' ? 'PASS: [OverrideBuiltins] was disabled' : 'FAIL: [OverrideBuiltins] was not disabled');\n"
@@ -80,11 +75,11 @@
 
         auto normalWorld = WKBundleScriptWorldNormalWorld();
         WKBundleScriptWorldDisableOverrideBuiltinsBehavior(normalWorld);
-        WKBundleAddUserScript(bundle, pageGroup, normalWorld, source.get(), 0, 0, 0, kWKInjectAtDocumentEnd, kWKInjectInAllFrames);
+        WKBundlePageAddUserScriptInWorld(page, source.get(), normalWorld, kWKInjectAtDocumentEnd, kWKInjectInAllFrames);
 
         auto isolatedWorld = WKBundleScriptWorldCreateWorld();
         WKBundleScriptWorldDisableOverrideBuiltinsBehavior(isolatedWorld);
-        WKBundleAddUserScript(bundle, pageGroup, isolatedWorld, source.get(), 0, 0, 0, kWKInjectAtDocumentEnd, kWKInjectInAllFrames);
+        WKBundlePageAddUserScriptInWorld(page, source.get(), isolatedWorld, kWKInjectAtDocumentEnd, kWKInjectInAllFrames);
     }
 };
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit/InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp (259158 => 259159)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit/InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp	2020-03-28 15:35:47 UTC (rev 259158)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp	2020-03-28 16:45:56 UTC (rev 259159)
@@ -29,6 +29,7 @@
 
 #include "InjectedBundleTest.h"
 #include <WebKit/WKBundlePageGroup.h>
+#include <WebKit/WKBundlePagePrivate.h>
 #include <WebKit/WKBundlePrivate.h>
 #include <WebKit/WKBundleScriptWorld.h>
 #include <WebKit/WKRetainPtr.h>
@@ -42,11 +43,8 @@
         : InjectedBundleTest(identifier)
     { }
 
-    virtual void initialize(WKBundleRef bundle, WKTypeRef userData)
+    void didCreatePage(WKBundleRef, WKBundlePageRef page) override
     {
-        assert(WKGetTypeID(userData) == WKBundlePageGroupGetTypeID());
-        WKBundlePageGroupRef pageGroup = static_cast<WKBundlePageGroupRef>(userData);
-
         auto world = WKBundleScriptWorldCreateWorld();
         WKBundleScriptWorldMakeAllShadowRootsOpen(world);
 
@@ -87,7 +85,7 @@
             "    queryResult = window.matchingElementInFlatTree(document, 'div');\n"
             "    alert(`Found:${!!queryResult}`);\n"
             "}\n"));
-        WKBundleAddUserScript(bundle, pageGroup, world, source.get(), 0, 0, 0, kWKInjectAtDocumentStart, kWKInjectInAllFrames);
+        WKBundlePageAddUserScriptInWorld(page, source.get(), world, kWKInjectAtDocumentStart, kWKInjectInAllFrames);
     }
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to