Changeset 269129 in webkit


Ignore:
Timestamp:
Oct 28, 2020 5:00:17 PM (21 months ago)
Author:
wilander@apple.com
Message:

PCM: Accept ad click data when the link opens a new window
https://bugs.webkit.org/show_bug.cgi?id=214176
<rdar://problem/65358005>

Reviewed by Brent Fulgham.

A link with the attribute target="_blank" takes another code path for
navigation which involves the creation of a new window and webpage. That
code path needs to transfer ad click attribution data to the new webpage
Source/WebKit:

where it can be picked up in WebPageProxy::didCommitLoadForFrame().
The ad click attribution data sits in the NavigationAction which is not
available in the completion handler WebPageProxy::createNewPage().
The client, which differs between TestRunner and e.g. Safari, consumes
the NavigationAction. I don't want to risk a regression in e.g. Safari
while still passing the test because TestRunner hasn't regressed.

Test: http/tests/adClickAttribution/attribution-conversion-through-image-redirect-in-new-window.html

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::didCommitLoadForFrame):

Now also checks for pending ad click attribution data in its new
member variable m_newPageNavigationAdClickAttribution.

(WebKit::WebPageProxy::createNewPage):

Now forwards optional ad click attribution data to the completion
handler where it can be stored on the newly created webpage in the
new member variable m_newPageNavigationAdClickAttribution.

  • UIProcess/WebPageProxy.h:

Added m_newPageNavigationAdClickAttribution.

  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit::WebChromeClient::createWindow):

Added missing navigationAction.adClickAttribution() copy.

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):

Added missing navigationAction.adClickAttribution() copy.

LayoutTests:

where it can be picked up.

  • http/tests/adClickAttribution/attribution-conversion-through-image-redirect-in-new-window-expected.txt: Added.
  • http/tests/adClickAttribution/attribution-conversion-through-image-redirect-in-new-window.html: Added.
  • http/tests/adClickAttribution/resources/convertAndPostMessageBack.html: Added.
