Add Ad Click Attribution as an internal/experimental feature
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jan 2019 19:17:09 +0000 (19:17 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jan 2019 19:17:09 +0000 (19:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193685
<rdar://problem/47450399>

Reviewed by Brent Fulgham.

Source/WebCore:

Test: http/tests/adClickAttribution/anchor-tag-attributes-reflect.html

* html/HTMLAnchorElement.h:
* html/HTMLAnchorElement.idl:
* html/HTMLAttributeNames.in:
    Addeed two new experimental attributes:
    - adcampaignid: Ad campaign ID.
    - addestination: Ad link destination site.
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::adClickAttributionEnabled const):
(WebCore::RuntimeEnabledFeatures::setAdClickAttributionEnabled):
* page/Settings.yaml:

Source/WebKit:

* Shared/WebPreferences.yaml:
    Added AdClickAttributionEnabled as a runtime enabled feature, off by default.

Source/WebKitLegacy/mac:

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences adClickAttributionEnabled]):
(-[WebPreferences setAdClickAttributionEnabled:]):
    Added support for experimental ad click attribution.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Tools:

Added test option adClickAttributionEnabled.

* DumpRenderTree/TestOptions.cpp:
(TestOptions::TestOptions):
* DumpRenderTree/TestOptions.h:
* DumpRenderTree/mac/DumpRenderTree.mm:
(setWebPreferencesForTestOptions):

LayoutTests:

* http/tests/adClickAttribution/anchor-tag-attributes-reflect-expected.txt: Added.
* http/tests/adClickAttribution/anchor-tag-attributes-reflect.html: Added.
* platform/win/TestExpectations:
    Skipped on Windows for now.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240444 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/adClickAttribution/anchor-tag-attributes-reflect-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/adClickAttribution/anchor-tag-attributes-reflect.html [new file with mode: 0644]
LayoutTests/platform/win/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLAnchorElement.idl
Source/WebCore/html/HTMLAttributeNames.in
Source/WebCore/page/RuntimeEnabledFeatures.h
Source/WebCore/page/Settings.yaml
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKitLegacy/mac/WebView/WebPreferences.mm
Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
Source/WebKitLegacy/mac/WebView/WebView.mm
Tools/ChangeLog
Tools/DumpRenderTree/TestOptions.cpp
Tools/DumpRenderTree/TestOptions.h
Tools/DumpRenderTree/mac/DumpRenderTree.mm

index 2e64b30..c2abd7d 100644 (file)
@@ -1,3 +1,16 @@
+2019-01-24  John Wilander  <wilander@apple.com>
+
+        Add Ad Click Attribution as an internal/experimental feature
+        https://bugs.webkit.org/show_bug.cgi?id=193685
+        <rdar://problem/47450399>
+
+        Reviewed by Brent Fulgham.
+
+        * http/tests/adClickAttribution/anchor-tag-attributes-reflect-expected.txt: Added.
+        * http/tests/adClickAttribution/anchor-tag-attributes-reflect.html: Added.
+        * platform/win/TestExpectations:
+            Skipped on Windows for now.
+
 2019-01-23  Oriol Brufau  <obrufau@igalia.com>
 
         Allow failures in flaky tests from bug 193657
diff --git a/LayoutTests/http/tests/adClickAttribution/anchor-tag-attributes-reflect-expected.txt b/LayoutTests/http/tests/adClickAttribution/anchor-tag-attributes-reflect-expected.txt
new file mode 100644 (file)
index 0000000..1c7a95e
--- /dev/null
@@ -0,0 +1,11 @@
+Test for the new ad click attribution attributes on anchor tags.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS anchorTag.adcampaignid is "40"
+PASS anchorTag.addestination is "destination.example"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/adClickAttribution/anchor-tag-attributes-reflect.html b/LayoutTests/http/tests/adClickAttribution/anchor-tag-attributes-reflect.html
new file mode 100644 (file)
index 0000000..3c6a277
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AdClickAttributionEnabled=true ] -->
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <script src="/js-test-resources/js-test.js"></script>
+</head>
+<body>
+<a id="testTag" href="http://localhost:8000" adcampaignid="40" addestination="destination.example"></a>
+<script>
+    description("Test for the new ad click attribution attributes on anchor tags.");
+
+    const anchorTag = document.getElementById("testTag");
+    shouldBeEqualToString("anchorTag.adcampaignid", "40");
+    shouldBeEqualToString("anchorTag.addestination", "destination.example");
+</script>
+</body>
+</html>
index 080fbea..94f3bc1 100644 (file)
@@ -110,6 +110,7 @@ webkit.org/b/173281 editing/selection/selection-across-shadow-boundaries-readonl
 webkit.org/b/173281 editing/selection/selection-across-shadow-boundaries-readonly-2.html [ Skip ]
 webkit.org/b/173281 editing/selection/selection-across-shadow-boundaries-readonly-3.html [ Skip ]
 webkit.org/b/173281 editing/selection/selection-across-shadow-boundaries-user-select-all-1.html [ Skip ]
+webkit.org/b/193748 http/tests/adClickAttribution [ Skip ]
 
 # TODO HW filters not yet supported on Windows
 webkit.org/b/74716 css3/filters/effect-blur-hw.html [ Skip ]
