Diff
Modified: trunk/Source/WebKit2/ChangeLog (121978 => 121979)
--- trunk/Source/WebKit2/ChangeLog 2012-07-06 16:35:21 UTC (rev 121978)
+++ trunk/Source/WebKit2/ChangeLog 2012-07-06 16:35:32 UTC (rev 121979)
@@ -1,5 +1,32 @@
2012-07-06 Jessie Berlin <jber...@apple.com>
+ 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 Anders Carlsson.
+
+ 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:
+
+2012-07-06 Jessie Berlin <jber...@apple.com>
+
WebContext::injectedBundleInitializationUserData() is unused, should be removed
https://bugs.webkit.org/show_bug.cgi?id=90486
Modified: trunk/Source/WebKit2/Shared/APIClientTraits.cpp (121978 => 121979)
--- trunk/Source/WebKit2/Shared/APIClientTraits.cpp 2012-07-06 16:35:21 UTC (rev 121978)
+++ trunk/Source/WebKit2/Shared/APIClientTraits.cpp 2012-07-06 16:35:32 UTC (rev 121979)
@@ -68,4 +68,9 @@
sizeof(WKBundlePageFormClient)
};
+const size_t APIClientTraits<WKContextInjectedBundleClient>::interfaceSizesByVersion[] = {
+ offsetof(WKContextInjectedBundleClient, getInjectedBundleInitializationUserData),
+ sizeof(WKContextInjectedBundleClient)
+};
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/Shared/APIClientTraits.h (121978 => 121979)
--- trunk/Source/WebKit2/Shared/APIClientTraits.h 2012-07-06 16:35:21 UTC (rev 121978)
+++ trunk/Source/WebKit2/Shared/APIClientTraits.h 2012-07-06 16:35:32 UTC (rev 121979)
@@ -27,6 +27,7 @@
#define APIClientTraits_h
#include "WKBundlePage.h"
+#include "WKContext.h"
#include "WKPage.h"
namespace WebKit {
@@ -64,6 +65,10 @@
static const size_t interfaceSizesByVersion[2];
};
+template<> struct APIClientTraits<WKContextInjectedBundleClient> {
+ static const size_t interfaceSizesByVersion[2];
+};
+
} // namespace WebKit
#endif // APIClientTraits_h
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKContext.h (121978 => 121979)
--- trunk/Source/WebKit2/UIProcess/API/C/WKContext.h 2012-07-06 16:35:21 UTC (rev 121978)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContext.h 2012-07-06 16:35:32 UTC (rev 121979)
@@ -42,16 +42,22 @@
// Injected Bundle Client
typedef void (*WKContextDidReceiveMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo);
typedef void (*WKContextDidReceiveSynchronousMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData, const void *clientInfo);
+typedef WKTypeRef (*WKContextGetInjectedBundleInitializationUserDataCallback)(WKContextRef context, const void *clientInfo);
struct WKContextInjectedBundleClient {
int version;
const void * clientInfo;
+
+ // Version 0.
WKContextDidReceiveMessageFromInjectedBundleCallback didReceiveMessageFromInjectedBundle;
WKContextDidReceiveSynchronousMessageFromInjectedBundleCallback didReceiveSynchronousMessageFromInjectedBundle;
+
+ // Version 1.
+ WKContextGetInjectedBundleInitializationUserDataCallback getInjectedBundleInitializationUserData;
};
typedef struct WKContextInjectedBundleClient WKContextInjectedBundleClient;
-enum { kWKContextInjectedBundleClientCurrentVersion = 0 };
+enum { kWKContextInjectedBundleClientCurrentVersion = 1 };
// History Client
typedef void (*WKContextDidNavigateWithNavigationDataCallback)(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo);
Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (121978 => 121979)
--- trunk/Source/WebKit2/UIProcess/WebContext.cpp 2012-07-06 16:35:21 UTC (rev 121978)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp 2012-07-06 16:35:32 UTC (rev 121979)
@@ -306,7 +306,10 @@
// Add any platform specific parameters
platformInitializeWebProcess(parameters);
- m_process->send(Messages::WebProcess::InitializeWebProcess(parameters, WebContextUserMessageEncoder(m_injectedBundleInitializationUserData.get())), 0);
+ RefPtr<APIObject> injectedBundleInitializationUserData = m_injectedBundleClient.getInjectedBundleInitializationUserData(this);
+ if (!injectedBundleInitializationUserData)
+ injectedBundleInitializationUserData = m_injectedBundleInitializationUserData;
+ m_process->send(Messages::WebProcess::InitializeWebProcess(parameters, WebContextUserMessageEncoder(injectedBundleInitializationUserData.get())), 0);
for (size_t i = 0; i != m_pendingMessagesToPostToInjectedBundle.size(); ++i) {
pair<String, RefPtr<APIObject> >& message = m_pendingMessagesToPostToInjectedBundle[i];
Modified: trunk/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp (121978 => 121979)
--- trunk/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp 2012-07-06 16:35:21 UTC (rev 121978)
+++ trunk/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp 2012-07-06 16:35:32 UTC (rev 121979)
@@ -51,4 +51,12 @@
returnData = adoptRef(toImpl(returnDataRef));
}
+PassRefPtr<APIObject> WebContextInjectedBundleClient::getInjectedBundleInitializationUserData(WebContext* context)
+{
+ if (!m_client.getInjectedBundleInitializationUserData)
+ return 0;
+
+ return toImpl(m_client.getInjectedBundleInitializationUserData(toAPI(context), m_client.clientInfo));
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h (121978 => 121979)
--- trunk/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h 2012-07-06 16:35:21 UTC (rev 121978)
+++ trunk/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h 2012-07-06 16:35:32 UTC (rev 121979)
@@ -39,6 +39,7 @@
public:
void didReceiveMessageFromInjectedBundle(WebContext*, const String&, APIObject*);
void didReceiveSynchronousMessageFromInjectedBundle(WebContext*, const String&, APIObject*, RefPtr<APIObject>& returnData);
+ PassRefPtr<APIObject> getInjectedBundleInitializationUserData(WebContext*);
};
} // namespace WebKit
Modified: trunk/Tools/ChangeLog (121978 => 121979)
--- trunk/Tools/ChangeLog 2012-07-06 16:35:21 UTC (rev 121978)
+++ trunk/Tools/ChangeLog 2012-07-06 16:35:32 UTC (rev 121979)
@@ -1,3 +1,59 @@
+2012-07-06 Jessie Berlin <jber...@apple.com>
+
+ 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 Anders Carlsson.
+
+ 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.
+
2012-07-06 Dongwoo Im <dw...@samsung.com>
[EFL][GTK] jhbuild : Disable pixman demos build depending on GTK+
Modified: trunk/Tools/MiniBrowser/mac/AppDelegate.m (121978 => 121979)
--- trunk/Tools/MiniBrowser/mac/AppDelegate.m 2012-07-06 16:35:21 UTC (rev 121978)
+++ trunk/Tools/MiniBrowser/mac/AppDelegate.m 2012-07-06 16:35:32 UTC (rev 121979)
@@ -141,7 +141,8 @@
kWKContextInjectedBundleClientCurrentVersion,
0, /* clientInfo */
didRecieveMessageFromInjectedBundle,
- 0
+ 0, /* didReceiveSynchronousMessageFromInjectedBundle */
+ 0 /* getInjectedBundleInitializationUserData */
};
WKContextSetInjectedBundleClient(_processContext, &bundleClient);
WKContextSetHistoryClient(_processContext, &historyClient);
Modified: trunk/Tools/TestWebKitAPI/GNUmakefile.am (121978 => 121979)
--- trunk/Tools/TestWebKitAPI/GNUmakefile.am 2012-07-06 16:35:21 UTC (rev 121978)
+++ trunk/Tools/TestWebKitAPI/GNUmakefile.am 2012-07-06 16:35:32 UTC (rev 121979)
@@ -125,8 +125,10 @@
Tools/TestWebKitAPI/Tests/WebKit2/ForceRepaint.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/FrameMIMETypeHTML.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/FrameMIMETypePNG.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/HitTestResultNodeHandle.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleBasic.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/LoadAlternateHTMLStringWithNonDirectoryURL.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/LoadCanceledNoServerRedirectCallback.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/MouseMoveAfterCrash.cpp \
@@ -165,8 +167,10 @@
Tools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionBasic_Bundle.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionNoCache_Bundle.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback_Bundle.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/HitTestResultNodeHandle_Bundle.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleBasic_Bundle.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/LoadCanceledNoServerRedirectCallback_Bundle.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/MouseMoveAfterCrash_Bundle.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp \
Modified: trunk/Tools/TestWebKitAPI/PlatformUtilities.cpp (121978 => 121979)
--- trunk/Tools/TestWebKitAPI/PlatformUtilities.cpp 2012-07-06 16:35:21 UTC (rev 121978)
+++ trunk/Tools/TestWebKitAPI/PlatformUtilities.cpp 2012-07-06 16:35:32 UTC (rev 121979)
@@ -40,20 +40,25 @@
return context;
}
-WKContextRef createContextForInjectedBundleTest(const std::string& testName, WKTypeRef userData)
+WKDictionaryRef createInitializationDictionaryForInjectedBundleTest(const std::string& testName, WKTypeRef userData)
{
- WKRetainPtr<WKStringRef> injectedBundlePath(AdoptWK, createInjectedBundlePath());
- WKContextRef context = WKContextCreateWithInjectedBundlePath(injectedBundlePath.get());
+ WKMutableDictionaryRef initializationDictionary = WKMutableDictionaryCreate();
- WKRetainPtr<WKMutableDictionaryRef> initializationDictionary(AdoptWK, WKMutableDictionaryCreate());
-
WKRetainPtr<WKStringRef> testNameKey(AdoptWK, WKStringCreateWithUTF8CString("TestName"));
WKRetainPtr<WKStringRef> testNameString(AdoptWK, WKStringCreateWithUTF8CString(testName.c_str()));
- WKDictionaryAddItem(initializationDictionary.get(), testNameKey.get(), testNameString.get());
+ WKDictionaryAddItem(initializationDictionary, testNameKey.get(), testNameString.get());
WKRetainPtr<WKStringRef> userDataKey(AdoptWK, WKStringCreateWithUTF8CString("UserData"));
- WKDictionaryAddItem(initializationDictionary.get(), userDataKey.get(), userData);
+ WKDictionaryAddItem(initializationDictionary, userDataKey.get(), userData);
+ return initializationDictionary;
+}
+
+WKContextRef createContextForInjectedBundleTest(const std::string& testName, WKTypeRef userData)
+{
+ WKContextRef context = createContextWithInjectedBundle();
+
+ WKRetainPtr<WKDictionaryRef> initializationDictionary(AdoptWK, createInitializationDictionaryForInjectedBundleTest(testName, userData));
WKContextSetInitializationUserDataForInjectedBundle(context, initializationDictionary.get());
return context;
Modified: trunk/Tools/TestWebKitAPI/PlatformUtilities.h (121978 => 121979)
--- trunk/Tools/TestWebKitAPI/PlatformUtilities.h 2012-07-06 16:35:21 UTC (rev 121978)
+++ trunk/Tools/TestWebKitAPI/PlatformUtilities.h 2012-07-06 16:35:32 UTC (rev 121979)
@@ -51,6 +51,7 @@
WKContextRef createContextWithInjectedBundle();
WKContextRef createContextForInjectedBundleTest(const std::string&, WKTypeRef userData = 0);
+WKDictionaryRef createInitializationDictionaryForInjectedBundleTest(const std::string&, WKTypeRef userData);
WKStringRef createInjectedBundlePath();
WKURLRef createURLForResource(const char* resource, const char* extension);
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (121978 => 121979)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2012-07-06 16:35:21 UTC (rev 121978)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2012-07-06 16:35:32 UTC (rev 121979)
@@ -154,6 +154,10 @@
E1220DCA155B28AA0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */; };
E490296814E2E3A4002BEDD1 /* TypingStyleCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */; };
F3FC3EE313678B7300126A65 /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3FC3EE213678B7300126A65 /* libgtest.a */; };
+ F660AA0D15A5F061003A1243 /* GetInjectedBundleInitializationUserDataCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F660AA0C15A5F061003A1243 /* GetInjectedBundleInitializationUserDataCallback.cpp */; };
+ F660AA1115A5F631003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F660AA0F15A5F624003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp */; };
+ F660AA1315A619C9003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F660AA1215A619C8003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp */; };
+ F660AA1515A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F660AA1415A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp */; };
F6F3F29113342FEB00A6BF19 /* CookieManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */; };
F6F49C6915545C8E0007F39D /* DOMWindowExtensionNoCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6F49C6715545C8D0007F39D /* DOMWindowExtensionNoCache.cpp */; };
F6F49C6B15545CA70007F39D /* DOMWindowExtensionNoCache_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6F49C6615545C8D0007F39D /* DOMWindowExtensionNoCache_Bundle.cpp */; };
@@ -385,6 +389,10 @@
E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = MemoryCacheDisableWithinResourceLoadDelegate.html; sourceTree = "<group>"; };
E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TypingStyleCrash.mm; sourceTree = "<group>"; };
F3FC3EE213678B7300126A65 /* libgtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgtest.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ F660AA0C15A5F061003A1243 /* GetInjectedBundleInitializationUserDataCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetInjectedBundleInitializationUserDataCallback.cpp; sourceTree = "<group>"; };
+ F660AA0F15A5F624003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetInjectedBundleInitializationUserDataCallback_Bundle.cpp; sourceTree = "<group>"; };
+ F660AA1215A619C8003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleInitializationUserDataCallbackWins.cpp; sourceTree = "<group>"; };
+ F660AA1415A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp; sourceTree = "<group>"; };
F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CookieManager.cpp; sourceTree = "<group>"; };
F6F49C6615545C8D0007F39D /* DOMWindowExtensionNoCache_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionNoCache_Bundle.cpp; sourceTree = "<group>"; };
F6F49C6715545C8D0007F39D /* DOMWindowExtensionNoCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionNoCache.cpp; sourceTree = "<group>"; };
@@ -543,10 +551,14 @@
1ADBEFAD130C689C00D61D19 /* ForceRepaint.cpp */,
BCBD370F125AA2EB00D2C29F /* FrameMIMETypeHTML.cpp */,
BCBD3760125ABCFE00D2C29F /* FrameMIMETypePNG.cpp */,
+ F660AA0C15A5F061003A1243 /* GetInjectedBundleInitializationUserDataCallback.cpp */,
+ F660AA0F15A5F624003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp */,
4BFDFFA8131477770061F24B /* HitTestResultNodeHandle.cpp */,
4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */,
BC575AAC126E83B9006F0F12 /* InjectedBundleBasic.cpp */,
BC575AAF126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp */,
+ F660AA1215A619C8003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp */,
+ F660AA1415A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp */,
52CB47401448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp */,
33DC8910141953A300747EF7 /* LoadCanceledNoServerRedirectCallback.cpp */,
33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */,
@@ -915,6 +927,8 @@
9B26FC6C159D061000CC3765 /* HTMLFormCollectionNamedItem.mm in Sources */,
9B4F8FA4159D52B1002D9F94 /* HTMLCollectionNamedItem.mm in Sources */,
26DF5A5E15A29BAA003689C2 /* CancelLoadFromResourceLoadDelegate.mm in Sources */,
+ F660AA0D15A5F061003A1243 /* GetInjectedBundleInitializationUserDataCallback.cpp in Sources */,
+ F660AA1315A619C9003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -947,6 +961,8 @@
51393E221523952D005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp in Sources */,
76E182DD1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp in Sources */,
F6F49C6B15545CA70007F39D /* DOMWindowExtensionNoCache_Bundle.cpp in Sources */,
+ F660AA1115A5F631003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp in Sources */,
+ F660AA1515A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback.cpp (0 => 121979)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback.cpp (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback.cpp 2012-07-06 16:35:32 UTC (rev 121979)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+#include <WebKit2/WKRetainPtr.h>
+
+namespace TestWebKitAPI {
+
+static bool done;
+
+static void didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef, WKTypeRef messageBody, const void* clientInfo)
+{
+ EXPECT_WK_STREQ("Extra initialization data", static_cast<WKStringRef>(messageBody));
+ done = true;
+}
+
+static WKTypeRef getInjectedBundleInitializationUserData(WKContextRef context, const void* clientInfo)
+{
+ return Util::createInitializationDictionaryForInjectedBundleTest("GetInjectedBundleInitializationUserDataCallbackTest", Util::toWK("Extra initialization data").get());
+}
+
+TEST(WebKit2, GetInjectedBundleInitializationUserDataCallback)
+{
+ WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextWithInjectedBundle());
+
+ WKContextInjectedBundleClient injectedBundleClient;
+ memset(&injectedBundleClient, 0, sizeof(injectedBundleClient));
+ injectedBundleClient.version = 1;
+ injectedBundleClient.clientInfo = 0;
+ injectedBundleClient.didReceiveMessageFromInjectedBundle = didReceiveMessageFromInjectedBundle;
+ injectedBundleClient.getInjectedBundleInitializationUserData = getInjectedBundleInitializationUserData;
+ WKContextSetInjectedBundleClient(context.get(), &injectedBundleClient);
+
+ PlatformWebView webView(context.get());
+
+ WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("simple", "html"));
+ WKPageLoadURL(webView.page(), url.get());
+
+ Util::run(&done);
+}
+
+} // namespace TestWebKitAPI
Copied: trunk/Tools/TestWebKitAPI/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback_Bundle.cpp (from rev 121978, trunk/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h) (0 => 121979)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback_Bundle.cpp (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback_Bundle.cpp 2012-07-06 16:35:32 UTC (rev 121979)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InjectedBundleTest.h"
+#include "PlatformUtilities.h"
+#include <WebKit2/WKRetainPtr.h>
+
+namespace TestWebKitAPI {
+
+class GetInjectedBundleInitializationUserDataCallbackTest : public InjectedBundleTest {
+public:
+ GetInjectedBundleInitializationUserDataCallbackTest(const std::string& identifier)
+ : InjectedBundleTest(identifier)
+ {
+ }
+
+ virtual void initialize(WKBundleRef bundle, WKTypeRef userData)
+ {
+ WKBundlePostMessage(bundle, Util::toWK("Return the userData").get(), userData);
+ }
+};
+
+static InjectedBundleTest::Register<GetInjectedBundleInitializationUserDataCallbackTest> registrar("GetInjectedBundleInitializationUserDataCallbackTest");
+
+} // namespace TestWebKitAPI
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins.cpp (0 => 121979)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins.cpp (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins.cpp 2012-07-06 16:35:32 UTC (rev 121979)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+#include <WebKit2/WKRetainPtr.h>
+
+namespace TestWebKitAPI {
+
+static bool done;
+
+static void didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef, WKTypeRef messageBody, const void* clientInfo)
+{
+ EXPECT_WK_STREQ("Set in the getInjectedBundleInitializationUserData callback", static_cast<WKStringRef>(messageBody));
+ done = true;
+}
+
+static WKTypeRef getInjectedBundleInitializationUserData(WKContextRef context, const void* clientInfo)
+{
+ return Util::createInitializationDictionaryForInjectedBundleTest("InjectedBundleInitializationUserDataCallbackWinsTest", Util::toWK("Set in the getInjectedBundleInitializationUserData callback").get());
+}
+
+TEST(WebKit2, InjectedBundleInitializationUserDataCallbackWins)
+{
+ WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextWithInjectedBundle());
+ WKRetainPtr<WKDictionaryRef> initializationDictionary(AdoptWK, Util::createInitializationDictionaryForInjectedBundleTest("InjectedBundleInitializationUserDataCallbackWinsTest", Util::toWK("Set with WKContextSetInitializationUserDataForInjectedBundle").get()));
+ WKContextSetInitializationUserDataForInjectedBundle(context.get(), initializationDictionary.get());
+
+ WKContextInjectedBundleClient injectedBundleClient;
+ memset(&injectedBundleClient, 0, sizeof(injectedBundleClient));
+ injectedBundleClient.version = 1;
+ injectedBundleClient.clientInfo = 0;
+ injectedBundleClient.didReceiveMessageFromInjectedBundle = didReceiveMessageFromInjectedBundle;
+ injectedBundleClient.getInjectedBundleInitializationUserData = getInjectedBundleInitializationUserData;
+ WKContextSetInjectedBundleClient(context.get(), &injectedBundleClient);
+
+ PlatformWebView webView(context.get());
+
+ WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("simple", "html"));
+ WKPageLoadURL(webView.page(), url.get());
+
+ Util::run(&done);
+}
+
+} // namespace TestWebKitAPI
Copied: trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp (from rev 121978, trunk/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h) (0 => 121979)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp 2012-07-06 16:35:32 UTC (rev 121979)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InjectedBundleTest.h"
+#include "PlatformUtilities.h"
+#include <WebKit2/WKRetainPtr.h>
+
+namespace TestWebKitAPI {
+
+class InjectedBundleInitializationUserDataCallbackWinsTest : public InjectedBundleTest {
+public:
+ InjectedBundleInitializationUserDataCallbackWinsTest(const std::string& identifier)
+ : InjectedBundleTest(identifier)
+ {
+ }
+
+ virtual void initialize(WKBundleRef bundle, WKTypeRef userData)
+ {
+ WKBundlePostMessage(bundle, Util::toWK("Return the userData").get(), userData);
+ }
+};
+
+static InjectedBundleTest::Register<InjectedBundleInitializationUserDataCallbackWinsTest> registrar("InjectedBundleInitializationUserDataCallbackWinsTest");
+
+} // namespace TestWebKitAPI
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (121978 => 121979)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2012-07-06 16:35:21 UTC (rev 121978)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2012-07-06 16:35:32 UTC (rev 121979)
@@ -319,7 +319,8 @@
kWKContextInjectedBundleClientCurrentVersion,
this,
didReceiveMessageFromInjectedBundle,
- didReceiveSynchronousMessageFromInjectedBundle
+ didReceiveSynchronousMessageFromInjectedBundle,
+ 0 // getInjectedBundleInitializationUserData
};
WKContextSetInjectedBundleClient(m_context.get(), &injectedBundleClient);