Location:
trunk
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r269126 r269129  
     12020-10-28  John Wilander  <wilander@apple.com>
     2
     3        PCM: Accept ad click data when the link opens a new window
     4        https://bugs.webkit.org/show_bug.cgi?id=214176
     5        <rdar://problem/65358005>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        A link with the attribute target="_blank" takes another code path for
     10        navigation which involves the creation of a new window and webpage. That
     11        code path needs to transfer ad click attribution data to the new webpage
     12        where it can be picked up.
     13
     14        * http/tests/adClickAttribution/attribution-conversion-through-image-redirect-in-new-window-expected.txt: Added.
     15        * http/tests/adClickAttribution/attribution-conversion-through-image-redirect-in-new-window.html: Added.
     16        * http/tests/adClickAttribution/resources/convertAndPostMessageBack.html: Added.
     17
    1182020-10-28  Truitt Savell  <tsavell@apple.com>
    219
  • trunk/Source/WebKit/ChangeLog

    r269123 r269129  
     12020-10-28  John Wilander  <wilander@apple.com>
     2
     3        PCM: Accept ad click data when the link opens a new window
     4        https://bugs.webkit.org/show_bug.cgi?id=214176
     5        <rdar://problem/65358005>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        A link with the attribute target="_blank" takes another code path for
     10        navigation which involves the creation of a new window and webpage. That
     11        code path needs to transfer ad click attribution data to the new webpage
     12        where it can be picked up in WebPageProxy::didCommitLoadForFrame().
     13        The ad click attribution data sits in the NavigationAction which is not
     14        available in the completion handler WebPageProxy::createNewPage().
     15        The client, which differs between TestRunner and e.g. Safari, consumes
     16        the NavigationAction. I don't want to risk a regression in e.g. Safari
     17        while still passing the test because TestRunner hasn't regressed.
     18
     19        Test: http/tests/adClickAttribution/attribution-conversion-through-image-redirect-in-new-window.html
     20
     21        * UIProcess/WebPageProxy.cpp:
     22        (WebKit::WebPageProxy::didCommitLoadForFrame):
     23            Now also checks for pending ad click attribution data in its new
     24            member variable m_newPageNavigationAdClickAttribution.
     25        (WebKit::WebPageProxy::createNewPage):
     26            Now forwards optional ad click attribution data to the completion
     27            handler where it can be stored on the newly created webpage in the
     28            new member variable m_newPageNavigationAdClickAttribution.
     29        * UIProcess/WebPageProxy.h:
     30            Added m_newPageNavigationAdClickAttribution.
     31        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     32        (WebKit::WebChromeClient::createWindow):
     33            Added missing navigationAction.adClickAttribution() copy.
     34        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     35        (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
     36            Added missing navigationAction.adClickAttribution() copy.
     37
    1382020-10-28  Said Abou-Hallawa  <said@apple.com>
    239
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r269027 r269129  
    46524652    frame->didCommitLoad(mimeType, webCertificateInfo, containsPluginDocument);
    46534653
    4654     if (navigation && frame->isMainFrame()) {
    4655         if (auto& adClickAttribution = navigation->adClickAttribution()) {
     4654    if (frame->isMainFrame()) {
     4655        Optional<WebCore::AdClickAttribution> adClickAttribution;
     4656        if (m_newPageNavigationAdClickAttribution)
     4657            adClickAttribution = m_newPageNavigationAdClickAttribution;
     4658        else if (navigation && navigation->adClickAttribution())
     4659            adClickAttribution = navigation->adClickAttribution();
     4660        if (adClickAttribution) {
    46564661            if (adClickAttribution->destination().matches(frame->url()))
    46574662                websiteDataStore().networkProcess().send(Messages::NetworkProcess::StoreAdClickAttribution(m_websiteDataStore->sessionID(), *adClickAttribution), 0);
    46584663        }
    46594664    }
     4665    m_newPageNavigationAdClickAttribution.reset();
    46604666
    46614667    if (frame->isMainFrame()) {
     
    55195525    auto originatingFrameInfo = API::FrameInfo::create(WTFMove(originatingFrameInfoData), originatingPage);
    55205526    auto mainFrameURL = m_mainFrame ? m_mainFrame->url() : URL();
    5521     auto completionHandler = [this, protectedThis = makeRef(*this), mainFrameURL, request, reply = WTFMove(reply)] (RefPtr<WebPageProxy> newPage) mutable {
     5527    auto completionHandler = [this, protectedThis = makeRef(*this), mainFrameURL, request, reply = WTFMove(reply), adClickAttribution = navigationActionData.adClickAttribution] (RefPtr<WebPageProxy> newPage) mutable {
    55225528        if (!newPage) {
    55235529            reply(WTF::nullopt, WTF::nullopt);
     
    55315537        newPage->m_shouldSuppressAppLinksInNextNavigationPolicyDecision = mainFrameURL.host() == request.url().host();
    55325538
     5539        newPage->m_newPageNavigationAdClickAttribution = adClickAttribution;
    55335540#if HAVE(APP_SSO)
    55345541        newPage->m_shouldSuppressSOAuthorizationInNextNavigationPolicyDecision = true;
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r269027 r269129  
    28862886
    28872887    size_t m_suspendMediaPlaybackCounter { 0 };
     2888
     2889    Optional<WebCore::AdClickAttribution> m_newPageNavigationAdClickAttribution;
    28882890};
    28892891
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r269084 r269129  
    268268    navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
    269269    navigationActionData.downloadAttribute = navigationAction.downloadAttribute();
     270    navigationActionData.adClickAttribution = navigationAction.adClickAttribution();
    270271
    271272    WebFrame* webFrame = WebFrame::fromCoreFrame(frame);
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r268239 r269129  
    880880    navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
    881881    navigationActionData.downloadAttribute = navigationAction.downloadAttribute();
     882    navigationActionData.adClickAttribution = navigationAction.adClickAttribution();
    882883
    883884    webPage->send(Messages::WebPageProxy::DecidePolicyForNewWindowAction(m_frame->frameID(), m_frame->info(), identifier, navigationActionData, request,
Note: See TracChangeset for help on using the changeset viewer.