index b7e8ffa..07430bd 100644 (file)
@@ -1,3 +1,24 @@
+2019-01-24  John Wilander  <wilander@apple.com>
+
+        Add Ad Click Attribution as an internal/experimental feature
+        https://bugs.webkit.org/show_bug.cgi?id=193685
+        <rdar://problem/47450399>
+
+        Reviewed by Brent Fulgham.
+
+        Test: http/tests/adClickAttribution/anchor-tag-attributes-reflect.html
+
+        * html/HTMLAnchorElement.h:
+        * html/HTMLAnchorElement.idl:
+        * html/HTMLAttributeNames.in:
+            Addeed two new experimental attributes:
+            - adcampaignid: Ad campaign ID.
+            - addestination: Ad link destination site.
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::adClickAttributionEnabled const):
+        (WebCore::RuntimeEnabledFeatures::setAdClickAttributionEnabled):
+        * page/Settings.yaml:
+
 2019-01-24  Youenn Fablet  <youenn@apple.com>
 
         Use MonotonicTime in WorkerRunLoop
index b7f5946..0d21fc7 100644 (file)
@@ -19,6 +19,8 @@
  */
 
 interface HTMLAnchorElement : HTMLElement {
+    [CEReactions=NotNeeded, EnabledAtRuntime=AdClickAttribution, Reflect] attribute DOMString adcampaignid;
+    [CEReactions=NotNeeded, EnabledAtRuntime=AdClickAttribution, Reflect] attribute DOMString addestination;
     [CEReactions=NotNeeded, Reflect] attribute DOMString charset;
     [CEReactions=NotNeeded, Reflect] attribute DOMString coords;
     [CEReactions=NotNeeded, Conditional=DOWNLOAD_ATTRIBUTE, EnabledAtRuntime=DownloadAttribute, Reflect] attribute DOMString download;
index d822282..ec0978d 100644 (file)
@@ -66,6 +66,8 @@ aria-valuenow
 aria-valuetext
 as
 async
+adcampaignid
+addestination
 autocomplete
 autofocus
 autoplay
index ab58159..0f7e7a5 100644 (file)
@@ -341,6 +341,9 @@ public:
     void setCSSLogicalEnabled(bool isEnabled) { m_CSSLogicalEnabled = isEnabled; }
     bool cssLogicalEnabled() const { return m_CSSLogicalEnabled; }
 
+    bool adClickAttributionEnabled() const { return m_adClickAttributionEnabled; }
+    void setAdClickAttributionEnabled(bool isEnabled) { m_adClickAttributionEnabled = isEnabled; }
+
     WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures();
 
 private:
@@ -516,6 +519,8 @@ private:
 
     bool m_CSSLogicalEnabled { false };
 
+    bool m_adClickAttributionEnabled { false };
+
     friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
 };
 
index 9b9a6e8..17136e1 100644 (file)
@@ -788,3 +788,6 @@ videoQualityIncludesDisplayCompositingEnabled:
 
 editableImagesEnabled:
   initial: false
+
+adClickAttributionEnabled:
+  initial: false
index 034c654..82dbac5 100644 (file)
@@ -1,3 +1,14 @@
+2019-01-24  John Wilander  <wilander@apple.com>
+
+        Add Ad Click Attribution as an internal/experimental feature
+        https://bugs.webkit.org/show_bug.cgi?id=193685
+        <rdar://problem/47450399>
+
+        Reviewed by Brent Fulgham.
+
+        * Shared/WebPreferences.yaml:
+            Added AdClickAttributionEnabled as a runtime enabled feature, off by default.
+
 2019-01-24  Antti Koivisto  <antti@apple.com>
 
         [PSON] Flash on back navigation on Mac
index c6145b1..9b0eaca 100644 (file)
@@ -1543,3 +1543,11 @@ CSSLogicalEnabled:
   humanReadableDescription: "Enable CSS Logical Properties and Values"
   webcoreBinding: RuntimeEnabledFeatures
   category: internal
+
+AdClickAttributionEnabled:
+  type: bool
+  defaultValue: false
+  humanReadableName: "Ad Click Attribution"
+  humanReadableDescription: "Enable Ad Click Attribution for Cross-Site Link Navigations"
+  webcoreBinding: RuntimeEnabledFeatures
+  category: internal
index 9896565..247391e 100644 (file)
@@ -1,3 +1,21 @@
+2019-01-24  John Wilander  <wilander@apple.com>
+
+        Add Ad Click Attribution as an internal/experimental feature
+        https://bugs.webkit.org/show_bug.cgi?id=193685
+        <rdar://problem/47450399>
+
+        Reviewed by Brent Fulgham.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences adClickAttributionEnabled]):
+        (-[WebPreferences setAdClickAttributionEnabled:]):
+            Added support for experimental ad click attribution.
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2019-01-24  Ross Kirsling  <ross.kirsling@sony.com>
 
         Move FileSystem to WTF
