Changeset 241049 in webkit
- Timestamp:
- Feb 6, 2019 2:02:15 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r241048 r241049 1 2019-02-06 John Wilander <wilander@apple.com> 2 3 Forward Ad Click Attribution data from HTMLAnchorElement::handleClick() to WebKit::NavigationActionData 4 https://bugs.webkit.org/show_bug.cgi?id=194325 5 <rdar://problem/47840283> 6 7 Reviewed by Chris Dumez. 8 9 No new tests. This is just data forwarding. Once the data is stored, I will create 10 test infrastructure to query it. 11 12 * html/HTMLAnchorElement.cpp: 13 (WebCore::HTMLAnchorElement::handleClick): 14 * loader/AdClickAttribution.h: 15 (WebCore::AdClickAttribution::encode const): 16 (WebCore::AdClickAttribution::decode): 17 (WebCore::AdClickAttribution::Conversion::encode const): 18 (WebCore::AdClickAttribution::Conversion::decode): 19 Infrastructure for IPC. 20 * loader/FrameLoader.cpp: 21 (WebCore::FrameLoader::urlSelected): 22 (WebCore::FrameLoader::loadURLIntoChildFrame): 23 (WebCore::FrameLoader::loadFrameRequest): 24 (WebCore::FrameLoader::loadURL): 25 These functions forward the optional WebCore::AdClickAttribution object 26 FrameLoader::loadURL() creates the NavigationAction object and sets the 27 WebCore::AdClickAttribution object on there. 28 * loader/FrameLoader.h: 29 (WebCore::FrameLoader::urlSelected): 30 (WebCore::FrameLoader::loadURL): 31 * loader/NavigationAction.h: 32 (WebCore::NavigationAction::adClickAttribution): 33 (WebCore::NavigationAction::setAdClickAttribution): 34 1 35 2019-02-06 Justin Fan <justin_fan@apple.com> 2 36 -
trunk/Source/WebCore/html/HTMLAnchorElement.cpp
r240911 r241049 489 489 490 490 auto adClickAttribution = parseAdClickAttribution(); 491 // FIXME: The adClickAttribution should be forwarded to the loader and handled down the pipe. See492 // rdar://problem/47650118493 491 // A matching conversion event needs to happen before the complete ad click attributionURL can be 494 492 // created. Thus, it should be empty for now. 495 ASSERT _UNUSED(adClickAttribution,!adClickAttribution || adClickAttribution->url().isNull());496 497 frame->loader().urlSelected(completedURL, effectiveTarget, &event, LockHistory::No, LockBackForwardList::No, shouldSendReferrer, document().shouldOpenExternalURLsPolicyToPropagate(), newFrameOpenerPolicy, downloadAttribute, systemPreviewInfo );493 ASSERT(!adClickAttribution || adClickAttribution->url().isNull()); 494 495 frame->loader().urlSelected(completedURL, effectiveTarget, &event, LockHistory::No, LockBackForwardList::No, shouldSendReferrer, document().shouldOpenExternalURLsPolicyToPropagate(), newFrameOpenerPolicy, downloadAttribute, systemPreviewInfo, WTFMove(adClickAttribution)); 498 496 499 497 sendPings(completedURL); -
trunk/Source/WebCore/loader/AdClickAttribution.h
r240911 r241049 109 109 ConversionData data; 110 110 PriorityValue priority; 111 112 template<class Encoder> void encode(Encoder&) const; 113 template<class Decoder> static Optional<Conversion> decode(Decoder&); 111 114 }; 112 115 … … 124 127 Optional<WallTime> earliestTimeToSend() const { return m_earliestTimeToSend; }; 125 128 129 template<class Encoder> void encode(Encoder&) const; 130 template<class Decoder> static Optional<AdClickAttribution> decode(Decoder&); 131 126 132 private: 127 133 bool isValid() const; … … 135 141 Optional<WallTime> m_earliestTimeToSend; 136 142 }; 137 143 144 template<class Encoder> 145 void AdClickAttribution::encode(Encoder& encoder) const 146 { 147 encoder << m_campaign.id << m_source.registrableDomain << m_destination.registrableDomain << m_timeOfAdClick << m_conversion << m_earliestTimeToSend; 148 } 149 150 template<class Decoder> 151 Optional<AdClickAttribution> AdClickAttribution::decode(Decoder& decoder) 152 { 153 Optional<CampaignId> campaignId; 154 decoder >> campaignId; 155 if (!campaignId) 156 return WTF::nullopt; 157 158 Optional<String> sourceRegistrableDomain; 159 decoder >> sourceRegistrableDomain; 160 if (!sourceRegistrableDomain) 161 return WTF::nullopt; 162 163 Optional<String> destinationRegistrableDomain; 164 decoder >> destinationRegistrableDomain; 165 if (!destinationRegistrableDomain) 166 return WTF::nullopt; 167 168 Optional<WallTime> timeOfAdClick; 169 decoder >> timeOfAdClick; 170 if (!timeOfAdClick) 171 return WTF::nullopt; 172 173 Optional<Optional<Conversion>> conversion; 174 decoder >> conversion; 175 if (!conversion) 176 return WTF::nullopt; 177 178 Optional<Optional<WallTime>> earliestTimeToSend; 179 decoder >> earliestTimeToSend; 180 if (!earliestTimeToSend) 181 return WTF::nullopt; 182 183 AdClickAttribution attribution { Campaign { WTFMove(*campaignId) }, Source { WTFMove(*sourceRegistrableDomain) }, Destination { WTFMove(*destinationRegistrableDomain) } }; 184 attribution.m_conversion = WTFMove(*conversion); 185 attribution.m_earliestTimeToSend = WTFMove(*earliestTimeToSend); 186 187 return attribution; 188 } 189 190 template<class Encoder> 191 void AdClickAttribution::Conversion::encode(Encoder& encoder) const 192 { 193 encoder << data << priority; 194 } 195 196 template<class Decoder> 197 Optional<AdClickAttribution::Conversion> AdClickAttribution::Conversion::decode(Decoder& decoder) 198 { 199 Optional<ConversionData> data; 200 decoder >> data; 201 if (!data) 202 return WTF::nullopt; 203 204 Optional<PriorityValue> priority; 205 decoder >> priority; 206 if (!priority) 207 return WTF::nullopt; 208 209 return Conversion { WTFMove(*data), Priority { WTFMove(*priority) } }; 210 } 211 138 212 } // namespace WebCore -
trunk/Source/WebCore/loader/FrameLoader.cpp
r241015 r241049 381 381 } 382 382 383 void FrameLoader::urlSelected(const URL& url, const String& passedTarget, Event* triggeringEvent, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, Optional<NewFrameOpenerPolicy> openerPolicy, const AtomicString& downloadAttribute, const SystemPreviewInfo& systemPreviewInfo )383 void FrameLoader::urlSelected(const URL& url, const String& passedTarget, Event* triggeringEvent, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, Optional<NewFrameOpenerPolicy> openerPolicy, const AtomicString& downloadAttribute, const SystemPreviewInfo& systemPreviewInfo, Optional<AdClickAttribution>&& adClickAttribution) 384 384 { 385 385 auto* frame = lexicalFrameFromCommonVM(); … … 387 387 388 388 NewFrameOpenerPolicy newFrameOpenerPolicy = openerPolicy.valueOr(shouldSendReferrer == NeverSendReferrer ? NewFrameOpenerPolicy::Suppress : NewFrameOpenerPolicy::Allow); 389 urlSelected(FrameLoadRequest(*m_frame.document(), m_frame.document()->securityOrigin(), { url }, passedTarget, lockHistory, lockBackForwardList, shouldSendReferrer, AllowNavigationToInvalidURL::Yes, newFrameOpenerPolicy, shouldOpenExternalURLsPolicy, initiatedByMainFrame, DoNotReplaceDocumentIfJavaScriptURL, downloadAttribute, systemPreviewInfo), triggeringEvent );390 } 391 392 void FrameLoader::urlSelected(FrameLoadRequest&& frameRequest, Event* triggeringEvent )389 urlSelected(FrameLoadRequest(*m_frame.document(), m_frame.document()->securityOrigin(), { url }, passedTarget, lockHistory, lockBackForwardList, shouldSendReferrer, AllowNavigationToInvalidURL::Yes, newFrameOpenerPolicy, shouldOpenExternalURLsPolicy, initiatedByMainFrame, DoNotReplaceDocumentIfJavaScriptURL, downloadAttribute, systemPreviewInfo), triggeringEvent, WTFMove(adClickAttribution)); 390 } 391 392 void FrameLoader::urlSelected(FrameLoadRequest&& frameRequest, Event* triggeringEvent, Optional<AdClickAttribution>&& adClickAttribution) 393 393 { 394 394 RELEASE_LOG_IF_ALLOWED("urlSelected: frame load started (frame = %p, main = %d)", &m_frame, m_frame.isMainFrame()); … … 405 405 m_frame.document()->contentSecurityPolicy()->upgradeInsecureRequestIfNeeded(frameRequest.resourceRequest(), ContentSecurityPolicy::InsecureRequestType::Navigation); 406 406 407 loadFrameRequest(WTFMove(frameRequest), triggeringEvent, { } );407 loadFrameRequest(WTFMove(frameRequest), triggeringEvent, { }, WTFMove(adClickAttribution)); 408 408 } 409 409 … … 985 985 986 986 FrameLoadRequest frameLoadRequest { *m_frame.document(), m_frame.document()->securityOrigin(), { url }, "_self"_s, LockHistory::No, LockBackForwardList::Yes, ShouldSendReferrer::MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, ShouldOpenExternalURLsPolicy::ShouldNotAllow, initiatedByMainFrame }; 987 childFrame->loader().loadURL(WTFMove(frameLoadRequest), referer, FrameLoadType::RedirectWithLockedBackForwardList, nullptr, { }, [] { });987 childFrame->loader().loadURL(WTFMove(frameLoadRequest), referer, FrameLoadType::RedirectWithLockedBackForwardList, nullptr, { }, WTF::nullopt, [] { }); 988 988 } 989 989 … … 1241 1241 } 1242 1242 1243 void FrameLoader::loadFrameRequest(FrameLoadRequest&& request, Event* event, RefPtr<FormState>&& formState )1243 void FrameLoader::loadFrameRequest(FrameLoadRequest&& request, Event* event, RefPtr<FormState>&& formState, Optional<AdClickAttribution>&& adClickAttribution) 1244 1244 { 1245 1245 RELEASE_LOG_IF_ALLOWED("loadFrameRequest: frame load started (frame = %p, main = %d)", &m_frame, m_frame.isMainFrame()); … … 1288 1288 loadPostRequest(WTFMove(request), referrer, loadType, event, WTFMove(formState), WTFMove(completionHandler)); 1289 1289 else 1290 loadURL(WTFMove(request), referrer, loadType, event, WTFMove(formState), WTFMove( completionHandler));1290 loadURL(WTFMove(request), referrer, loadType, event, WTFMove(formState), WTFMove(adClickAttribution), WTFMove(completionHandler)); 1291 1291 } 1292 1292 … … 1330 1330 } 1331 1331 1332 void FrameLoader::loadURL(FrameLoadRequest&& frameLoadRequest, const String& referrer, FrameLoadType newLoadType, Event* event, RefPtr<FormState>&& formState, CompletionHandler<void()>&& completionHandler)1332 void FrameLoader::loadURL(FrameLoadRequest&& frameLoadRequest, const String& referrer, FrameLoadType newLoadType, Event* event, RefPtr<FormState>&& formState, Optional<AdClickAttribution>&& adClickAttribution, CompletionHandler<void()>&& completionHandler) 1333 1333 { 1334 1334 RELEASE_LOG_IF_ALLOWED("loadURL: frame load started (frame = %p, main = %d)", &m_frame, m_frame.isMainFrame()); … … 1367 1367 if (targetFrame && targetFrame != &m_frame) { 1368 1368 frameLoadRequest.setFrameName("_self"); 1369 targetFrame->loader().loadURL(WTFMove(frameLoadRequest), referrer, newLoadType, event, WTFMove(formState), completionHandlerCaller.release());1369 targetFrame->loader().loadURL(WTFMove(frameLoadRequest), referrer, newLoadType, event, WTFMove(formState), WTFMove(adClickAttribution), completionHandlerCaller.release()); 1370 1370 return; 1371 1371 } … … 1377 1377 action.setLockHistory(lockHistory); 1378 1378 action.setLockBackForwardList(frameLoadRequest.lockBackForwardList()); 1379 if (adClickAttribution && m_frame.isMainFrame()) 1380 action.setAdClickAttribution(WTFMove(*adClickAttribution)); 1379 1381 1380 1382 if (!targetFrame && !effectiveFrameName.isEmpty()) { -
trunk/Source/WebCore/loader/FrameLoader.h
r240909 r241049 32 32 #pragma once 33 33 34 #include "AdClickAttribution.h" 34 35 #include "CachePolicy.h" 35 36 #include "FrameLoaderStateMachine.h" … … 116 117 // FIXME: These are all functions which start loads. We have too many. 117 118 WEBCORE_EXPORT void loadURLIntoChildFrame(const URL&, const String& referer, Frame*); 118 WEBCORE_EXPORT void loadFrameRequest(FrameLoadRequest&&, Event*, RefPtr<FormState>&& ); // Called by submitForm, calls loadPostRequest and loadURL.119 WEBCORE_EXPORT void loadFrameRequest(FrameLoadRequest&&, Event*, RefPtr<FormState>&&, Optional<AdClickAttribution>&& = WTF::nullopt); // Called by submitForm, calls loadPostRequest and loadURL. 119 120 120 121 WEBCORE_EXPORT void load(FrameLoadRequest&&); … … 126 127 127 128 void changeLocation(FrameLoadRequest&&); 128 WEBCORE_EXPORT void urlSelected(const URL&, const String& target, Event*, LockHistory, LockBackForwardList, ShouldSendReferrer, ShouldOpenExternalURLsPolicy, Optional<NewFrameOpenerPolicy> = WTF::nullopt, const AtomicString& downloadAttribute = nullAtom(), const SystemPreviewInfo& = { } );129 WEBCORE_EXPORT void urlSelected(const URL&, const String& target, Event*, LockHistory, LockBackForwardList, ShouldSendReferrer, ShouldOpenExternalURLsPolicy, Optional<NewFrameOpenerPolicy> = WTF::nullopt, const AtomicString& downloadAttribute = nullAtom(), const SystemPreviewInfo& = { }, Optional<AdClickAttribution>&& = WTF::nullopt); 129 130 void submitForm(Ref<FormSubmission>&&); 130 131 … … 372 373 void dispatchDidCommitLoad(Optional<HasInsecureContent> initialHasInsecureContent); 373 374 374 void urlSelected(FrameLoadRequest&&, Event* );375 void urlSelected(FrameLoadRequest&&, Event*, Optional<AdClickAttribution>&& = WTF::nullopt); 375 376 376 377 void loadWithDocumentLoader(DocumentLoader*, FrameLoadType, RefPtr<FormState>&&, AllowNavigationToInvalidURL, ShouldTreatAsContinuingLoad, CompletionHandler<void()>&& = [] { }); // Calls continueLoadAfterNavigationPolicy … … 380 381 381 382 void loadPostRequest(FrameLoadRequest&&, const String& referrer, FrameLoadType, Event*, RefPtr<FormState>&&, CompletionHandler<void()>&&); 382 void loadURL(FrameLoadRequest&&, const String& referrer, FrameLoadType, Event*, RefPtr<FormState>&&, CompletionHandler<void()>&&);383 void loadURL(FrameLoadRequest&&, const String& referrer, FrameLoadType, Event*, RefPtr<FormState>&&, Optional<AdClickAttribution>&&, CompletionHandler<void()>&&); 383 384 384 385 bool shouldReload(const URL& currentURL, const URL& destinationURL); -
trunk/Source/WebCore/loader/NavigationAction.h
r239427 r241049 29 29 #pragma once 30 30 31 #include "AdClickAttribution.h" 31 32 #include "BackForwardItemIdentifier.h" 32 33 #include "FrameLoaderTypes.h" … … 36 37 #include "UserGestureIndicator.h" 37 38 #include <wtf/Forward.h> 39 #include <wtf/Optional.h> 38 40 39 41 namespace WebCore { … … 134 136 void setLockBackForwardList(LockBackForwardList lockBackForwardList) { m_lockBackForwardList = lockBackForwardList; } 135 137 138 const Optional<AdClickAttribution>& adClickAttribution() { return m_adClickAttribution; }; 139 void setAdClickAttribution(AdClickAttribution&& adClickAttribution) { m_adClickAttribution = adClickAttribution; }; 140 136 141 private: 137 142 // Do not add a strong reference to the originating document or a subobject that holds the … … 152 157 LockHistory m_lockHistory { LockHistory::No }; 153 158 LockBackForwardList m_lockBackForwardList { LockBackForwardList::No }; 159 Optional<AdClickAttribution> m_adClickAttribution; 154 160 }; 155 161 -
trunk/Source/WebKit/ChangeLog
r241046 r241049 1 2019-02-06 John Wilander <wilander@apple.com> 2 3 Forward Ad Click Attribution data from HTMLAnchorElement::handleClick() to WebKit::NavigationActionData 4 https://bugs.webkit.org/show_bug.cgi?id=194325 5 <rdar://problem/47840283> 6 7 Reviewed by Chris Dumez. 8 9 * Shared/NavigationActionData.cpp: 10 (WebKit::NavigationActionData::encode const): 11 (WebKit::NavigationActionData::decode): 12 * Shared/NavigationActionData.h: 13 Now holds an optional WebCore::AdClickAttribution object. 14 1 15 2019-02-06 Daniel Bates <dabates@apple.com> 2 16 -
trunk/Source/WebKit/Shared/NavigationActionData.cpp
r241000 r241049 54 54 encoder.encodeEnum(lockBackForwardList); 55 55 encoder << clientRedirectSourceForHistory; 56 encoder << adClickAttribution; 56 57 } 57 58 … … 140 141 return WTF::nullopt; 141 142 143 Optional<Optional<WebCore::AdClickAttribution>> adClickAttribution; 144 decoder >> adClickAttribution; 145 if (!adClickAttribution) 146 return WTF::nullopt; 147 142 148 return {{ WTFMove(navigationType), modifiers, WTFMove(mouseButton), WTFMove(syntheticClickType), WTFMove(*userGestureTokenIdentifier), 143 149 WTFMove(*canHandleRequest), WTFMove(shouldOpenExternalURLsPolicy), WTFMove(*downloadAttribute), WTFMove(clickLocationInRootViewCoordinates), 144 150 WTFMove(*isRedirect), *treatAsSameOriginNavigation, *hasOpenedFrames, *openedByDOMWithOpener, WTFMove(*requesterOrigin), 145 WTFMove(*targetBackForwardItemIdentifier), lockHistory, lockBackForwardList, WTFMove(*clientRedirectSourceForHistory) }};151 WTFMove(*targetBackForwardItemIdentifier), lockHistory, lockBackForwardList, WTFMove(*clientRedirectSourceForHistory), WTFMove(*adClickAttribution) }}; 146 152 } 147 153 -
trunk/Source/WebKit/Shared/NavigationActionData.h
r241000 r241049 27 27 28 28 #include "WebEvent.h" 29 #include <WebCore/AdClickAttribution.h> 29 30 #include <WebCore/BackForwardItemIdentifier.h> 30 31 #include <WebCore/FloatPoint.h> … … 61 62 WebCore::LockBackForwardList lockBackForwardList; 62 63 WTF::String clientRedirectSourceForHistory; 64 Optional<WebCore::AdClickAttribution> adClickAttribution; 63 65 }; 64 66
Note: See TracChangeset
for help on using the changeset viewer.