Skip to content
  • jer.noble@apple.com's avatar
    <audio> and <video> should send Do Not Track when appropriate · 2d55c01b
    jer.noble@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=96134
    
    Reviewed by Eric Carlson.
    
    Source/WebCore:
    
    Add a FrameLoaderClient function to determine whether the DNT header should be sent,
    and plumb that new function down into the MediaPlayerPrivateAVFoundationObjC class.
    
    Test: http/tests/media/video-donottrack.html
    
    * html/HTMLMediaElement.cpp:
    (WebCore::HTMLMediaElement::mediaPlayerShouldSendDoNotTrackHTTPHeader):
        Pass the question on through to the FrameLoaderClient.
    * html/HTMLMediaElement.h:
    * loader/FrameLoaderClient.h:
    (WebCore::FrameLoaderClient::shouldSendDoNotTrackHTTPHeader):
        Call through to the implementation in WebKit or WebKit2.
    * platform/graphics/MediaPlayer.h:
    (WebCore::MediaPlayerClient::mediaPlayerShouldSendDoNotTrackHTTPHeader):
        Pass the question on to the HTMLMediaElement.
    * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
    (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
        If we should send the DNT header, add it to the header options array
        when creating the AVAsset.
    
    Source/WebKit/mac:
    
    Add support for the shouldSendDoNotTrackHTTPHeader by passing the request
    on to the WebFrameLoadDelegate.
    
    * WebCoreSupport/WebFrameLoaderClient.h:
    * WebCoreSupport/WebFrameLoaderClient.mm:
    (WebFrameLoaderClient::shouldSendDoNotTrackHeader):
        Pass the question on to the WebFrameLoadDelegate.
    * WebView/WebDelegateImplementationCaching.h:
    (WebFrameLoadDelegateImplementationCache):
        Add an entry for the delegate's webViewShouldSendDoNotTrackHeader method.
    * WebView/WebDelegateImplementationCaching.mm:
    (CallResourceLoadDelegateReturningBoolean): Added a 0-parameter overloaded function.
    * WebView/WebView.mm:
    (-[WebView _cacheFrameLoadDelegateImplementations]): initialize the
        cached value for shouldSendDoNotTrackHeaderFunc.
    
    Source/WebKit2:
    
    Add support for the shouldSendDoNotTrackHTTPHeader by passing the request
    on to the WebFrameLoadDelegate.
    
    * Shared/APIClientTraits.cpp: Increment the interfaceSizes for
        WKBundlePageLoaderClient by the value of the new functions.
    * Shared/APIClientTraits.h: Ditto.
    * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Add a new API to
        WKBundlePageLoaderClient and bump the version number.
    * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
    (WebKit::InjectedBundlePageLoaderClient::shouldSendDoNotTrackHTTPHeader):
        Pass the question on to the client.
    * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
    * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
    (WebKit::WebFrameLoaderClient::shouldSendDoNotTrackHTTPHeader):
        Pass the question on to the bundle.
    * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
    * WebProcess/qt/QtBuiltinBundlePage.cpp:
    (WebKit::QtBuiltinBundlePage::QtBuiltinBundlePage):
        Add an entry for the new function in the Qt loader client.
    
    Tools:
    
    Add a testRunner JS API for calling setShouldSendDoNotTrackHTTPHeader to DRT and
    WTR. Add FrameLoaderClient client methods for retrieving that value.
    
    * DumpRenderTree/TestRunner.cpp:
    (setShouldSendDoNotTrackHTTPHeaderCallback): Pass through to the TestRunner.
    (TestRunner::staticFunctions): Add the setShouldSendDoNotTrackHTTPHeader function.
    * DumpRenderTree/TestRunner.h:
    (TestRunner::setShouldSendDoNotTrackHTTPHeader): Simple setter.
    (TestRunner::shouldSendDoNotTrackHTTPHeader): Simple getter.
    * DumpRenderTree/mac/FrameLoadDelegate.mm:
    (-[FrameLoadDelegate webViewShouldSendDoNotTrackHTTPHeader:]):
        Pass the question on to the TestRunner.
    * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
    * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
    (WTR::InjectedBundlePage::InjectedBundlePage):
        Add the setShouldSendDoNotTrackHTTPHeader client function.
    (WTR::InjectedBundlePage::shouldSendDoNotTrackHTTPHeader):
        Pass the question on to the TestRunner.
    * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
    * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
    * WebKitTestRunner/InjectedBundle/TestRunner.h:
    (WTR::TestRunner::shouldSendDoNotTrackHTTPHeader): Simple getter.
    (WTR::TestRunner::setShouldSendDoNotTrackHTTPHeader): Simple Setter.
    
    LayoutTests:
    
    Add a new HTTP test ensuring the DNT header is passed correctly during video tests.
    
    * http/tests/media/resources/video-donottrack-check-donottrack.php: Added.
    * http/tests/media/video-donottrack-expected.txt: Added.
    * http/tests/media/video-donottrack.html: Added.
    
    Skip the new tests on platforms which do not support it:
    * platform/chromium/TestExpectations:
    * platform/efl/TestExpectations:
    * platform/gtk/TestExpectations:
    * platform/qt/TestExpectations:
    * platform/win/Skipped:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@128081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    2d55c01b