index 8493a0a..49d342f 100644 (file)
 #define WebKitServerTimingEnabledPreferenceKey @"WebKitServerTimingEnabled"
 #define WebKitSelectionAcrossShadowBoundariesEnabledPreferenceKey @"WebKitSelectionAcrossShadowBoundariesEnabled"
 #define WebKitCSSLogicalEnabledPreferenceKey @"WebKitCSSLogicalEnabled"
+#define WebKitAdClickAttributionEnabledPreferenceKey @"WebKitAdClickAttributionEnabled"
index 5cdab7b..e802c0a 100644 (file)
@@ -670,6 +670,7 @@ public:
 #endif
         [NSNumber numberWithBool:YES], WebKitSelectionAcrossShadowBoundariesEnabledPreferenceKey,
         [NSNumber numberWithBool:NO], WebKitCSSLogicalEnabledPreferenceKey,
+        [NSNumber numberWithBool:NO], WebKitAdClickAttributionEnabledPreferenceKey,
 #if ENABLE(INTERSECTION_OBSERVER)
         @NO, WebKitIntersectionObserverEnabledPreferenceKey,
 #endif
@@ -3390,6 +3391,16 @@ static NSString *classIBCreatorID = nil;
     [self _setBoolValue:flag forKey:WebKitCSSLogicalEnabledPreferenceKey];
 }
 
+- (BOOL)adClickAttributionEnabled
+{
+    return [self _boolValueForKey:WebKitAdClickAttributionEnabledPreferenceKey];
+}
+
+- (void)setAdClickAttributionEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitAdClickAttributionEnabledPreferenceKey];
+}
+
 @end
 
 @implementation WebPreferences (WebInternal)
index 2d7f11a..8820db2 100644 (file)
@@ -585,6 +585,9 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification WEBKIT_DEPR
 - (void)setCSSLogicalEnabled:(BOOL)flag;
 - (BOOL)cssLogicalEnabled;
 
+- (BOOL)adClickAttributionEnabled;
+- (void)setAdClickAttributionEnabled:(BOOL)flag;
+
 @property (nonatomic) BOOL visualViewportEnabled;
 @property (nonatomic) BOOL visualViewportAPIEnabled;
 @property (nonatomic) BOOL CSSOMViewScrollingAPIEnabled;
index 01c6005..7c5092e 100644 (file)
@@ -3079,6 +3079,8 @@ static bool needsSelfRetainWhileLoadingQuirk()
 
     RuntimeEnabledFeatures::sharedFeatures().setCSSLogicalEnabled([preferences cssLogicalEnabled]);
 
+    RuntimeEnabledFeatures::sharedFeatures().setAdClickAttributionEnabled([preferences adClickAttributionEnabled]);
+
     settings.setHiddenPageDOMTimerThrottlingEnabled([preferences hiddenPageDOMTimerThrottlingEnabled]);
 
     settings.setHiddenPageCSSAnimationSuspensionEnabled([preferences hiddenPageCSSAnimationSuspensionEnabled]);
index 13073c5..528399f 100644 (file)
@@ -1,3 +1,19 @@
+2019-01-24  John Wilander  <wilander@apple.com>
+
+        Add Ad Click Attribution as an internal/experimental feature
+        https://bugs.webkit.org/show_bug.cgi?id=193685
+        <rdar://problem/47450399>
+
+        Reviewed by Brent Fulgham.
+
+        Added test option adClickAttributionEnabled.
+
+        * DumpRenderTree/TestOptions.cpp:
+        (TestOptions::TestOptions):
+        * DumpRenderTree/TestOptions.h:
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (setWebPreferencesForTestOptions):
+
 2019-01-24  Antti Koivisto  <antti@apple.com>
 
         [PSON] Flash on back navigation on Mac
index ee99dc9..c926612 100644 (file)
@@ -109,6 +109,8 @@ TestOptions::TestOptions(const std::string& pathOrURL, const std::string& absolu
             enableWebGPU = parseBooleanTestHeaderValue(value);
         else if (key == "internal:CSSLogicalEnabled")
             enableCSSLogical = parseBooleanTestHeaderValue(value);
+        else if (key == "internal:AdClickAttributionEnabled")
+            adClickAttributionEnabled = parseBooleanTestHeaderValue(value);
         pairStart = pairEnd + 1;
     }
 }
index 3756e95..c27e842 100644 (file)
@@ -45,6 +45,7 @@ struct TestOptions {
     bool enableSelectionAcrossShadowBoundaries { true };
     bool enableWebGPU { false };
     bool enableCSSLogical { false };
+    bool adClickAttributionEnabled { false };
     std::string jscOptions;
 
     TestOptions(const std::string& pathOrURL, const std::string& absolutePath);
index f313aeb..d3f58c7 100644 (file)
@@ -1011,6 +1011,7 @@ static void setWebPreferencesForTestOptions(const TestOptions& options)
     preferences.selectionAcrossShadowBoundariesEnabled = options.enableSelectionAcrossShadowBoundaries;
     preferences.webGPUEnabled = options.enableWebGPU;
     preferences.CSSLogicalEnabled = options.enableCSSLogical;
+    preferences.adClickAttributionEnabled = options.adClickAttributionEnabled;
 }
 
 // Called once on DumpRenderTree startup.