Changeset 128081 in webkit


Ignore:
Timestamp:
Sep 10, 2012 11:11:04 AM (12 years ago)
Author:
jer.noble@apple.com
Message:

<audio> and <video> should send Do Not Track when appropriate
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:
Location:
trunk
Files:
3 added
35 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r128080 r128081  
     12012-09-07  Jer Noble  <jer.noble@apple.com>
     2
     3        <audio> and <video> should send Do Not Track when appropriate
     4        https://bugs.webkit.org/show_bug.cgi?id=96134
     5
     6        Reviewed by Eric Carlson.
     7
     8        Add a new HTTP test ensuring the DNT header is passed correctly during video tests.
     9
     10        * http/tests/media/resources/video-donottrack-check-donottrack.php: Added.
     11        * http/tests/media/video-donottrack-expected.txt: Added.
     12        * http/tests/media/video-donottrack.html: Added.
     13
     14        Skip the new tests on platforms which do not support it:
     15        * platform/chromium/TestExpectations:
     16        * platform/efl/TestExpectations:
     17        * platform/gtk/TestExpectations:
     18        * platform/qt/TestExpectations:
     19        * platform/win/Skipped:
     20
    1212012-08-31  Jon Lee  <jonlee@apple.com>
    222
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r128075 r128081  
    14731473BUGCR8729 WIN : http/tests/multipart/invalid-image-data.html = IMAGE+TEXT
    14741474
     1475BUGWK96287 : http/tests/media/video-donottrack.html = TEXT
     1476
    14751477// -----------------------------------------------------------------
    14761478// MAC PORT TESTS
  • trunk/LayoutTests/platform/efl/TestExpectations

    r128049 r128081  
    166166// The EFL port has no support for accessibility features
    167167BUGWKEFL SKIP : accessibility = TEXT
     168
     169// Missing DNT support for HTMLMediaElement
     170BUGWK96292 : http/tests/media/video-donottrack.html = TEXT
    168171
    169172//////////////////////////////////////////////////////////////////////////////////////////
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r128044 r128081  
    13171317BUGWK96226 : fast/spatial-navigation/snav-imagemap-overlapped-areas.html = TEXT
    13181318
     1319BUGWK96290 : http/tests/media/video-donottrack.html = TEXT
     1320
    13191321//////////////////////////////////////////////////////////////////////////////////////////
    13201322// End of Tests failing
  • trunk/LayoutTests/platform/qt/TestExpectations

    r127935 r128081  
    139139BUGWK94006 : fast/css/word-spacing-characters-complex-text.html = IMAGE
    140140
     141// Added by bug 96134
     142BUGWK96292 : http/tests/media/video-donottrack.html = TEXT
  • trunk/LayoutTests/platform/win/Skipped

    r128041 r128081  
    22192219# Windows does not have global selection.
    22202220editing/pasteboard/paste-global-selection.html
     2221
     2222# https://bugs.webkit.org/show_bug.cgi?id=96293
     2223http/tests/media/video-donottrack.html
  • trunk/Source/WebCore/ChangeLog

    r128080 r128081  
     12012-09-07  Jer Noble  <jer.noble@apple.com>
     2
     3        <audio> and <video> should send Do Not Track when appropriate
     4        https://bugs.webkit.org/show_bug.cgi?id=96134
     5
     6        Reviewed by Eric Carlson.
     7
     8        Add a FrameLoaderClient function to determine whether the DNT header should be sent,
     9        and plumb that new function down into the MediaPlayerPrivateAVFoundationObjC class.
     10
     11        Test: http/tests/media/video-donottrack.html
     12
     13        * html/HTMLMediaElement.cpp:
     14        (WebCore::HTMLMediaElement::mediaPlayerShouldSendDoNotTrackHTTPHeader):
     15            Pass the question on through to the FrameLoaderClient.
     16        * html/HTMLMediaElement.h:
     17        * loader/FrameLoaderClient.h:
     18        (WebCore::FrameLoaderClient::shouldSendDoNotTrackHTTPHeader):
     19            Call through to the implementation in WebKit or WebKit2.
     20        * platform/graphics/MediaPlayer.h:
     21        (WebCore::MediaPlayerClient::mediaPlayerShouldSendDoNotTrackHTTPHeader):
     22            Pass the question on to the HTMLMediaElement.
     23        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
     24        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
     25            If we should send the DNT header, add it to the header options array
     26            when creating the AVAsset.
     27
    1282012-08-31  Jon Lee  <jonlee@apple.com>
    229
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r127949 r128081  
    44884488}
    44894489
     4490bool HTMLMediaElement::mediaPlayerShouldSendDoNotTrackHTTPHeader() const
     4491{
     4492    Frame* frame = document()->frame();
     4493    if (!frame)
     4494        return false;
     4495
     4496    FrameLoaderClient* client = frame->loader()->client();
     4497    if (!client)
     4498        return false;
     4499
     4500    return client->shouldSendDoNotTrackHTTPHeader();
     4501}
     4502
    44904503void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture()
    44914504{
  • trunk/Source/WebCore/html/HTMLMediaElement.h

    r127035 r128081  
    434434    virtual HostWindow* mediaPlayerHostWindow() OVERRIDE;
    435435    virtual IntRect mediaPlayerWindowClipRect() OVERRIDE;
     436    virtual bool mediaPlayerShouldSendDoNotTrackHTTPHeader() const OVERRIDE;
    436437
    437438#if PLATFORM(WIN) && USE(AVFOUNDATION)
  • trunk/Source/WebCore/loader/FrameLoaderClient.h

    r120168 r128081  
    344344        virtual void dispatchDidReconnectDOMWindowExtensionToGlobalObject(DOMWindowExtension*) { }
    345345        virtual void dispatchWillDestroyGlobalObjectForDOMWindowExtension(DOMWindowExtension*) { }
     346
     347        virtual bool shouldSendDoNotTrackHTTPHeader() const { return false; }
    346348    };
    347349
  • trunk/Source/WebCore/platform/graphics/MediaPlayer.h

    r127675 r128081  
    203203    virtual HostWindow* mediaPlayerHostWindow() { return 0; }
    204204    virtual IntRect mediaPlayerWindowClipRect() { return IntRect(); }
     205
     206    virtual bool mediaPlayerShouldSendDoNotTrackHTTPHeader() const { return false; }
    205207};
    206208
     
    419421
    420422    String engineDescription() const;
     423
     424    bool shouldSendDoNotTrackHTTPHeader() const;
    421425
    422426private:
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r125318 r128081  
    297297    if (!userAgent.isEmpty())
    298298        [headerFields.get() setObject:userAgent forKey:@"User-Agent"];
     299
     300    if (player()->mediaPlayerClient()->mediaPlayerShouldSendDoNotTrackHTTPHeader())
     301        [headerFields.get() setObject:@"1" forKey:@"DNT"];
    299302
    300303    if ([headerFields.get() count])
  • trunk/Source/WebKit/mac/ChangeLog

    r127958 r128081  
     12012-09-07  Jer Noble  <jer.noble@apple.com>
     2
     3        <audio> and <video> should send Do Not Track when appropriate
     4        https://bugs.webkit.org/show_bug.cgi?id=96134
     5
     6        Reviewed by Eric Carlson.
     7
     8        Add support for the shouldSendDoNotTrackHTTPHeader by passing the request
     9        on to the WebFrameLoadDelegate.
     10
     11        * WebCoreSupport/WebFrameLoaderClient.h:
     12        * WebCoreSupport/WebFrameLoaderClient.mm:
     13        (WebFrameLoaderClient::shouldSendDoNotTrackHeader):
     14            Pass the question on to the WebFrameLoadDelegate.
     15        * WebView/WebDelegateImplementationCaching.h:
     16        (WebFrameLoadDelegateImplementationCache):
     17            Add an entry for the delegate's webViewShouldSendDoNotTrackHeader method.
     18        * WebView/WebDelegateImplementationCaching.mm:
     19        (CallResourceLoadDelegateReturningBoolean): Added a 0-parameter overloaded function.
     20        * WebView/WebView.mm:
     21        (-[WebView _cacheFrameLoadDelegateImplementations]): initialize the
     22            cached value for shouldSendDoNotTrackHeaderFunc.
     23
    1242012-09-07  Benjamin Poulain  <bpoulain@apple.com>
    225
  • trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h

    r115926 r128081  
    228228    virtual RemoteAXObjectRef accessibilityRemoteObject() OVERRIDE { return 0; }
    229229#endif
     230
     231    virtual bool shouldSendDoNotTrackHTTPHeader() const OVERRIDE;
    230232   
    231233    RetainPtr<WebFramePolicyListener> setUpPolicyListener(WebCore::FramePolicyFunction);
  • trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm

    r127876 r128081  
    19811981#endif
    19821982
     1983bool WebFrameLoaderClient::shouldSendDoNotTrackHTTPHeader() const
     1984{
     1985    WebView *webView = getWebView(m_webFrame.get());
     1986    WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
     1987
     1988    if (implementations->shouldSendDoNotTrackHTTPHeaderFunc)
     1989        return CallResourceLoadDelegateReturningBoolean(YES, implementations->shouldSendDoNotTrackHTTPHeaderFunc, webView, @selector(webViewShouldSendDoNotTrackHTTPHeader:));
     1990    return false;
     1991}
     1992
    19831993@implementation WebFramePolicyListener
    19841994+ (void)initialize
  • trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h

    r99096 r128081  
    7979    IMP didRunInsecureContentFunc;
    8080    IMP didDetectXSSFunc;
     81    IMP shouldSendDoNotTrackHTTPHeaderFunc;
    8182};
    8283
     
    136137id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id, NSInteger, id);
    137138
     139BOOL CallResourceLoadDelegateReturningBoolean(BOOL, IMP, WebView *, SEL);
    138140BOOL CallResourceLoadDelegateReturningBoolean(BOOL, IMP, WebView *, SEL, id);
    139141BOOL CallResourceLoadDelegateReturningBoolean(BOOL, IMP, WebView *, SEL, id, id);
  • trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm

    r127306 r128081  
    501501}
    502502
     503BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector)
     504{
     505    @try {
     506        return reinterpret_cast<BOOL (*)(id, SEL, WebView *)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self);
     507    } @catch(id exception) {
     508        ReportDiscardedDelegateException(selector, exception);
     509    }
     510    return result;
     511}
     512
    503513BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1)
    504514{
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r127639 r128081  
    16301630    cache->didRunInsecureContentFunc = getMethod(delegate, @selector(webView:didRunInsecureContent:));
    16311631    cache->didDetectXSSFunc = getMethod(delegate, @selector(webView:didDetectXSS:));
     1632    cache->shouldSendDoNotTrackHTTPHeaderFunc = getMethod(delegate, @selector(webViewShouldSendDoNotTrackHTTPHeader:));
    16321633}
    16331634
  • trunk/Source/WebKit2/ChangeLog

    r128063 r128081  
     12012-09-07  Jer Noble  <jer.noble@apple.com>
     2
     3        <audio> and <video> should send Do Not Track when appropriate
     4        https://bugs.webkit.org/show_bug.cgi?id=96134
     5
     6        Reviewed by Eric Carlson.
     7
     8        Add support for the shouldSendDoNotTrackHTTPHeader by passing the request
     9        on to the WebFrameLoadDelegate.
     10
     11        * Shared/APIClientTraits.cpp: Increment the interfaceSizes for
     12            WKBundlePageLoaderClient by the value of the new functions.
     13        * Shared/APIClientTraits.h: Ditto.
     14        * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Add a new API to
     15            WKBundlePageLoaderClient and bump the version number.
     16        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
     17        (WebKit::InjectedBundlePageLoaderClient::shouldSendDoNotTrackHTTPHeader):
     18            Pass the question on to the client.
     19        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
     20        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     21        (WebKit::WebFrameLoaderClient::shouldSendDoNotTrackHTTPHeader):
     22            Pass the question on to the bundle.
     23        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
     24        * WebProcess/qt/QtBuiltinBundlePage.cpp:
     25        (WebKit::QtBuiltinBundlePage::QtBuiltinBundlePage):
     26            Add an entry for the new function in the Qt loader client.
     27
    1282012-09-10  Carlos Garcia Campos  <cgarcia@igalia.com>
    229
  • trunk/Source/WebKit2/Shared/APIClientTraits.h

    r126311 r128081  
    4444
    4545template<> struct APIClientTraits<WKBundlePageLoaderClient> {
    46     static const size_t interfaceSizesByVersion[4];
     46    static const size_t interfaceSizesByVersion[5];
    4747};
    4848
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h

    r125670 r128081  
    112112typedef void (*WKBundlePageDidReceiveIntentForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleIntentRequestRef intentRequest, WKTypeRef* userData, const void* clientInfo);
    113113typedef void (*WKBundlePageRegisterIntentServiceForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKIntentServiceInfoRef serviceInfo, WKTypeRef* userData, const void* clientInfo);
     114typedef bool (*WKBundlePageShouldSendDoNotTrackHTTPHeaderCallback)(WKBundlePageRef page, const void* clientInfo);
    114115
    115116struct WKBundlePageLoaderClient {
     
    154155    WKBundlePageDidReceiveIntentForFrameCallback                            didReceiveIntentForFrame;
    155156    WKBundlePageRegisterIntentServiceForFrameCallback                       registerIntentServiceForFrame;
     157
     158    // Version 4
     159    WKBundlePageShouldSendDoNotTrackHTTPHeaderCallback                      shouldSendDoNotTrackHTTPHeader;
    156160};
    157161typedef struct WKBundlePageLoaderClient WKBundlePageLoaderClient;
    158162
    159 enum { kWKBundlePageLoaderClientCurrentVersion = 3 };
     163enum { kWKBundlePageLoaderClientCurrentVersion = 4 };
    160164
    161165enum {
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp

    r123652 r128081  
    336336}
    337337
     338bool InjectedBundlePageLoaderClient::shouldSendDoNotTrackHTTPHeader(WebPage* page)
     339{
     340    if (!m_client.shouldSendDoNotTrackHTTPHeader)
     341        return false;
     342
     343    return m_client.shouldSendDoNotTrackHTTPHeader(toAPI(page), m_client.clientInfo);
     344}
     345
    338346} // namespace WebKit
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h

    r123652 r128081  
    9595
    9696    bool shouldForceUniversalAccessFromLocalURL(WebPage*, const String& url);
     97    bool shouldSendDoNotTrackHTTPHeader(WebPage*);
    9798};
    9899
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r127420 r128081  
    16231623}
    16241624
     1625bool WebFrameLoaderClient::shouldSendDoNotTrackHTTPHeader() const
     1626{
     1627    WebPage* webPage = m_frame->page();
     1628    if (!webPage)
     1629        return false;
     1630
     1631    return webPage->injectedBundleLoaderClient().shouldSendDoNotTrackHTTPHeader(webPage);
     1632}
     1633
    16251634PassRefPtr<FrameNetworkingContext> WebFrameLoaderClient::createNetworkingContext()
    16261635{
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h

    r120301 r128081  
    242242    virtual bool shouldForceUniversalAccessFromLocalURL(const WebCore::KURL&) OVERRIDE;
    243243
     244    virtual bool shouldSendDoNotTrackHTTPHeader() const OVERRIDE;
     245
    244246    virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext() OVERRIDE;
    245247
  • trunk/Source/WebKit2/WebProcess/qt/QtBuiltinBundlePage.cpp

    r123374 r128081  
    7979        0, // didReceiveIntentForFrame
    8080        0, // registerIntentServiceForFrame
     81        0, // shouldSendDoNotTrackHTTPHeader
    8182    };
    8283    WKBundlePageSetPageLoaderClient(m_page, &loaderClient);
  • trunk/Tools/ChangeLog

    r128077 r128081  
     12012-09-07  Jer Noble  <jer.noble@apple.com>
     2
     3        <audio> and <video> should send Do Not Track when appropriate
     4        https://bugs.webkit.org/show_bug.cgi?id=96134
     5
     6        Reviewed by Eric Carlson.
     7
     8        Add a testRunner JS API for calling setShouldSendDoNotTrackHTTPHeader to DRT and
     9        WTR. Add FrameLoaderClient client methods for retrieving that value.
     10
     11        * DumpRenderTree/TestRunner.cpp:
     12        (setShouldSendDoNotTrackHTTPHeaderCallback): Pass through to the TestRunner.
     13        (TestRunner::staticFunctions): Add the setShouldSendDoNotTrackHTTPHeader function.
     14        * DumpRenderTree/TestRunner.h:
     15        (TestRunner::setShouldSendDoNotTrackHTTPHeader): Simple setter.
     16        (TestRunner::shouldSendDoNotTrackHTTPHeader): Simple getter.
     17        * DumpRenderTree/mac/FrameLoadDelegate.mm:
     18        (-[FrameLoadDelegate webViewShouldSendDoNotTrackHTTPHeader:]):
     19            Pass the question on to the TestRunner.
     20        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
     21        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     22        (WTR::InjectedBundlePage::InjectedBundlePage):
     23            Add the setShouldSendDoNotTrackHTTPHeader client function.
     24        (WTR::InjectedBundlePage::shouldSendDoNotTrackHTTPHeader):
     25            Pass the question on to the TestRunner.
     26        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
     27        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     28        * WebKitTestRunner/InjectedBundle/TestRunner.h:
     29        (WTR::TestRunner::shouldSendDoNotTrackHTTPHeader): Simple getter.
     30        (WTR::TestRunner::setShouldSendDoNotTrackHTTPHeader): Simple Setter.
     31
    1322012-09-10  Ojan Vafai  <ojan@chromium.org>
    233
  • trunk/Tools/DumpRenderTree/TestRunner.cpp

    r127577 r128081  
    9494    , m_shouldStayOnPageAfterHandlingBeforeUnload(false)
    9595    , m_areLegacyWebNotificationPermissionRequestsIgnored(false)
    96     , m_customFullScreenBehavior(false) 
     96    , m_customFullScreenBehavior(false)
    9797    , m_hasPendingWebNotificationClick(false)
     98    , m_shouldSendDoNotTrackHTTPHeader(false)
    9899    , m_testPathOrURL(testPathOrURL)
    99100    , m_expectedPixelHash(expectedPixelHash)
     
    713714    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
    714715    controller->notifyDone();
     716    return JSValueMakeUndefined(context);
     717}
     718
     719static JSValueRef setShouldSendDoNotTrackHTTPHeaderCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     720{
     721    if (argumentCount < 1)
     722        return JSValueMakeUndefined(context);
     723
     724    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
     725    controller->setShouldSendDoNotTrackHTTPHeader(JSValueToBoolean(context, arguments[0]));
    715726    return JSValueMakeUndefined(context);
    716727}
     
    23282339        { "removeAllWebNotificationPermissions", removeAllWebNotificationPermissionsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    23292340        { "simulateWebNotificationClick", simulateWebNotificationClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     2341        { "setShouldSendDoNotTrackHTTPHeader", setShouldSendDoNotTrackHTTPHeaderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    23302342        { 0, 0, 0 }
    23312343    };
  • trunk/Tools/DumpRenderTree/TestRunner.h

    r127577 r128081  
    368368    bool hasPendingWebNotificationClick() const { return m_hasPendingWebNotificationClick; }
    369369
     370    void setShouldSendDoNotTrackHTTPHeader(bool value) { m_shouldSendDoNotTrackHTTPHeader = value; }
     371    bool shouldSendDoNotTrackHTTPHeader() const { return m_shouldSendDoNotTrackHTTPHeader; }
     372
    370373private:
    371374    TestRunner(const std::string& testPathOrURL, const std::string& expectedPixelHash);
     
    424427    bool m_customFullScreenBehavior;
    425428    bool m_hasPendingWebNotificationClick;
     429    bool m_shouldSendDoNotTrackHTTPHeader;
    426430
    427431    std::string m_authenticationUsername;
  • trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm

    r125516 r128081  
    431431}
    432432
    433 @end
     433- (BOOL)webViewShouldSendDoNotTrackHTTPHeader:(WebView*)sender
     434{
     435    return gTestRunner->shouldSendDoNotTrackHTTPHeader();
     436}
     437
     438@end
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl

    r127578 r128081  
    166166        void removeAllWebNotificationPermissions();
    167167        void simulateWebNotificationClick(in object notification);
     168
     169        // Do Not Track support
     170        void setShouldSendDoNotTrackHTTPHeader(in boolean flag);
    168171    };
    169172
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r127578 r128081  
    305305        0, // shouldForceUniversalAccessFromLocalURL
    306306        didReceiveIntentForFrame, // didReceiveIntentForFrame
    307         registerIntentServiceForFrame // registerIntentServiceForFrame
     307        registerIntentServiceForFrame, // registerIntentServiceForFrame
     308        shouldSendDoNotTrackHTTPHeader
    308309    };
    309310    WKBundlePageSetPageLoaderClient(m_page, &loaderClient);
     
    622623}
    623624
     625bool InjectedBundlePage::shouldSendDoNotTrackHTTPHeader(WKBundlePageRef page, const void* clientInfo)
     626{
     627    return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldSendDoNotTrackHTTPHeader();
     628}
     629
    624630void InjectedBundlePage::didFinishDocumentLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef*, const void* clientInfo)
    625631{
     
    775781
    776782    InjectedBundle::shared().stringBuilder()->append("postProgressFinishedNotification\n");
     783}
     784
     785bool InjectedBundlePage::shouldSendDoNotTrackHTTPHeader()
     786{
     787    return InjectedBundle::shared().testRunner()->shouldSendDoNotTrackHTTPHeader();
    777788}
    778789
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h

    r127578 r128081  
    8181    static void didReceiveIntentForFrame(WKBundlePageRef, WKBundleFrameRef, WKBundleIntentRequestRef, WKTypeRef*, const void*);
    8282    static void registerIntentServiceForFrame(WKBundlePageRef, WKBundleFrameRef, WKIntentServiceInfoRef, WKTypeRef*, const void*);
     83    static bool shouldSendDoNotTrackHTTPHeader(WKBundlePageRef, const void*);
    8384
    8485    void didStartProvisionalLoadForFrame(WKBundleFrameRef);
     
    169170    void dumpAllFrameScrollPositions();
    170171
     172    bool shouldSendDoNotTrackHTTPHeader();
     173
    171174    WKBundlePageRef m_page;
    172175    WKRetainPtr<WKBundleScriptWorldRef> m_world;
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r127578 r128081  
    9191    , m_userStyleSheetEnabled(false)
    9292    , m_userStyleSheetLocation(adoptWK(WKStringCreateWithUTF8CString("")))
     93    , m_shouldSendDoNotTrackHTTPHeader(false)
    9394{
    9495    platformInitialize();
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

    r127578 r128081  
    236236    void resetPageVisibility();
    237237
     238    bool shouldSendDoNotTrackHTTPHeader() const { return m_shouldSendDoNotTrackHTTPHeader; }
     239    void setShouldSendDoNotTrackHTTPHeader(bool flag) { m_shouldSendDoNotTrackHTTPHeader = flag; }
     240
    238241private:
    239242    static const double waitToDumpWatchdogTimerInterval;
     
    277280
    278281    PlatformTimerRef m_waitToDumpWatchdogTimer;
     282
     283    bool m_shouldSendDoNotTrackHTTPHeader;
    279284};
    280285
Note: See TracChangeset for help on using the changeset viewer.