Add ability for WK2 to register a scheme as secure.
authorjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Oct 2010 22:37:49 +0000 (22:37 +0000)
committerjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Oct 2010 22:37:49 +0000 (22:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=47557

Reviewed by Jon Honeycutt.

Add the schemes that need to be registered as secure to the WebProcessCreationParameters.
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:

* UIProcess/API/C/WKContext.cpp:
(WKContextRegisterURLSchemeAsSecure):
* UIProcess/API/C/WKContextPrivate.h:

* UIProcess/WebContext.cpp:
(WebKit::WebContext::ensureWebProcess):
Copy over the schemes that are to be registered as secure to the
WebProcessCreationParameters.
(WebKit::WebContext::registerURLSchemeAsSecure):
Only send a message to the WebProcess if it is valid.
* UIProcess/WebContext.h:

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
Register the schemes that need to be registered as secure from the
WebProcessCreationParameters.
(WebKit::WebProcess::registerURLSchemeAsSecure):
* WebProcess/WebProcess.h:

* WebProcess/WebProcess.messages.in:
Add the RegisterURLSchemeAsSecure message.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@69614 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit2/ChangeLog
WebKit2/Shared/WebProcessCreationParameters.cpp
WebKit2/Shared/WebProcessCreationParameters.h
WebKit2/UIProcess/API/C/WKContext.cpp
WebKit2/UIProcess/API/C/WKContextPrivate.h
WebKit2/UIProcess/WebContext.cpp
WebKit2/UIProcess/WebContext.h
WebKit2/WebProcess/WebProcess.cpp
WebKit2/WebProcess/WebProcess.h
WebKit2/WebProcess/WebProcess.messages.in

index bee8c2d..a45c17e 100644 (file)
@@ -1,3 +1,38 @@
+2010-10-12  Jessie Berlin  <jberlin@apple.com>
+
+        Reviewed by Jon Honeycutt.
+
+        Add ability for WK2 to register a scheme as secure.
+        https://bugs.webkit.org/show_bug.cgi?id=47557
+
+        Add the schemes that need to be registered as secure to the WebProcessCreationParameters.
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+
+        * UIProcess/API/C/WKContext.cpp:
+        (WKContextRegisterURLSchemeAsSecure):
+        * UIProcess/API/C/WKContextPrivate.h:
+
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::ensureWebProcess):
+        Copy over the schemes that are to be registered as secure to the
+        WebProcessCreationParameters.
+        (WebKit::WebContext::registerURLSchemeAsSecure):
+        Only send a message to the WebProcess if it is valid.
+        * UIProcess/WebContext.h:
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess):
+        Register the schemes that need to be registered as secure from the
+        WebProcessCreationParameters.
+        (WebKit::WebProcess::registerURLSchemeAsSecure):
+        * WebProcess/WebProcess.h:
+
+        * WebProcess/WebProcess.messages.in:
+        Add the RegisterURLSchemeAsSecure message.
+
 2010-10-12  John Sullivan  <sullivan@apple.com>
 
         Reviewed by Anders Carlsson.
index 3e5a746..57f1b2b 100644 (file)
@@ -46,6 +46,7 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con
 
     encoder->encode(applicationCacheDirectory);
     encoder->encode(urlSchemesRegistererdAsEmptyDocument);
+    encoder->encode(urlSchemesRegisteredAsSecure);
     encoder->encode(static_cast<uint32_t>(cacheModel));
     encoder->encode(shouldTrackVisitedLinks);
 
@@ -69,6 +70,8 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web
         return false;
     if (!decoder->decode(parameters.urlSchemesRegistererdAsEmptyDocument))
         return false;
+    if (!decoder->decode(parameters.urlSchemesRegisteredAsSecure))
+        return false;
 
     uint32_t cacheModel;
     if (!decoder->decode(cacheModel))
index 93e3131..a4aba7f 100644 (file)
@@ -54,6 +54,7 @@ struct WebProcessCreationParameters {
 
     String applicationCacheDirectory;
     Vector<String> urlSchemesRegistererdAsEmptyDocument;
+    Vector<String> urlSchemesRegisteredAsSecure;
 
     CacheModel cacheModel;
     bool shouldTrackVisitedLinks;
index b40c65e..b820946 100644 (file)
@@ -120,3 +120,8 @@ void _WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef contextRef, WKStrin
 {
     toImpl(contextRef)->registerURLSchemeAsEmptyDocument(toImpl(urlScheme)->string());
 }
+
+void WKContextRegisterURLSchemeAsSecure(WKContextRef contextRef, WKStringRef urlScheme)
+{
+    toImpl(contextRef)->registerURLSchemeAsSecure(toImpl(urlScheme)->string());
+}
index 5430cfa..80024f1 100644 (file)
@@ -48,6 +48,8 @@ WK_EXPORT void _WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKS
 
 WK_EXPORT void _WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef context, WKStringRef urlScheme);
 
