WWDC session videos don’t play at developer.apple.com
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Apr 2013 23:20:44 +0000 (23:20 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Apr 2013 23:20:44 +0000 (23:20 +0000)
commit00d8acbabee27520cfa74826aee14f3630c918e7
treef77d1851fd7f112f17dd2f0de8ac648230300f9d
parentff05f68a5cdeb60af71d125dccfa3c7964e9efff
WWDC session videos don’t play at developer.apple.com
https://bugs.webkit.org/show_bug.cgi?id=114858

Reviewed by Eric Carlson. Rubber stamped by Brady Eidson.

AVFoundation uses CFNetwork to store and retrieve cookies from the global store.
However, in the case where network access happens in the NetworkProcess, session
cookies are stored in-memory, and are not accessable in the WebProcess. Until such
a time as AVFoundation can provide an API which would allow us to provide cookies
for a specific request, we will interpose the CFNetwork method which they use to
retrieve the cookie string from the cookie store for their pending request.

Duplicate the previous SecItemShim target to a new, WebProcessShim target. This
target includes the SecItemShim functionality, but will add a new shim for cookie
retrieval:
* Shared/mac/CookieStorageShimLibrary.h: Added
(CookieStorageShimCallbacks):
* Shared/mac/CookieStorageShimLibrary.cpp: Added.
(WebKit::ShimProtector::ShimProtector): A simple stack-based counter class.
(WebKit::ShimProtector::~ShimProtector):
(WebKit::ShimProtector::count):
(WebKit::shimCFHTTPCookieStorageCopyRequestHeaderFieldsForURL): Interpose
    the CFNetwork call, and pass to the registered callback.
(WebKit::WebKitCookieStorageShimInitialize): Register the callbacks.

Add a helper singleton class which will talk to the shim through the
registered callbacks:
* Shared/mac/CookieStorageShim.h: Added
(WebKit::CookieStorageShim::CookieStorageShim):
* Shared/mac/CookieStorageShim.cpp: Added.
(WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL): Pass the request
    over to the NetworkProcess.
(WebKit::CookieStorageShim::shared): Simple singleton.
(WebKit::CookieStorageShim::initialize): Call the library initializer.

Initialize the shim only when the WebProcess is delegating network loading
to the NetworkProcess:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):

Rename the WebProcess's shim from SecItemShim -> WebProcessShim:
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::addDYLDEnvironmentAdditions):
* WebProcess/EntryPoint/mac/LegacyProcess/WebContentProcessMain.mm:
(WebKit::WebContentProcessMainDelegate::doPreInitializationWork):
* WebProcess/EntryPoint/mac/XPCService/WebContentService/Info.plist:
* WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm:
(WebContentServiceInitializer):

As the DYLD_INTERPOSE macro is used in multiple files now, put it in its
own header:
* Shared/mac/DyldInterpose.h: Added.
* PluginProcess/mac/PluginProcessShim.mm:
* WebProcess/mac/SecItemShimLibrary.mm:

Add new files to the project:
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@149074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/PluginProcess/mac/PluginProcessShim.mm
Source/WebKit2/Shared/mac/CookieStorageShim.cpp [new file with mode: 0644]
Source/WebKit2/Shared/mac/CookieStorageShim.h [new file with mode: 0644]
Source/WebKit2/Shared/mac/CookieStorageShimLibrary.cpp [new file with mode: 0644]
Source/WebKit2/Shared/mac/CookieStorageShimLibrary.h [new file with mode: 0644]
Source/WebKit2/Shared/mac/DyldInterpose.h [new file with mode: 0644]
Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/EntryPoint/mac/LegacyProcess/WebContentProcessMain.mm
Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService/Info.plist
Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/mac/SecItemShimLibrary.mm