Source/WebKit2: WKContext should ask for its injected bundle initialization user...
authorjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jul 2012 16:35:32 +0000 (16:35 +0000)
committerjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jul 2012 16:35:32 +0000 (16:35 +0000)
commit461ef0817ffbdbbb6eb18d2264373973f4cc6cce
tree6ca7ea3b39c689197f33a1e07af2b275346f44fd
parent18d2055955518cf0ed3fa9ced74f2ada9de3b7ae
Source/WebKit2: WKContext should ask for its injected bundle initialization user data when it needs it so the
client doesn't have to keep it up to date.
https://bugs.webkit.org/show_bug.cgi?id=90627

Reviewed by NOBODY (OOPS!).

Add a getInjectedBundleInitializationUserData callback to WKContextInjectedBundleClient.

* Shared/APIClientTraits.cpp:
Allow the WKContextInjectedBundleClient API to be versioned.
* Shared/APIClientTraits.h:

* UIProcess/API/C/WKContext.h:
Add the callback and bump the version of WKContextInjectedBundleClient.

* UIProcess/WebContext.cpp:
(WebKit::WebContext::ensureWebProcess):
Prefer any user data returned when the callback is invoked over that set with
WKContextSetInitializationUserDataForInjectedBundle.

* UIProcess/WebContextInjectedBundleClient.cpp:
(WebKit::WebContextInjectedBundleClient::getInjectedBundleInitializationUserData):
Invoke the callback if the client has registered for it.
* UIProcess/WebContextInjectedBundleClient.h:

Tools: WKContext should ask for its initialization data when it needs it so the client doesn't have
to keep it up to date.
https://bugs.webkit.org/show_bug.cgi?id=90627

Reviewed by NOBODY (OOPS!).

Add tests and update other WKContextInjectedBundleClients.

* MiniBrowser/mac/AppDelegate.m:
(-[BrowserAppDelegate init]):
Updated for the change to WKContextInjectedBundleClient.
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Ditto.

* TestWebKitAPI/PlatformUtilities.cpp:
(TestWebKitAPI::Util::createInitializationDictionaryForInjectedBundleTest):
Moved the logic to create the initialization dictionary here ...
(TestWebKitAPI::Util::createContextForInjectedBundleTest):
... from here so that it can be used without automatically using
WKContextSetInitializationUserDataForInjectedBundle.
* TestWebKitAPI/PlatformUtilities.h:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
Add the new test files.
* TestWebKitAPI/GNUmakefile.am:
Ditto.

* TestWebKitAPI/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback.cpp: Added.
(TestWebKitAPI::didReceiveMessageFromInjectedBundle):
Check that the message received from the injected bundle matches the user data it was
initialized with.
(TestWebKitAPI::getInjectedBundleInitializationUserData):
Return the user data that the injected bundle should be initialized with.
(TestWebKitAPI::TEST):
Set up WKContextInjectedBundleClient and load a page.
* TestWebKitAPI/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback_Bundle.cpp: Added.
(TestWebKitAPI::GetInjectedBundleInitializationUserDataCallbackTest::initialize):
Send the initialization user data back up to the UI Process.

* TestWebKitAPI/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins.cpp: Added.
(TestWebKitAPI::didReceiveMessageFromInjectedBundle):
Check that the message received from the injected bundle matches the user data it was
initialized with in the callback.
(TestWebKitAPI::getInjectedBundleInitializationUserData):
Return the user data that the injected bundle should be initialized with.
(TestWebKitAPI::TEST):
Set up the context and use WKContextSetInitializationUserDataForInjectedBundle to set the
initialization user data (which should be overridden by the user data returned in
getInjectedBundleInitializationUserData).
* TestWebKitAPI/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp: Added.
(TestWebKitAPI::InjectedBundleInitializationUserDataCallbackWinsTest::initialize):
Send the initialization user data back up to the UI Process.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@121979 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/APIClientTraits.cpp
Source/WebKit2/Shared/APIClientTraits.h
Source/WebKit2/UIProcess/API/C/WKContext.h
Source/WebKit2/UIProcess/WebContext.cpp
Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp
Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h
Tools/ChangeLog
Tools/MiniBrowser/mac/AppDelegate.m
Tools/TestWebKitAPI/GNUmakefile.am
Tools/TestWebKitAPI/PlatformUtilities.cpp
Tools/TestWebKitAPI/PlatformUtilities.h
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback_Bundle.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp [new file with mode: 0644]
Tools/WebKitTestRunner/TestController.cpp