+WK_EXPORT void WKContextRegisterURLSchemeAsSecure(WKContextRef context, WKStringRef urlScheme);
+
 #ifdef __cplusplus
 }
 #endif
index 49863e2..9c28232 100644 (file)
@@ -152,6 +152,7 @@ void WebContext::ensureWebProcess()
     parameters.cacheModel = m_cacheModel;
     
     copyToVector(m_schemesToRegisterAsEmptyDocument, parameters.urlSchemesRegistererdAsEmptyDocument);
+    copyToVector(m_schemesToRegisterAsSecure, parameters.urlSchemesRegisteredAsSecure);
 
     // Add any platform specific parameters
     platformInitializeWebProcess(parameters);
@@ -310,6 +311,16 @@ void WebContext::registerURLSchemeAsEmptyDocument(const String& urlScheme)
     m_process->send(Messages::WebProcess::RegisterURLSchemeAsEmptyDocument(urlScheme), 0);
 }
 
+void WebContext::registerURLSchemeAsSecure(const String& urlScheme)
+{
+    m_schemesToRegisterAsSecure.add(urlScheme);
+
+    if (!hasValidProcess())
+        return;
+
+    m_process->send(Messages::WebProcess::RegisterURLSchemeAsSecure(urlScheme), 0);
+}
+
 void WebContext::addVisitedLink(const String& visitedURL)
 {
     if (visitedURL.isEmpty())
index 435825e..0364faf 100644 (file)
@@ -102,6 +102,7 @@ public:
     String applicationCacheDirectory();
     
     void registerURLSchemeAsEmptyDocument(const String&);
+    void registerURLSchemeAsSecure(const String&);
     
     void addVisitedLink(const String&);
     void addVisitedLink(WebCore::LinkHash);
@@ -142,6 +143,7 @@ private:
     VisitedLinkProvider m_visitedLinkProvider;
         
     HashSet<String> m_schemesToRegisterAsEmptyDocument;
+    HashSet<String> m_schemesToRegisterAsSecure;
     Vector<pair<String, RefPtr<APIObject> > > m_pendingMessagesToPostToInjectedBundle;
 
     CacheModel m_cacheModel;
index 905528b..ed9e5cb 100644 (file)
@@ -132,9 +132,13 @@ void WebProcess::initializeWebProcess(const WebProcessCreationParameters& parame
 
     setShouldTrackVisitedLinks(parameters.shouldTrackVisitedLinks);
     setCacheModel(static_cast<uint32_t>(parameters.cacheModel));
+
     for (size_t i = 0; i < parameters.urlSchemesRegistererdAsEmptyDocument.size(); ++i)
         registerURLSchemeAsEmptyDocument(parameters.urlSchemesRegistererdAsEmptyDocument[i]);
 
+    for (size_t i = 0; i < parameters.urlSchemesRegisteredAsSecure.size(); ++i)
+        registerURLSchemeAsSecure(parameters.urlSchemesRegisteredAsSecure[i]);
+
 #if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC)
     m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port();
 #endif
@@ -153,6 +157,11 @@ void WebProcess::registerURLSchemeAsEmptyDocument(const String& urlScheme)
     SchemeRegistry::registerURLSchemeAsEmptyDocument(urlScheme);
 }
 
+void WebProcess::registerURLSchemeAsSecure(const String& urlScheme) const
+{
+    SchemeRegistry::registerURLSchemeAsSecure(urlScheme);
+}
+
 void WebProcess::setVisitedLinkTable(const SharedMemory::Handle& handle)
 {
     RefPtr<SharedMemory> sharedMemory = SharedMemory::create(handle, SharedMemory::ReadOnly);
index dbf363b..26ff1df 100644 (file)
@@ -90,6 +90,7 @@ private:
     void initializeWebProcess(const WebProcessCreationParameters&);
     void setShouldTrackVisitedLinks(bool);
     void registerURLSchemeAsEmptyDocument(const String&);
+    void registerURLSchemeAsSecure(const String&) const;
 #if PLATFORM(WIN)
     void setShouldPaintNativeControls(bool);
 #endif
index d030513..291e11c 100644 (file)
@@ -36,6 +36,7 @@ messages -> WebProcess {
     SetShouldTrackVisitedLinks(bool shouldTrackVisitedLinks)
     SetCacheModel(uint32_t cacheModel)
     RegisterURLSchemeAsEmptyDocument(WTF::String scheme)
+    RegisterURLSchemeAsSecure(WTF::String scheme)
 #if PLATFORM(WIN)
     SetShouldPaintNativeControls(bool shouldPaintNativeControls)
 #endif