Changeset 257552 in webkit
- Timestamp:
- Feb 26, 2020, 8:35:24 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r257551 r257552 1 2020-02-26 Alex Christensen <achristensen@webkit.org> 2 3 _WKUserContentWorld should be a wrapper around WKContentWorld 4 https://bugs.webkit.org/show_bug.cgi?id=208274 5 6 Reviewed by Brady Eidson. 7 8 Various SPIs were getting confused between the two. 9 Updated API tests which expected pointer equality, which is no longer true or important. 10 11 * Shared/API/APIObject.h: 12 * Shared/Cocoa/APIObject.mm: 13 (API::Object::newObject): 14 * Sources.txt: 15 * UIProcess/API/APIContentWorld.cpp: 16 (API::ContentWorld::ContentWorld): 17 (API::ContentWorldBase::ContentWorldBase): Deleted. 18 * UIProcess/API/APIContentWorld.h: 19 (API::ContentWorldBase::identifier const): Deleted. 20 (API::ContentWorldBase::name const): Deleted. 21 (API::ContentWorldBase::worldData const): Deleted. 22 (API::ContentWorldBase::ContentWorldBase): Deleted. 23 * UIProcess/API/APIUserContentWorld.cpp: Removed. 24 * UIProcess/API/APIUserContentWorld.h: Removed. 25 * UIProcess/API/APIUserScript.cpp: 26 (API::UserScript::UserScript): 27 * UIProcess/API/APIUserScript.h: 28 * UIProcess/API/APIUserStyleSheet.cpp: 29 (API::UserStyleSheet::UserStyleSheet): 30 * UIProcess/API/APIUserStyleSheet.h: 31 * UIProcess/API/C/WKPageGroup.cpp: 32 (WKPageGroupAddUserStyleSheet): 33 (WKPageGroupAddUserScript): 34 * UIProcess/API/C/WKUserScriptRef.cpp: 35 (WKUserScriptCreateWithSource): 36 * UIProcess/API/Cocoa/WKContentWorld.mm: 37 (-[WKContentWorld _userContentWorld]): 38 * UIProcess/API/Cocoa/WKUserContentController.mm: 39 (-[WKUserContentController addScriptMessageHandler:name:]): 40 (-[WKUserContentController removeScriptMessageHandlerForName:]): 41 (-[WKUserContentController _removeAllUserScriptsAssociatedWithUserContentWorld:]): 42 (-[WKUserContentController _removeAllUserStyleSheetsAssociatedWithUserContentWorld:]): 43 (-[WKUserContentController _addScriptMessageHandler:name:userContentWorld:]): 44 (-[WKUserContentController _removeScriptMessageHandlerForName:userContentWorld:]): 45 (-[WKUserContentController _removeAllScriptMessageHandlersAssociatedWithUserContentWorld:]): 46 * UIProcess/API/Cocoa/WKUserScript.mm: 47 (-[WKUserScript initWithSource:injectionTime:forMainFrameOnly:]): 48 (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]): 49 (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:userContentWorld:]): 50 (-[WKUserScript _userContentWorld]): 51 * UIProcess/API/Cocoa/_WKUserContentWorld.mm: 52 (-[_WKUserContentWorld _initWithName:]): 53 (-[_WKUserContentWorld _init]): 54 (-[_WKUserContentWorld _initWithContentWorld:]): 55 (+[_WKUserContentWorld worldWithName:]): 56 (+[_WKUserContentWorld normalWorld]): 57 (-[_WKUserContentWorld name]): 58 (-[_WKUserContentWorld _apiObject]): 59 (-[_WKUserContentWorld dealloc]): Deleted. 60 * UIProcess/API/Cocoa/_WKUserContentWorldInternal.h: 61 * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: 62 (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:]): 63 (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]): 64 (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]): 65 * UIProcess/UserContent/WebScriptMessageHandler.cpp: 66 (WebKit::WebScriptMessageHandler::create): 67 (WebKit::WebScriptMessageHandler::WebScriptMessageHandler): 68 * UIProcess/UserContent/WebScriptMessageHandler.h: 69 (WebKit::WebScriptMessageHandler::world): 70 * UIProcess/UserContent/WebUserContentControllerProxy.cpp: 71 (WebKit::WebUserContentControllerProxy::addProcess): 72 (WebKit::WebUserContentControllerProxy::addContentWorldUse): 73 (WebKit::WebUserContentControllerProxy::shouldSendRemoveContentWorldsMessage): 74 (WebKit::WebUserContentControllerProxy::removeContentWorldUses): 75 (WebKit::WebUserContentControllerProxy::addUserScript): 76 (WebKit::WebUserContentControllerProxy::removeUserScript): 77 (WebKit::WebUserContentControllerProxy::removeAllUserScripts): 78 (WebKit::WebUserContentControllerProxy::addUserStyleSheet): 79 (WebKit::WebUserContentControllerProxy::removeUserStyleSheet): 80 (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets): 81 (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler): 82 (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName): 83 (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers): 84 (WebKit::WebUserContentControllerProxy::addUserContentWorldUse): Deleted. 85 (WebKit::WebUserContentControllerProxy::shouldSendRemoveUserContentWorldsMessage): Deleted. 86 (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses): Deleted. 87 * UIProcess/UserContent/WebUserContentControllerProxy.h: 88 * WebKit.xcodeproj/project.pbxproj: 89 * WebProcess/UserContent/WebUserContentController.cpp: 90 (WebKit::WebUserContentController::addContentWorld): 91 (WebKit::WebUserContentController::addContentWorlds): 92 (WebKit::WebUserContentController::removeContentWorlds): 93 (WebKit::WebUserContentController::addUserScripts): 94 (WebKit::WebUserContentController::removeUserScript): 95 (WebKit::WebUserContentController::removeAllUserScripts): 96 (WebKit::WebUserContentController::addUserStyleSheets): 97 (WebKit::WebUserContentController::removeUserStyleSheet): 98 (WebKit::WebUserContentController::removeAllUserStyleSheets): 99 (WebKit::WebUserContentController::addUserScriptMessageHandlers): 100 (WebKit::WebUserContentController::removeUserScriptMessageHandler): 101 (WebKit::WebUserContentController::removeAllUserScriptMessageHandlers): 102 (WebKit::WebUserContentController::addUserContentWorld): Deleted. 103 (WebKit::WebUserContentController::addUserContentWorlds): Deleted. 104 (WebKit::WebUserContentController::removeUserContentWorlds): Deleted. 105 * WebProcess/UserContent/WebUserContentController.h: 106 * WebProcess/UserContent/WebUserContentController.messages.in: 107 * WebProcess/WebPage/WebPage.cpp: 108 (WebKit::m_processDisplayName): 109 (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld): 110 1 111 2020-02-26 Ryosuke Niwa <rniwa@webkit.org> 2 112 -
trunk/Source/WebKit/Shared/API/APIObject.h
r254668 r257552 166 166 URLSchemeTask, 167 167 UserContentController, 168 UserContentWorld,169 168 UserInitiatedAction, 170 169 UserMediaPermissionCheck, -
trunk/Source/WebKit/Shared/Cocoa/APIObject.mm
r256332 r257552 352 352 break; 353 353 354 case Type::UserContentWorld:355 ALLOW_DEPRECATED_DECLARATIONS_BEGIN356 wrapper = [_WKUserContentWorld alloc];357 ALLOW_DEPRECATED_DECLARATIONS_END358 break;359 360 354 case Type::UserInitiatedAction: 361 355 wrapper = [_WKUserInitiatedAction alloc]; -
trunk/Source/WebKit/Sources.txt
r257551 r257552 339 339 UIProcess/API/APISessionState.cpp 340 340 UIProcess/API/APIURLSchemeTask.cpp 341 UIProcess/API/APIUserContentWorld.cpp342 341 UIProcess/API/APIUserScript.cpp 343 342 UIProcess/API/APIUserStyleSheet.cpp -
trunk/Source/WebKit/UIProcess/API/APIContentWorld.cpp
r256561 r257552 27 27 #include "APIContentWorld.h" 28 28 29 #include "APIUserContentWorld.h"30 29 #include "ContentWorldShared.h" 31 30 #include <wtf/HashMap.h> … … 34 33 namespace API { 35 34 36 ContentWorld Base::ContentWorldBase(const WTF::String& name)35 ContentWorld::ContentWorld(const WTF::String& name) 37 36 : m_name(name) 38 37 { … … 77 76 } 78 77 79 ContentWorld::ContentWorld(const WTF::String& name)80 : ContentWorldBase(name)81 {82 }83 84 ContentWorld::ContentWorld(WebKit::ContentWorldIdentifier identifier)85 : ContentWorldBase(identifier)86 {87 }88 89 ContentWorld::ContentWorld(const UserContentWorld& userContentWorld)90 : ContentWorldBase(userContentWorld.identifier(), userContentWorld.name())91 {92 }93 94 78 ContentWorld::~ContentWorld() 95 79 { -
trunk/Source/WebKit/UIProcess/API/APIContentWorld.h
r256561 r257552 32 32 namespace API { 33 33 34 class UserContentWorld; 35 36 class ContentWorldBase { 37 public: 38 virtual ~ContentWorldBase() = default; 39 40 WebKit::ContentWorldIdentifier identifier() const { return m_identifier; } 41 const WTF::String& name() const { return m_name; } 42 std::pair<WebKit::ContentWorldIdentifier, WTF::String> worldData() const { return { m_identifier, m_name }; } 43 44 virtual void ref() const = 0; 45 virtual void deref() const = 0; 46 47 protected: 48 ContentWorldBase(const WTF::String& name); 49 ContentWorldBase(WebKit::ContentWorldIdentifier identifier) 50 : m_identifier(identifier) { } 51 ContentWorldBase(WebKit::ContentWorldIdentifier identifier, const WTF::String& name) 52 : m_identifier(identifier) 53 , m_name(name) { } 54 private: 55 WebKit::ContentWorldIdentifier m_identifier; 56 WTF::String m_name; 57 }; 58 59 class ContentWorld final : public API::ObjectImpl<API::Object::Type::ContentWorld>, public ContentWorldBase { 34 class ContentWorld final : public API::ObjectImpl<API::Object::Type::ContentWorld> { 60 35 public: 61 36 static Ref<ContentWorld> sharedWorldWithName(const WTF::String&); … … 65 40 virtual ~ContentWorld(); 66 41 67 void ref() const final { ObjectImpl::ref(); } 68 void deref() const final { ObjectImpl::deref(); } 42 WebKit::ContentWorldIdentifier identifier() const { return m_identifier; } 43 const WTF::String& name() const { return m_name; } 44 std::pair<WebKit::ContentWorldIdentifier, WTF::String> worldData() const { return { m_identifier, m_name }; } 69 45 70 46 private: 71 47 explicit ContentWorld(const WTF::String&); 72 explicit ContentWorld(WebKit::ContentWorldIdentifier); 73 explicit ContentWorld(const UserContentWorld&); 48 explicit ContentWorld(WebKit::ContentWorldIdentifier identifier) 49 : m_identifier(identifier) { } 50 51 WebKit::ContentWorldIdentifier m_identifier; 52 WTF::String m_name; 74 53 }; 75 54 -
trunk/Source/WebKit/UIProcess/API/APIUserScript.cpp
r246034 r257552 37 37 } 38 38 39 UserScript::UserScript(WebCore::UserScript userScript, API:: UserContentWorld& world)39 UserScript::UserScript(WebCore::UserScript userScript, API::ContentWorld& world) 40 40 : m_userScript(userScript) 41 41 , m_world(world) … … 43 43 } 44 44 45 46 45 } // namespace API -
trunk/Source/WebKit/UIProcess/API/APIUserScript.h
r238771 r257552 26 26 #pragma once 27 27 28 #include "APIContentWorld.h" 28 29 #include "APIObject.h" 29 #include "APIUserContentWorld.h"30 30 #include <WebCore/UserScript.h> 31 31 #include <wtf/Identified.h> … … 37 37 static WTF::URL generateUniqueURL(); 38 38 39 static Ref<UserScript> create(WebCore::UserScript userScript, API:: UserContentWorld& world)39 static Ref<UserScript> create(WebCore::UserScript userScript, API::ContentWorld& world) 40 40 { 41 41 return adoptRef(*new UserScript(WTFMove(userScript), world)); 42 42 } 43 43 44 UserScript(WebCore::UserScript, API:: UserContentWorld&);44 UserScript(WebCore::UserScript, API::ContentWorld&); 45 45 46 46 const WebCore::UserScript& userScript() const { return m_userScript; } 47 47 48 UserContentWorld& userContentWorld() { return m_world; }49 const UserContentWorld& userContentWorld() const { return m_world; }48 ContentWorld& contentWorld() { return m_world; } 49 const ContentWorld& contentWorld() const { return m_world; } 50 50 51 51 private: 52 52 WebCore::UserScript m_userScript; 53 Ref< UserContentWorld> m_world;53 Ref<ContentWorld> m_world; 54 54 }; 55 55 -
trunk/Source/WebKit/UIProcess/API/APIUserStyleSheet.cpp
r246034 r257552 37 37 } 38 38 39 UserStyleSheet::UserStyleSheet(WebCore::UserStyleSheet userStyleSheet, API:: UserContentWorld& world)39 UserStyleSheet::UserStyleSheet(WebCore::UserStyleSheet userStyleSheet, API::ContentWorld& world) 40 40 : m_userStyleSheet(userStyleSheet) 41 41 , m_world(world) -
trunk/Source/WebKit/UIProcess/API/APIUserStyleSheet.h
r238771 r257552 26 26 #pragma once 27 27 28 #include "APIContentWorld.h" 28 29 #include "APIObject.h" 29 #include "APIUserContentWorld.h"30 30 #include <WebCore/UserStyleSheet.h> 31 31 #include <wtf/Identified.h> … … 37 37 static WTF::URL generateUniqueURL(); 38 38 39 static Ref<UserStyleSheet> create(WebCore::UserStyleSheet userStyleSheet, API:: UserContentWorld& world)39 static Ref<UserStyleSheet> create(WebCore::UserStyleSheet userStyleSheet, API::ContentWorld& world) 40 40 { 41 41 return adoptRef(*new UserStyleSheet(WTFMove(userStyleSheet), world)); 42 42 } 43 43 44 UserStyleSheet(WebCore::UserStyleSheet, API:: UserContentWorld&);44 UserStyleSheet(WebCore::UserStyleSheet, API::ContentWorld&); 45 45 46 46 const WebCore::UserStyleSheet& userStyleSheet() const { return m_userStyleSheet; } 47 47 48 UserContentWorld& userContentWorld() { return m_world; }49 const UserContentWorld& userContentWorld() const { return m_world; }48 ContentWorld& contentWorld() { return m_world; } 49 const ContentWorld& contentWorld() const { return m_world; } 50 50 51 51 private: 52 52 WebCore::UserStyleSheet m_userStyleSheet; 53 Ref< UserContentWorld> m_world;53 Ref<ContentWorld> m_world; 54 54 }; 55 55 -
trunk/Source/WebKit/UIProcess/API/C/WKPageGroup.cpp
r238771 r257552 29 29 #include "APIArray.h" 30 30 #include "APIContentRuleList.h" 31 #include "API UserContentWorld.h"31 #include "APIContentWorld.h" 32 32 #include "APIUserScript.h" 33 33 #include "APIUserStyleSheet.h" … … 78 78 auto blacklist = toImpl(blacklistedURLPatterns); 79 79 80 Ref<API::UserStyleSheet> userStyleSheet = API::UserStyleSheet::create(WebCore::UserStyleSheet { source, (baseURLString.isEmpty() ? WTF::blankURL() : URL(URL(), baseURLString)), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), toUserContentInjectedFrames(injectedFrames), WebCore::UserStyleUserLevel }, API:: UserContentWorld::normalWorld());80 Ref<API::UserStyleSheet> userStyleSheet = API::UserStyleSheet::create(WebCore::UserStyleSheet { source, (baseURLString.isEmpty() ? WTF::blankURL() : URL(URL(), baseURLString)), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), toUserContentInjectedFrames(injectedFrames), WebCore::UserStyleUserLevel }, API::ContentWorld::pageContentWorld()); 81 81 82 82 toImpl(pageGroupRef)->userContentController().addUserStyleSheet(userStyleSheet.get()); … … 100 100 101 101 auto url = baseURLString.isEmpty() ? WTF::blankURL() : URL(URL(), baseURLString); 102 Ref<API::UserScript> userScript = API::UserScript::create(WebCore::UserScript { WTFMove(source), WTFMove(url), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), toUserScriptInjectionTime(injectionTime), toUserContentInjectedFrames(injectedFrames) }, API:: UserContentWorld::normalWorld());102 Ref<API::UserScript> userScript = API::UserScript::create(WebCore::UserScript { WTFMove(source), WTFMove(url), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), toUserScriptInjectionTime(injectionTime), toUserContentInjectedFrames(injectedFrames) }, API::ContentWorld::pageContentWorld()); 103 103 toImpl(pageGroupRef)->userContentController().addUserScript(userScript.get(), InjectUserScriptImmediately::No); 104 104 } -
trunk/Source/WebKit/UIProcess/API/C/WKUserScriptRef.cpp
r197172 r257552 39 39 WKUserScriptRef WKUserScriptCreateWithSource(WKStringRef sourceRef, _WKUserScriptInjectionTime injectionTime, bool forMainFrameOnly) 40 40 { 41 return toAPI(&API::UserScript::create(WebCore::UserScript { toWTFString(sourceRef), API::UserScript::generateUniqueURL(), { }, { }, toUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames }, API:: UserContentWorld::normalWorld()).leakRef());41 return toAPI(&API::UserScript::create(WebCore::UserScript { toWTFString(sourceRef), API::UserScript::generateUniqueURL(), { }, { }, toUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames }, API::ContentWorld::pageContentWorld()).leakRef()); 42 42 } 43 43 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentWorld.mm
r256561 r257552 75 75 - (_WKUserContentWorld *)_userContentWorld 76 76 { 77 return [[ wrapper(API::UserContentWorld::fromContentWorld(*_contentWorld)) retain] autorelease];77 return [[[_WKUserContentWorld alloc] _initWithContentWorld:self] autorelease]; 78 78 } 79 79 ALLOW_DEPRECATED_DECLARATIONS_END -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKUserContentController.mm
r256332 r257552 27 27 #import "WKUserContentControllerInternal.h" 28 28 29 #import "APIContentWorld.h" 29 30 #import "APISerializedScriptValue.h" 30 #import "APIUserContentWorld.h"31 31 #import "InjectUserScriptImmediately.h" 32 32 #import "WKContentRuleListInternal.h" 33 #import "WKContentWorldInternal.h" 33 34 #import "WKFrameInfoInternal.h" 34 35 #import "WKNSArray.h" … … 147 148 - (void)addScriptMessageHandler:(id <WKScriptMessageHandler>)scriptMessageHandler name:(NSString *)name 148 149 { 149 auto handler = WebKit::WebScriptMessageHandler::create(makeUnique<ScriptMessageHandlerDelegate>(self, scriptMessageHandler, name), name, API:: UserContentWorld::normalWorld());150 auto handler = WebKit::WebScriptMessageHandler::create(makeUnique<ScriptMessageHandlerDelegate>(self, scriptMessageHandler, name), name, API::ContentWorld::pageContentWorld()); 150 151 if (!_userContentControllerProxy->addUserScriptMessageHandler(handler.get())) 151 152 [NSException raise:NSInvalidArgumentException format:@"Attempt to add script message handler with name '%@' when one already exists.", name]; … … 154 155 - (void)removeScriptMessageHandlerForName:(NSString *)name 155 156 { 156 _userContentControllerProxy->removeUserMessageHandlerForName(name, API:: UserContentWorld::normalWorld());157 _userContentControllerProxy->removeUserMessageHandlerForName(name, API::ContentWorld::pageContentWorld()); 157 158 } 158 159 … … 176 177 - (void)_removeAllUserScriptsAssociatedWithUserContentWorld:(_WKUserContentWorld *)userContentWorld 177 178 { 178 _userContentControllerProxy->removeAllUserScripts(*userContentWorld->_ userContentWorld);179 _userContentControllerProxy->removeAllUserScripts(*userContentWorld->_contentWorld->_contentWorld); 179 180 } 180 181 ALLOW_DEPRECATED_DECLARATIONS_END … … 229 230 - (void)_removeAllUserStyleSheetsAssociatedWithUserContentWorld:(_WKUserContentWorld *)userContentWorld 230 231 { 231 _userContentControllerProxy->removeAllUserStyleSheets(*userContentWorld->_ userContentWorld);232 _userContentControllerProxy->removeAllUserStyleSheets(*userContentWorld->_contentWorld->_contentWorld); 232 233 } 233 234 234 235 - (void)_addScriptMessageHandler:(id <WKScriptMessageHandler>)scriptMessageHandler name:(NSString *)name userContentWorld:(_WKUserContentWorld *)userContentWorld 235 236 { 236 auto handler = WebKit::WebScriptMessageHandler::create(makeUnique<ScriptMessageHandlerDelegate>(self, scriptMessageHandler, name), name, *userContentWorld->_ userContentWorld);237 auto handler = WebKit::WebScriptMessageHandler::create(makeUnique<ScriptMessageHandlerDelegate>(self, scriptMessageHandler, name), name, *userContentWorld->_contentWorld->_contentWorld); 237 238 if (!_userContentControllerProxy->addUserScriptMessageHandler(handler.get())) 238 239 [NSException raise:NSInvalidArgumentException format:@"Attempt to add script message handler with name '%@' when one already exists.", name]; … … 241 242 - (void)_removeScriptMessageHandlerForName:(NSString *)name userContentWorld:(_WKUserContentWorld *)userContentWorld 242 243 { 243 _userContentControllerProxy->removeUserMessageHandlerForName(name, *userContentWorld->_ userContentWorld);244 _userContentControllerProxy->removeUserMessageHandlerForName(name, *userContentWorld->_contentWorld->_contentWorld); 244 245 } 245 246 246 247 - (void)_removeAllScriptMessageHandlersAssociatedWithUserContentWorld:(_WKUserContentWorld *)userContentWorld 247 248 { 248 _userContentControllerProxy->removeAllUserMessageHandlers(*userContentWorld->_ userContentWorld);249 _userContentControllerProxy->removeAllUserMessageHandlers(*userContentWorld->_contentWorld->_contentWorld); 249 250 } 250 251 ALLOW_DEPRECATED_DECLARATIONS_END -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKUserScript.mm
r256332 r257552 36 36 return nil; 37 37 38 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { WTF::String(source), API::UserScript::generateUniqueURL(), { }, { }, API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames }, API:: UserContentWorld::normalWorld());38 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { WTF::String(source), API::UserScript::generateUniqueURL(), { }, { }, API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames }, API::ContentWorld::pageContentWorld()); 39 39 40 40 return self; … … 85 85 return nil; 86 86 87 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { WTF::String(source), API::UserScript::generateUniqueURL(), API::toStringVector(legacyWhitelist), API::toStringVector(legacyBlacklist), API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames }, *userContentWorld->_ userContentWorld);87 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { WTF::String(source), API::UserScript::generateUniqueURL(), API::toStringVector(legacyWhitelist), API::toStringVector(legacyBlacklist), API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames }, *userContentWorld->_contentWorld->_contentWorld); 88 88 89 89 return self; … … 95 95 return nil; 96 96 97 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { WTF::String(source), URL(associatedURL), API::toStringVector(legacyWhitelist), API::toStringVector(legacyBlacklist), API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames }, *userContentWorld->_ userContentWorld);97 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { WTF::String(source), URL(associatedURL), API::toStringVector(legacyWhitelist), API::toStringVector(legacyBlacklist), API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames }, *userContentWorld->_contentWorld->_contentWorld); 98 98 99 99 return self; … … 102 102 - (_WKUserContentWorld *)_userContentWorld 103 103 { 104 return wrapper(_userScript->userContentWorld());104 return [[[_WKUserContentWorld alloc] _initWithContentWorld:wrapper(_userScript->contentWorld())] autorelease]; 105 105 } 106 106 ALLOW_DEPRECATED_DECLARATIONS_END 107 107 108 - (instancetype)_initWithSource:(NSString *)source injectionTime:(WKUserScriptInjectionTime)injectionTime forMainFrameOnly:(BOOL)forMainFrameOnly legacyWhitelist:(NSArray *)legacyWhitelist legacyBlacklist:(NSArray *)legacyBlacklist contentWorld:(WKContentWorld *)contentWorld 109 { 110 if (!(self = [super init])) 111 return nil; 112 113 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { WTF::String(source), API::UserScript::generateUniqueURL(), API::toStringVector(legacyWhitelist), API::toStringVector(legacyBlacklist), API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames }, *contentWorld->_contentWorld); 114 115 return self; 116 } 117 118 - (instancetype)_initWithSource:(NSString *)source injectionTime:(WKUserScriptInjectionTime)injectionTime forMainFrameOnly:(BOOL)forMainFrameOnly legacyWhitelist:(NSArray *)legacyWhitelist legacyBlacklist:(NSArray *)legacyBlacklist associatedURL:(NSURL *)associatedURL contentWorld:(WKContentWorld *)contentWorld 119 { 120 if (!(self = [super init])) 121 return nil; 122 123 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { WTF::String(source), URL(associatedURL), API::toStringVector(legacyWhitelist), API::toStringVector(legacyBlacklist), API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames }, *contentWorld->_contentWorld); 124 125 return self; 126 } 127 128 - (WKContentWorld *)_contentWorld 129 { 130 return wrapper(_userScript->contentWorld()); 131 } 132 108 133 @end -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKUserScriptPrivate.h
r243376 r257552 28 28 NS_ASSUME_NONNULL_BEGIN 29 29 30 @class WKContentWorld; 30 31 @class _WKUserContentWorld; 31 32 … … 35 36 - (instancetype)_initWithSource:(NSString *)source injectionTime:(WKUserScriptInjectionTime)injectionTime forMainFrameOnly:(BOOL)forMainFrameOnly legacyWhitelist:(NSArray<NSString *> *)legacyWhitelist legacyBlacklist:(NSArray<NSString *> *)legacyBlacklist associatedURL:(NSURL *)associatedURL userContentWorld:(_WKUserContentWorld *)userContentWorld WK_API_AVAILABLE(macos(10.12), ios(10.0)); 36 37 38 - (instancetype)_initWithSource:(NSString *)source injectionTime:(WKUserScriptInjectionTime)injectionTime forMainFrameOnly:(BOOL)forMainFrameOnly legacyWhitelist:(NSArray<NSString *> *)legacyWhitelist legacyBlacklist:(NSArray<NSString *> *)legacyBlacklist contentWorld:(WKContentWorld *)contentWorld WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 39 - (instancetype)_initWithSource:(NSString *)source injectionTime:(WKUserScriptInjectionTime)injectionTime forMainFrameOnly:(BOOL)forMainFrameOnly legacyWhitelist:(NSArray<NSString *> *)legacyWhitelist legacyBlacklist:(NSArray<NSString *> *)legacyBlacklist associatedURL:(NSURL *)associatedURL contentWorld:(WKContentWorld *)contentWorld WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 40 37 41 @property (nonatomic, readonly) _WKUserContentWorld *_userContentWorld WK_API_AVAILABLE(macos(10.12), ios(10.0)); 42 @property (nonatomic, readonly) WKContentWorld *_contentWorld WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 38 43 39 44 @end -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentWorld.mm
r256561 r257552 27 27 #import "_WKUserContentWorldInternal.h" 28 28 29 #import "WKContentWorldInternal.h" 30 29 31 ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN 30 32 @implementation _WKUserContentWorld 31 33 34 - (instancetype)_initWithName:(NSString *)name 35 { 36 if (!(self = [super init])) 37 return nil; 38 39 _contentWorld = [WKContentWorld worldWithName:name]; 40 return self; 41 } 42 43 - (instancetype)_init 44 { 45 if (!(self = [super init])) 46 return nil; 47 48 _contentWorld = [WKContentWorld pageWorld]; 49 return self; 50 } 51 52 - (instancetype)_initWithContentWorld:(WKContentWorld *)world 53 { 54 if (!(self = [super init])) 55 return nil; 56 57 _contentWorld = world; 58 return self; 59 } 60 32 61 + (_WKUserContentWorld *)worldWithName:(NSString *)name 33 62 { 34 return wrapper(API::UserContentWorld::worldWithName(name));63 return [[[_WKUserContentWorld alloc] _initWithName:name] autorelease]; 35 64 } 36 65 37 66 + (_WKUserContentWorld *)normalWorld 38 67 { 39 return wrapper(API::UserContentWorld::normalWorld()); 40 } 41 42 - (void)dealloc 43 { 44 _userContentWorld->~UserContentWorld(); 45 46 [super dealloc]; 68 return [[[_WKUserContentWorld alloc] _init] autorelease]; 47 69 } 48 70 49 71 - (NSString *)name 50 72 { 51 if (_userContentWorld.get() == &API::UserContentWorld::normalWorld()) 52 return nil; 53 return _userContentWorld->name(); 73 return [_contentWorld name]; 54 74 } 55 75 … … 58 78 - (API::Object&)_apiObject 59 79 { 60 return *_userContentWorld;80 return [_contentWorld _apiObject]; 61 81 } 62 82 -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentWorldInternal.h
r256332 r257552 26 26 #import "_WKUserContentWorld.h" 27 27 28 #import "APIUserContentWorld.h" 29 #import "WKObject.h" 30 #import <wtf/Vector.h> 31 #import <wtf/text/WTFString.h> 32 33 namespace WebKit { 34 35 template<> struct WrapperTraits<API::UserContentWorld> { 36 ALLOW_DEPRECATED_DECLARATIONS_BEGIN 37 using WrapperClass = _WKUserContentWorld; 38 ALLOW_DEPRECATED_DECLARATIONS_END 39 }; 40 41 } 28 @class WKContentWorld; 42 29 43 30 namespace API { … … 63 50 @interface _WKUserContentWorld () <WKObject> { 64 51 @package 65 API::ObjectStorage<API::UserContentWorld> _userContentWorld;52 RetainPtr<WKContentWorld> _contentWorld; 66 53 } 54 - (instancetype)_initWithContentWorld:(WKContentWorld *)world; 67 55 @end -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserStyleSheet.mm
r256332 r257552 43 43 WebKit::InitializeWebKit2(); 44 44 45 API::Object::constructInWrapper<API::UserStyleSheet>(self, WebCore::UserStyleSheet { WTF::String(source), API::UserStyleSheet::generateUniqueURL(), { }, { }, forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames, WebCore::UserStyleUserLevel }, API:: UserContentWorld::normalWorld());45 API::Object::constructInWrapper<API::UserStyleSheet>(self, WebCore::UserStyleSheet { WTF::String(source), API::UserStyleSheet::generateUniqueURL(), { }, { }, forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames, WebCore::UserStyleUserLevel }, API::ContentWorld::pageContentWorld()); 46 46 47 47 return self; … … 57 57 WebKit::InitializeWebKit2(); 58 58 59 API::Object::constructInWrapper<API::UserStyleSheet>(self, WebCore::UserStyleSheet { WTF::String(source), API::UserStyleSheet::generateUniqueURL(), API::toStringVector(legacyWhitelist), API::toStringVector(legacyBlacklist), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames, WebCore::UserStyleUserLevel }, *userContentWorld->_ userContentWorld);59 API::Object::constructInWrapper<API::UserStyleSheet>(self, WebCore::UserStyleSheet { WTF::String(source), API::UserStyleSheet::generateUniqueURL(), API::toStringVector(legacyWhitelist), API::toStringVector(legacyBlacklist), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames, WebCore::UserStyleUserLevel }, *userContentWorld->_contentWorld->_contentWorld); 60 60 61 61 return self; … … 70 70 WebKit::InitializeWebKit2(); 71 71 72 API::Object::constructInWrapper<API::UserStyleSheet>(self, WebCore::UserStyleSheet { WTF::String(source), { URL(), WTF::String([baseURL _web_originalDataAsWTFString]) }, API::toStringVector(legacyWhitelist), API::toStringVector(legacyBlacklist), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames, WebCore::UserStyleUserLevel }, *userContentWorld->_ userContentWorld);72 API::Object::constructInWrapper<API::UserStyleSheet>(self, WebCore::UserStyleSheet { WTF::String(source), { URL(), WTF::String([baseURL _web_originalDataAsWTFString]) }, API::toStringVector(legacyWhitelist), API::toStringVector(legacyBlacklist), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames, WebCore::UserStyleUserLevel }, *userContentWorld->_contentWorld->_contentWorld); 73 73 74 74 return self; -
trunk/Source/WebKit/UIProcess/API/glib/WebKitUserContent.cpp
r241790 r257552 39 39 40 40 41 API::UserContentWorld& webkitUserContentWorld(const char* worldName) 42 { 43 static NeverDestroyed<HashMap<CString, RefPtr<API::UserContentWorld>>> map; 44 return *map.get().ensure(worldName, [worldName = String::fromUTF8(worldName)] { return API::UserContentWorld::worldWithName(worldName); }).iterator->value; 41 API::ContentWorld& webkitContentWorld(const char* worldName) 42 { 43 static NeverDestroyed<HashMap<CString, RefPtr<API::ContentWorld>>> map; 44 return *map.get().ensure(worldName, [worldName = String::fromUTF8(worldName)] { 45 return API::ContentWorld::sharedWorldWithName(worldName); 46 }).iterator->value; 45 47 } 46 48 … … 96 98 97 99 struct _WebKitUserStyleSheet { 98 _WebKitUserStyleSheet(const gchar* source, WebKitUserContentInjectedFrames injectedFrames, WebKitUserStyleLevel level, const char* const* whitelist, const char* const* blacklist, API:: UserContentWorld& world)100 _WebKitUserStyleSheet(const gchar* source, WebKitUserContentInjectedFrames injectedFrames, WebKitUserStyleLevel level, const char* const* whitelist, const char* const* blacklist, API::ContentWorld& world) 99 101 : userStyleSheet(adoptRef(new API::UserStyleSheet(UserStyleSheet { 100 102 String::fromUTF8(source), URL { }, … … 172 174 g_return_val_if_fail(source, nullptr); 173 175 WebKitUserStyleSheet* userStyleSheet = static_cast<WebKitUserStyleSheet*>(fastMalloc(sizeof(WebKitUserStyleSheet))); 174 new (userStyleSheet) WebKitUserStyleSheet(source, injectedFrames, level, whitelist, blacklist, API:: UserContentWorld::normalWorld());176 new (userStyleSheet) WebKitUserStyleSheet(source, injectedFrames, level, whitelist, blacklist, API::ContentWorld::pageContentWorld()); 175 177 return userStyleSheet; 176 178 } … … 198 200 199 201 WebKitUserStyleSheet* userStyleSheet = static_cast<WebKitUserStyleSheet*>(fastMalloc(sizeof(WebKitUserStyleSheet))); 200 new (userStyleSheet) WebKitUserStyleSheet(source, injectedFrames, level, whitelist, blacklist, webkit UserContentWorld(worldName));202 new (userStyleSheet) WebKitUserStyleSheet(source, injectedFrames, level, whitelist, blacklist, webkitContentWorld(worldName)); 201 203 return userStyleSheet; 202 204 } … … 208 210 209 211 struct _WebKitUserScript { 210 _WebKitUserScript(const gchar* source, WebKitUserContentInjectedFrames injectedFrames, WebKitUserScriptInjectionTime injectionTime, const gchar* const* whitelist, const gchar* const* blacklist, API:: UserContentWorld& world)212 _WebKitUserScript(const gchar* source, WebKitUserContentInjectedFrames injectedFrames, WebKitUserScriptInjectionTime injectionTime, const gchar* const* whitelist, const gchar* const* blacklist, API::ContentWorld& world) 211 213 : userScript(adoptRef(new API::UserScript(UserScript { 212 214 String::fromUTF8(source), URL { }, … … 284 286 g_return_val_if_fail(source, nullptr); 285 287 WebKitUserScript* userScript = static_cast<WebKitUserScript*>(fastMalloc(sizeof(WebKitUserScript))); 286 new (userScript) WebKitUserScript(source, injectedFrames, injectionTime, whitelist, blacklist, API:: UserContentWorld::normalWorld());288 new (userScript) WebKitUserScript(source, injectedFrames, injectionTime, whitelist, blacklist, API::ContentWorld::pageContentWorld()); 287 289 return userScript; 288 290 } … … 310 312 311 313 WebKitUserScript* userScript = static_cast<WebKitUserScript*>(fastMalloc(sizeof(WebKitUserScript))); 312 new (userScript) WebKitUserScript(source, injectedFrames, injectionTime, whitelist, blacklist, webkit UserContentWorld(worldName));314 new (userScript) WebKitUserScript(source, injectedFrames, injectionTime, whitelist, blacklist, webkitContentWorld(worldName)); 313 315 return userScript; 314 316 } -
trunk/Source/WebKit/UIProcess/API/glib/WebKitUserContentManager.cpp
r252492 r257552 240 240 241 241 Ref<WebScriptMessageHandler> handler = 242 WebScriptMessageHandler::create(makeUnique<ScriptMessageClientGtk>(manager, name), String::fromUTF8(name), API:: UserContentWorld::normalWorld());242 WebScriptMessageHandler::create(makeUnique<ScriptMessageClientGtk>(manager, name), String::fromUTF8(name), API::ContentWorld::pageContentWorld()); 243 243 return manager->priv->userContentController->addUserScriptMessageHandler(handler.get()); 244 244 } … … 264 264 g_return_if_fail(WEBKIT_IS_USER_CONTENT_MANAGER(manager)); 265 265 g_return_if_fail(name); 266 manager->priv->userContentController->removeUserMessageHandlerForName(String::fromUTF8(name), API:: UserContentWorld::normalWorld());266 manager->priv->userContentController->removeUserMessageHandlerForName(String::fromUTF8(name), API::ContentWorld::pageContentWorld()); 267 267 } 268 268 … … 290 290 291 291 Ref<WebScriptMessageHandler> handler = 292 WebScriptMessageHandler::create(makeUnique<ScriptMessageClientGtk>(manager, name), String::fromUTF8(name), webkit UserContentWorld(worldName));292 WebScriptMessageHandler::create(makeUnique<ScriptMessageClientGtk>(manager, name), String::fromUTF8(name), webkitContentWorld(worldName)); 293 293 return manager->priv->userContentController->addUserScriptMessageHandler(handler.get()); 294 294 } … … 317 317 g_return_if_fail(worldName); 318 318 319 manager->priv->userContentController->removeUserMessageHandlerForName(String::fromUTF8(name), webkit UserContentWorld(worldName));319 manager->priv->userContentController->removeUserMessageHandlerForName(String::fromUTF8(name), webkitContentWorld(worldName)); 320 320 } 321 321 -
trunk/Source/WebKit/UIProcess/API/glib/WebKitUserContentPrivate.h
r241790 r257552 22 22 23 23 #include "APIContentRuleList.h" 24 #include "API UserContentWorld.h"24 #include "APIContentWorld.h" 25 25 #include "APIUserScript.h" 26 26 #include "APIUserStyleSheet.h" … … 31 31 API::UserScript& webkitUserScriptGetUserScript(WebKitUserScript*); 32 32 API::UserStyleSheet& webkitUserStyleSheetGetUserStyleSheet(WebKitUserStyleSheet*); 33 API:: UserContentWorld& webkitUserContentWorld(const char*);33 API::ContentWorld& webkitContentWorld(const char*); 34 34 API::ContentRuleList& webkitUserContentFilterGetContentRuleList(WebKitUserContentFilter*); 35 35 WebKitUserContentFilter* webkitUserContentFilterCreate(RefPtr<API::ContentRuleList>&&); -
trunk/Source/WebKit/UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp
r255232 r257552 23 23 #if ENABLE(REMOTE_INSPECTOR) 24 24 25 #include "API UserContentWorld.h"25 #include "APIContentWorld.h" 26 26 #include "WebKitError.h" 27 27 #include "WebKitNavigationPolicyDecision.h" … … 74 74 75 75 for (auto* userContentManager : m_userContentManagers) { 76 webkitUserContentManagerGetUserContentControllerProxy(userContentManager)->removeUserMessageHandlerForName("inspector", API:: UserContentWorld::normalWorld());76 webkitUserContentManagerGetUserContentControllerProxy(userContentManager)->removeUserMessageHandlerForName("inspector", API::ContentWorld::pageContentWorld()); 77 77 g_object_weak_unref(G_OBJECT(userContentManager), reinterpret_cast<GWeakNotify>(userContentManagerDestroyed), this); 78 78 } … … 107 107 auto userContentManagerResult = m_userContentManagers.add(userContentManager); 108 108 if (userContentManagerResult.isNewEntry) { 109 auto handler = WebScriptMessageHandler::create(makeUnique<ScriptMessageClient>(*this), "inspector", API:: UserContentWorld::normalWorld());109 auto handler = WebScriptMessageHandler::create(makeUnique<ScriptMessageClient>(*this), "inspector", API::ContentWorld::pageContentWorld()); 110 110 webkitUserContentManagerGetUserContentControllerProxy(userContentManager)->addUserScriptMessageHandler(handler.get()); 111 111 g_object_weak_ref(G_OBJECT(userContentManager), reinterpret_cast<GWeakNotify>(userContentManagerDestroyed), this); -
trunk/Source/WebKit/UIProcess/Inspector/socket/RemoteInspectorProtocolHandler.cpp
r255214 r257552 29 29 #if ENABLE(REMOTE_INSPECTOR) 30 30 31 #include "APIContentWorld.h" 31 32 #include "APILoaderClient.h" 32 33 #include "APINavigation.h" 33 #include "APIUserContentWorld.h"34 34 #include "WebPageGroup.h" 35 35 #include "WebPageProxy.h" … … 158 158 159 159 // Setup target postMessage listener 160 auto handler = WebScriptMessageHandler::create(makeUnique<ScriptMessageClient>(*this), "inspector", API:: UserContentWorld::normalWorld());160 auto handler = WebScriptMessageHandler::create(makeUnique<ScriptMessageClient>(*this), "inspector", API::ContentWorld::pageContentWorld()); 161 161 pageProxy.pageGroup().userContentController().addUserScriptMessageHandler(handler.get()); 162 162 -
trunk/Source/WebKit/UIProcess/UserContent/WebScriptMessageHandler.cpp
r221399 r257552 27 27 #include "WebScriptMessageHandler.h" 28 28 29 #include "API UserContentWorld.h"29 #include "APIContentWorld.h" 30 30 31 31 namespace WebKit { 32 32 33 Ref<WebScriptMessageHandler> WebScriptMessageHandler::create(std::unique_ptr<Client> client, const String& name, API:: UserContentWorld& world)33 Ref<WebScriptMessageHandler> WebScriptMessageHandler::create(std::unique_ptr<Client> client, const String& name, API::ContentWorld& world) 34 34 { 35 35 return adoptRef(*new WebScriptMessageHandler(WTFMove(client), name, world)); 36 36 } 37 37 38 WebScriptMessageHandler::WebScriptMessageHandler(std::unique_ptr<Client> client, const String& name, API:: UserContentWorld& world)38 WebScriptMessageHandler::WebScriptMessageHandler(std::unique_ptr<Client> client, const String& name, API::ContentWorld& world) 39 39 : m_client(WTFMove(client)) 40 40 , m_name(name) -
trunk/Source/WebKit/UIProcess/UserContent/WebScriptMessageHandler.h
r254862 r257552 26 26 #pragma once 27 27 28 #include "API UserContentWorld.h"28 #include "APIContentWorld.h" 29 29 #include "WebUserContentControllerDataTypes.h" 30 30 #include <wtf/Identified.h> … … 39 39 40 40 namespace API { 41 class UserContentWorld;41 class ContentWorld; 42 42 } 43 43 … … 56 56 }; 57 57 58 static Ref<WebScriptMessageHandler> create(std::unique_ptr<Client>, const String& name, API:: UserContentWorld&);58 static Ref<WebScriptMessageHandler> create(std::unique_ptr<Client>, const String& name, API::ContentWorld&); 59 59 virtual ~WebScriptMessageHandler(); 60 60 61 61 String name() const { return m_name; } 62 62 63 API::ContentWorld Base& world() { return m_world.get(); }63 API::ContentWorld& world() { return m_world.get(); } 64 64 65 65 Client& client() const { return *m_client; } 66 66 67 67 private: 68 WebScriptMessageHandler(std::unique_ptr<Client>, const String&, API:: UserContentWorld&);68 WebScriptMessageHandler(std::unique_ptr<Client>, const String&, API::ContentWorld&); 69 69 70 70 std::unique_ptr<Client> m_client; 71 71 String m_name; 72 Ref<API:: UserContentWorld> m_world;72 Ref<API::ContentWorld> m_world; 73 73 }; 74 74 -
trunk/Source/WebKit/UIProcess/UserContent/WebUserContentControllerProxy.cpp
r255127 r257552 29 29 #include "APIArray.h" 30 30 #include "APIContentWorld.h" 31 #include "APIUserContentWorld.h"32 31 #include "APIUserScript.h" 33 32 #include "APIUserStyleSheet.h" … … 111 110 ASSERT(parameters.userScripts.isEmpty()); 112 111 for (auto userScript : m_userScripts->elementsOfType<API::UserScript>()) 113 parameters.userScripts.append({ userScript->identifier(), userScript-> userContentWorld().identifier(), userScript->userScript() });112 parameters.userScripts.append({ userScript->identifier(), userScript->contentWorld().identifier(), userScript->userScript() }); 114 113 115 114 ASSERT(parameters.userStyleSheets.isEmpty()); 116 115 for (auto userStyleSheet : m_userStyleSheets->elementsOfType<API::UserStyleSheet>()) 117 parameters.userStyleSheets.append({ userStyleSheet->identifier(), userStyleSheet-> userContentWorld().identifier(), userStyleSheet->userStyleSheet() });116 parameters.userStyleSheets.append({ userStyleSheet->identifier(), userStyleSheet->contentWorld().identifier(), userStyleSheet->userStyleSheet() }); 118 117 119 118 ASSERT(parameters.messageHandlers.isEmpty()); … … 147 146 } 148 147 149 void WebUserContentControllerProxy::add UserContentWorldUse(API::ContentWorldBase& world)150 { 151 if (&world == &API:: UserContentWorld::normalWorld())148 void WebUserContentControllerProxy::addContentWorldUse(API::ContentWorld& world) 149 { 150 if (&world == &API::ContentWorld::pageContentWorld()) 152 151 return; 153 152 … … 155 154 if (addResult.isNewEntry) { 156 155 for (auto& process : m_processes) 157 process.send(Messages::WebUserContentController::Add UserContentWorlds({ world.worldData() }), identifier());158 } 159 } 160 161 bool WebUserContentControllerProxy::shouldSendRemove UserContentWorldsMessage(API::UserContentWorld& world, unsigned numberOfUsesToRemove)162 { 163 if (&world == &API:: UserContentWorld::normalWorld())156 process.send(Messages::WebUserContentController::AddContentWorlds({ world.worldData() }), identifier()); 157 } 158 } 159 160 bool WebUserContentControllerProxy::shouldSendRemoveContentWorldsMessage(API::ContentWorld& world, unsigned numberOfUsesToRemove) 161 { 162 if (&world == &API::ContentWorld::pageContentWorld()) 164 163 return false; 165 164 … … 175 174 } 176 175 177 void WebUserContentControllerProxy::remove UserContentWorldUses(API::UserContentWorld& world, unsigned numberOfUsesToRemove)178 { 179 if (shouldSendRemove UserContentWorldsMessage(world, numberOfUsesToRemove)) {176 void WebUserContentControllerProxy::removeContentWorldUses(API::ContentWorld& world, unsigned numberOfUsesToRemove) 177 { 178 if (shouldSendRemoveContentWorldsMessage(world, numberOfUsesToRemove)) { 180 179 for (auto& process : m_processes) 181 process.send(Messages::WebUserContentController::Remove UserContentWorlds({ world.identifier() }), identifier());182 } 183 } 184 185 void WebUserContentControllerProxy::remove UserContentWorldUses(HashCountedSet<RefPtr<API::UserContentWorld>>& worlds)180 process.send(Messages::WebUserContentController::RemoveContentWorlds({ world.identifier() }), identifier()); 181 } 182 } 183 184 void WebUserContentControllerProxy::removeContentWorldUses(HashCountedSet<RefPtr<API::ContentWorld>>& worlds) 186 185 { 187 186 Vector<ContentWorldIdentifier> worldsToRemove; 188 187 for (auto& worldUsePair : worlds) { 189 if (shouldSendRemove UserContentWorldsMessage(*worldUsePair.key.get(), worldUsePair.value))188 if (shouldSendRemoveContentWorldsMessage(*worldUsePair.key.get(), worldUsePair.value)) 190 189 worldsToRemove.append(worldUsePair.key->identifier()); 191 190 } 192 191 193 192 for (auto& process : m_processes) 194 process.send(Messages::WebUserContentController::Remove UserContentWorlds(worldsToRemove), identifier());193 process.send(Messages::WebUserContentController::RemoveContentWorlds(worldsToRemove), identifier()); 195 194 } 196 195 197 196 void WebUserContentControllerProxy::addUserScript(API::UserScript& userScript, InjectUserScriptImmediately immediately) 198 197 { 199 Ref<API:: UserContentWorld> world = userScript.userContentWorld();200 201 add UserContentWorldUse(world.get());198 Ref<API::ContentWorld> world = userScript.contentWorld(); 199 200 addContentWorldUse(world.get()); 202 201 203 202 m_userScripts->elements().append(&userScript); … … 209 208 void WebUserContentControllerProxy::removeUserScript(API::UserScript& userScript) 210 209 { 211 Ref<API:: UserContentWorld> world = userScript.userContentWorld();210 Ref<API::ContentWorld> world = userScript.contentWorld(); 212 211 213 212 for (auto& process : m_processes) … … 216 215 m_userScripts->elements().removeAll(&userScript); 217 216 218 remove UserContentWorldUses(world.get(), 1);219 } 220 221 void WebUserContentControllerProxy::removeAllUserScripts(API:: UserContentWorld& world)217 removeContentWorldUses(world.get(), 1); 218 } 219 220 void WebUserContentControllerProxy::removeAllUserScripts(API::ContentWorld& world) 222 221 { 223 222 for (auto& process : m_processes) … … 225 224 226 225 unsigned userScriptsRemoved = m_userScripts->removeAllOfTypeMatching<API::UserScript>([&](const auto& userScript) { 227 return &userScript-> userContentWorld() == &world;226 return &userScript->contentWorld() == &world; 228 227 }); 229 228 230 remove UserContentWorldUses(world, userScriptsRemoved);229 removeContentWorldUses(world, userScriptsRemoved); 231 230 } 232 231 233 232 void WebUserContentControllerProxy::removeAllUserScripts() 234 233 { 235 HashCountedSet<RefPtr<API:: UserContentWorld>> worlds;234 HashCountedSet<RefPtr<API::ContentWorld>> worlds; 236 235 for (auto userScript : m_userScripts->elementsOfType<API::UserScript>()) 237 worlds.add(const_cast<API:: UserContentWorld*>(&userScript->userContentWorld()));236 worlds.add(const_cast<API::ContentWorld*>(&userScript->contentWorld())); 238 237 239 238 Vector<ContentWorldIdentifier> worldIdentifiers; … … 247 246 m_userScripts->elements().clear(); 248 247 249 remove UserContentWorldUses(worlds);248 removeContentWorldUses(worlds); 250 249 } 251 250 252 251 void WebUserContentControllerProxy::addUserStyleSheet(API::UserStyleSheet& userStyleSheet) 253 252 { 254 Ref<API:: UserContentWorld> world = userStyleSheet.userContentWorld();255 256 add UserContentWorldUse(world.get());253 Ref<API::ContentWorld> world = userStyleSheet.contentWorld(); 254 255 addContentWorldUse(world.get()); 257 256 258 257 m_userStyleSheets->elements().append(&userStyleSheet); … … 264 263 void WebUserContentControllerProxy::removeUserStyleSheet(API::UserStyleSheet& userStyleSheet) 265 264 { 266 Ref<API:: UserContentWorld> world = userStyleSheet.userContentWorld();265 Ref<API::ContentWorld> world = userStyleSheet.contentWorld(); 267 266 268 267 for (auto& process : m_processes) … … 271 270 m_userStyleSheets->elements().removeAll(&userStyleSheet); 272 271 273 remove UserContentWorldUses(world.get(), 1);274 } 275 276 void WebUserContentControllerProxy::removeAllUserStyleSheets(API:: UserContentWorld& world)272 removeContentWorldUses(world.get(), 1); 273 } 274 275 void WebUserContentControllerProxy::removeAllUserStyleSheets(API::ContentWorld& world) 277 276 { 278 277 for (auto& process : m_processes) … … 280 279 281 280 unsigned userStyleSheetsRemoved = m_userStyleSheets->removeAllOfTypeMatching<API::UserStyleSheet>([&](const auto& userStyleSheet) { 282 return &userStyleSheet-> userContentWorld() == &world;281 return &userStyleSheet->contentWorld() == &world; 283 282 }); 284 283 285 remove UserContentWorldUses(world, userStyleSheetsRemoved);284 removeContentWorldUses(world, userStyleSheetsRemoved); 286 285 } 287 286 288 287 void WebUserContentControllerProxy::removeAllUserStyleSheets() 289 288 { 290 HashCountedSet<RefPtr<API:: UserContentWorld>> worlds;289 HashCountedSet<RefPtr<API::ContentWorld>> worlds; 291 290 for (auto userStyleSheet : m_userStyleSheets->elementsOfType<API::UserStyleSheet>()) 292 worlds.add(const_cast<API:: UserContentWorld*>(&userStyleSheet->userContentWorld()));291 worlds.add(const_cast<API::ContentWorld*>(&userStyleSheet->contentWorld())); 293 292 294 293 Vector<ContentWorldIdentifier> worldIdentifiers; … … 302 301 m_userStyleSheets->elements().clear(); 303 302 304 remove UserContentWorldUses(worlds);303 removeContentWorldUses(worlds); 305 304 } 306 305 … … 314 313 } 315 314 316 add UserContentWorldUse(world);315 addContentWorldUse(world); 317 316 318 317 m_scriptMessageHandlers.add(handler.identifier(), &handler); … … 324 323 } 325 324 326 void WebUserContentControllerProxy::removeUserMessageHandlerForName(const String& name, API:: UserContentWorld& world)325 void WebUserContentControllerProxy::removeUserMessageHandlerForName(const String& name, API::ContentWorld& world) 327 326 { 328 327 for (auto it = m_scriptMessageHandlers.begin(), end = m_scriptMessageHandlers.end(); it != end; ++it) { … … 333 332 m_scriptMessageHandlers.remove(it); 334 333 335 remove UserContentWorldUses(world, 1);334 removeContentWorldUses(world, 1); 336 335 return; 337 336 } … … 339 338 } 340 339 341 void WebUserContentControllerProxy::removeAllUserMessageHandlers(API:: UserContentWorld& world)340 void WebUserContentControllerProxy::removeAllUserMessageHandlers(API::ContentWorld& world) 342 341 { 343 342 for (auto& process : m_processes) … … 353 352 }); 354 353 355 remove UserContentWorldUses(world, numberRemoved);354 removeContentWorldUses(world, numberRemoved); 356 355 } 357 356 -
trunk/Source/WebKit/UIProcess/UserContent/WebUserContentControllerProxy.h
r254862 r257552 42 42 class Array; 43 43 class ContentRuleList; 44 class ContentWorldBase; 45 class UserContentWorld; 44 class ContentWorld; 46 45 class UserScript; 47 46 class UserStyleSheet; … … 83 82 void addUserScript(API::UserScript&, InjectUserScriptImmediately); 84 83 void removeUserScript(API::UserScript&); 85 void removeAllUserScripts(API:: UserContentWorld&);84 void removeAllUserScripts(API::ContentWorld&); 86 85 void removeAllUserScripts(); 87 86 … … 89 88 void addUserStyleSheet(API::UserStyleSheet&); 90 89 void removeUserStyleSheet(API::UserStyleSheet&); 91 void removeAllUserStyleSheets(API:: UserContentWorld&);90 void removeAllUserStyleSheets(API::ContentWorld&); 92 91 void removeAllUserStyleSheets(); 93 92 94 void removeAllUserContent(API:: UserContentWorld&);93 void removeAllUserContent(API::ContentWorld&); 95 94 96 95 // Returns false if there was a name conflict. 97 96 bool addUserScriptMessageHandler(WebScriptMessageHandler&); 98 void removeUserMessageHandlerForName(const String&, API:: UserContentWorld&);99 void removeAllUserMessageHandlers(API:: UserContentWorld&);97 void removeUserMessageHandlerForName(const String&, API::ContentWorld&); 98 void removeAllUserMessageHandlers(API::ContentWorld&); 100 99 101 100 #if ENABLE(CONTENT_EXTENSIONS) … … 118 117 void didPostMessage(IPC::Connection&, WebPageProxyIdentifier, FrameInfoData&&, uint64_t messageHandlerID, const IPC::DataReference&); 119 118 120 void add UserContentWorldUse(API::ContentWorldBase&);121 void remove UserContentWorldUses(API::UserContentWorld&, unsigned numberOfUsesToRemove);122 void remove UserContentWorldUses(HashCountedSet<RefPtr<API::UserContentWorld>>&);123 bool shouldSendRemove UserContentWorldsMessage(API::UserContentWorld&, unsigned numberOfUsesToRemove);119 void addContentWorldUse(API::ContentWorld&); 120 void removeContentWorldUses(API::ContentWorld&, unsigned numberOfUsesToRemove); 121 void removeContentWorldUses(HashCountedSet<RefPtr<API::ContentWorld>>&); 122 bool shouldSendRemoveContentWorldsMessage(API::ContentWorld&, unsigned numberOfUsesToRemove); 124 123 125 124 UserContentControllerIdentifier m_identifier; … … 128 127 Ref<API::Array> m_userStyleSheets; 129 128 HashMap<uint64_t, RefPtr<WebScriptMessageHandler>> m_scriptMessageHandlers; 130 HashCountedSet<RefPtr<API::ContentWorld Base>> m_contentWorlds;129 HashCountedSet<RefPtr<API::ContentWorld>> m_contentWorlds; 131 130 132 131 #if ENABLE(CONTENT_EXTENSIONS) -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r257551 r257552 1266 1266 7C882DF91C7E996F006BF731 /* _WKUserContentWorldInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C882DF51C7E995E006BF731 /* _WKUserContentWorldInternal.h */; }; 1267 1267 7C882DFA1C7E9973006BF731 /* WKUserScriptPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C882DF61C7E995E006BF731 /* WKUserScriptPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1268 7C882DFD1C7E99A8006BF731 /* APIUserContentWorld.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C882DFC1C7E99A6006BF731 /* APIUserContentWorld.h */; };1269 1268 7C89D2941A67122F003A5FDE /* APIUserScript.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2921A67122F003A5FDE /* APIUserScript.h */; }; 1270 1269 7C89D2981A6753B2003A5FDE /* APIPageConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2961A6753B2003A5FDE /* APIPageConfiguration.h */; }; … … 4165 4164 7C882DF51C7E995E006BF731 /* _WKUserContentWorldInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKUserContentWorldInternal.h; sourceTree = "<group>"; }; 4166 4165 7C882DF61C7E995E006BF731 /* WKUserScriptPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserScriptPrivate.h; sourceTree = "<group>"; }; 4167 7C882DFB1C7E99A6006BF731 /* APIUserContentWorld.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIUserContentWorld.cpp; sourceTree = "<group>"; };4168 7C882DFC1C7E99A6006BF731 /* APIUserContentWorld.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIUserContentWorld.h; sourceTree = "<group>"; };4169 4166 7C89D2921A67122F003A5FDE /* APIUserScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIUserScript.h; sourceTree = "<group>"; }; 4170 4167 7C89D2951A6753B2003A5FDE /* APIPageConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIPageConfiguration.cpp; sourceTree = "<group>"; }; … … 8833 8830 51D124381E6DFDB9002B2820 /* APIURLSchemeTask.cpp */, 8834 8831 51D124391E6DFDB9002B2820 /* APIURLSchemeTask.h */, 8835 7C882DFB1C7E99A6006BF731 /* APIUserContentWorld.cpp */,8836 7C882DFC1C7E99A6006BF731 /* APIUserContentWorld.h */,8837 8832 7CB365AF1D31DD1E007158CA /* APIUserInitiatedAction.h */, 8838 8833 7C89D2A51A6789EA003A5FDE /* APIUserScript.cpp */, … … 10290 10285 BC90A1D2122DD55E00CC8C50 /* APIURLResponse.h in Headers */, 10291 10286 F6113E25126CE1820057D0A7 /* APIUserContentURLPattern.h in Headers */, 10292 7C882DFD1C7E99A8006BF731 /* APIUserContentWorld.h in Headers */,10293 10287 7CB365B11D31DD1E007158CA /* APIUserInitiatedAction.h in Headers */, 10294 10288 7C89D2941A67122F003A5FDE /* APIUserScript.h in Headers */, -
trunk/Source/WebKit/WebProcess/UserContent/WebUserContentController.cpp
r255191 r257552 102 102 } 103 103 104 void WebUserContentController::add UserContentWorld(const std::pair<ContentWorldIdentifier, String>& world)104 void WebUserContentController::addContentWorld(const std::pair<ContentWorldIdentifier, String>& world) 105 105 { 106 106 ASSERT(world.first); … … 120 120 } 121 121 122 void WebUserContentController::add UserContentWorlds(const Vector<std::pair<ContentWorldIdentifier, String>>& worlds)122 void WebUserContentController::addContentWorlds(const Vector<std::pair<ContentWorldIdentifier, String>>& worlds) 123 123 { 124 124 for (auto& world : worlds) 125 add UserContentWorld(world);126 } 127 128 void WebUserContentController::remove UserContentWorlds(const Vector<ContentWorldIdentifier>& worldIdentifiers)125 addContentWorld(world); 126 } 127 128 void WebUserContentController::removeContentWorlds(const Vector<ContentWorldIdentifier>& worldIdentifiers) 129 129 { 130 130 for (auto& worldIdentifier : worldIdentifiers) { … … 134 134 auto it = worldMap().find(worldIdentifier); 135 135 if (it == worldMap().end()) { 136 WTFLogAlways("Trying to remove a UserContentWorld (id=%" PRIu64 ") that does not exist.", worldIdentifier.toUInt64());136 WTFLogAlways("Trying to remove a ContentWorld (id=%" PRIu64 ") that does not exist.", worldIdentifier.toUInt64()); 137 137 return; 138 138 } … … 150 150 auto it = worldMap().find(userScriptData.worldIdentifier); 151 151 if (it == worldMap().end()) { 152 WTFLogAlways("Trying to add a UserScript to a UserContentWorld (id=%" PRIu64 ") that does not exist.", userScriptData.worldIdentifier.toUInt64());152 WTFLogAlways("Trying to add a UserScript to a ContentWorld (id=%" PRIu64 ") that does not exist.", userScriptData.worldIdentifier.toUInt64()); 153 153 continue; 154 154 } … … 163 163 auto it = worldMap().find(worldIdentifier); 164 164 if (it == worldMap().end()) { 165 WTFLogAlways("Trying to remove a UserScript from a UserContentWorld (id=%" PRIu64 ") that does not exist.", worldIdentifier.toUInt64());165 WTFLogAlways("Trying to remove a UserScript from a ContentWorld (id=%" PRIu64 ") that does not exist.", worldIdentifier.toUInt64()); 166 166 return; 167 167 } … … 175 175 auto it = worldMap().find(worldIdentifier); 176 176 if (it == worldMap().end()) { 177 WTFLogAlways("Trying to remove all UserScripts from a UserContentWorld (id=%" PRIu64 ") that does not exist.", worldIdentifier.toUInt64());177 WTFLogAlways("Trying to remove all UserScripts from a ContentWorld (id=%" PRIu64 ") that does not exist.", worldIdentifier.toUInt64()); 178 178 return; 179 179 } … … 188 188 auto it = worldMap().find(userStyleSheetData.worldIdentifier); 189 189 if (it == worldMap().end()) { 190 WTFLogAlways("Trying to add a UserStyleSheet to a UserContentWorld (id=%" PRIu64 ") that does not exist.", userStyleSheetData.worldIdentifier.toUInt64());190 WTFLogAlways("Trying to add a UserStyleSheet to a ContentWorld (id=%" PRIu64 ") that does not exist.", userStyleSheetData.worldIdentifier.toUInt64()); 191 191 continue; 192 192 } … … 203 203 auto it = worldMap().find(worldIdentifier); 204 204 if (it == worldMap().end()) { 205 WTFLogAlways("Trying to remove a UserStyleSheet from a UserContentWorld (id=%" PRIu64 ") that does not exist.", worldIdentifier.toUInt64());205 WTFLogAlways("Trying to remove a UserStyleSheet from a ContentWorld (id=%" PRIu64 ") that does not exist.", worldIdentifier.toUInt64()); 206 206 return; 207 207 } … … 216 216 auto it = worldMap().find(worldIdentifier); 217 217 if (it == worldMap().end()) { 218 WTFLogAlways("Trying to remove all UserStyleSheets from a UserContentWorld (id=%" PRIu64 ") that does not exist.", worldIdentifier.toUInt64());218 WTFLogAlways("Trying to remove all UserStyleSheets from a ContentWorld (id=%" PRIu64 ") that does not exist.", worldIdentifier.toUInt64()); 219 219 return; 220 220 } … … 279 279 auto it = worldMap().find(handler.worldIdentifier); 280 280 if (it == worldMap().end()) { 281 WTFLogAlways("Trying to add a UserScriptMessageHandler to a UserContentWorld (id=%" PRIu64 ") that does not exist.", handler.worldIdentifier.toUInt64());281 WTFLogAlways("Trying to add a UserScriptMessageHandler to a ContentWorld (id=%" PRIu64 ") that does not exist.", handler.worldIdentifier.toUInt64()); 282 282 continue; 283 283 } … … 295 295 auto it = worldMap().find(worldIdentifier); 296 296 if (it == worldMap().end()) { 297 WTFLogAlways("Trying to remove a UserScriptMessageHandler from a UserContentWorld (id=%" PRIu64 ") that does not exist.", worldIdentifier.toUInt64());297 WTFLogAlways("Trying to remove a UserScriptMessageHandler from a ContentWorld (id=%" PRIu64 ") that does not exist.", worldIdentifier.toUInt64()); 298 298 return; 299 299 } … … 313 313 auto it = worldMap().find(worldIdentifier); 314 314 if (it == worldMap().end()) { 315 WTFLogAlways("Trying to remove all UserScriptMessageHandler from a UserContentWorld (id=%" PRIu64 ") that does not exist.", worldIdentifier.toUInt64());315 WTFLogAlways("Trying to remove all UserScriptMessageHandler from a ContentWorld (id=%" PRIu64 ") that does not exist.", worldIdentifier.toUInt64()); 316 316 return; 317 317 } -
trunk/Source/WebKit/WebProcess/UserContent/WebUserContentController.h
r255127 r257552 67 67 InjectedBundleScriptWorld* worldForIdentifier(ContentWorldIdentifier); 68 68 69 void add UserContentWorlds(const Vector<std::pair<ContentWorldIdentifier, String>>&);70 void add UserContentWorld(const std::pair<ContentWorldIdentifier, String>&);69 void addContentWorlds(const Vector<std::pair<ContentWorldIdentifier, String>>&); 70 void addContentWorld(const std::pair<ContentWorldIdentifier, String>&); 71 71 void addUserScripts(Vector<WebUserScriptData>&&, InjectUserScriptImmediately); 72 72 void addUserStyleSheets(const Vector<WebUserStyleSheetData>&); … … 92 92 void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; 93 93 94 void remove UserContentWorlds(const Vector<ContentWorldIdentifier>&);94 void removeContentWorlds(const Vector<ContentWorldIdentifier>&); 95 95 96 96 void removeUserScript(ContentWorldIdentifier, uint64_t userScriptIdentifier); -
trunk/Source/WebKit/WebProcess/UserContent/WebUserContentController.messages.in
r255127 r257552 25 25 26 26 messages -> WebUserContentController { 27 Add UserContentWorlds(Vector<std::pair<WebKit::ContentWorldIdentifier, String>> worlds);28 Remove UserContentWorlds(Vector<WebKit::ContentWorldIdentifier> worldIdentifiers);27 AddContentWorlds(Vector<std::pair<WebKit::ContentWorldIdentifier, String>> worlds); 28 RemoveContentWorlds(Vector<WebKit::ContentWorldIdentifier> worldIdentifiers); 29 29 30 30 AddUserScripts(Vector<struct WebKit::WebUserScriptData> userScripts, enum:bool WebKit::InjectUserScriptImmediately immediately); -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r257551 r257552 710 710 registerURLSchemeHandler(iterator.value, iterator.key); 711 711 712 m_userContentController->add UserContentWorlds(parameters.userContentWorlds);712 m_userContentController->addContentWorlds(parameters.userContentWorlds); 713 713 m_userContentController->addUserScripts(WTFMove(parameters.userScripts), InjectUserScriptImmediately::No); 714 714 m_userContentController->addUserStyleSheets(parameters.userStyleSheets); … … 3445 3445 void WebPage::runJavaScriptInMainFrameScriptWorld(RunJavaScriptParameters&& parameters, const std::pair<ContentWorldIdentifier, String>& worldData, CallbackID callbackID) 3446 3446 { 3447 m_userContentController->add UserContentWorld(worldData);3447 m_userContentController->addContentWorld(worldData); 3448 3448 runJavaScript(mainWebFrame(), WTFMove(parameters), worldData.first, callbackID); 3449 3449 } -
trunk/Tools/ChangeLog
r257540 r257552 1 2020-02-26 Alex Christensen <achristensen@webkit.org> 2 3 _WKUserContentWorld should be a wrapper around WKContentWorld 4 https://bugs.webkit.org/show_bug.cgi?id=208274 5 6 Reviewed by Brady Eidson. 7 8 * TestWebKitAPI/Tests/WebKitCocoa/UserContentWorld.mm: 9 (TEST): 10 * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEvaluateJavaScript.mm: 11 (TEST): 12 1 13 2020-02-26 Ryan Haddad <ryanhaddad@apple.com> 2 14 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentWorld.mm
r253723 r257552 45 45 #import <wtf/RetainPtr.h> 46 46 47 TEST( UserContentWorld, NormalWorld)47 TEST(ContentWorld, NormalWorld) 48 48 { 49 49 RetainPtr<WKUserScript> basicUserScript = adoptNS([[WKUserScript alloc] initWithSource:@"" injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES]); 50 EXPECT_EQ([basicUserScript _userContentWorld], [_WKUserContentWorld normalWorld]); 50 EXPECT_NE([basicUserScript _userContentWorld], [_WKUserContentWorld normalWorld]); 51 EXPECT_WK_STREQ([basicUserScript _userContentWorld].name, [_WKUserContentWorld normalWorld].name); 51 52 EXPECT_NULL([basicUserScript _userContentWorld].name); 52 53 } 53 54 54 TEST( UserContentWorld, NormalWorldUserScript)55 TEST(ContentWorld, NormalWorldUserScript) 55 56 { 56 57 RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]); … … 77 78 } 78 79 79 TEST( UserContentWorld, IsolatedWorld)80 TEST(ContentWorld, IsolatedWorld) 80 81 { 81 82 RetainPtr<_WKUserContentWorld> isolatedWorld = [_WKUserContentWorld worldWithName:@"TestWorld"]; … … 83 84 84 85 RetainPtr<WKUserScript> userScript = adoptNS([[WKUserScript alloc] _initWithSource:@"" injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES legacyWhitelist:@[] legacyBlacklist:@[] userContentWorld:isolatedWorld.get()]); 85 EXPECT_EQ([userScript _userContentWorld], isolatedWorld.get()); 86 EXPECT_NE([userScript _userContentWorld], isolatedWorld.get()); 87 EXPECT_WK_STREQ([userScript _userContentWorld].name, [isolatedWorld name]); 86 88 } 87 89 88 TEST( UserContentWorld, IsolatedWorldUserScript)90 TEST(ContentWorld, IsolatedWorldUserScript) 89 91 { 90 92 RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
Note:
See TracChangeset
for help on using the changeset viewer.