Title: [244325] trunk
Revision
244325
Author
[email protected]
Date
2019-04-15 21:24:23 -0700 (Mon, 15 Apr 2019)

Log Message

Add a query string nonce to LayoutTests/http/tests/adClickAttribution/send-attribution-conversion-request.html to address flakiness
https://bugs.webkit.org/show_bug.cgi?id=196955

Source/WebCore:

Unreviewed test gardening. The WebCore change is only in a dedicated
test function.

No new tests. Existing test updated.


* loader/AdClickAttribution.cpp:
(WebCore::AdClickAttribution::urlForTesting const):
    Now preserves the query string in the test URL.

LayoutTests:

Unreviewed test gardening.


* http/tests/adClickAttribution/resources/conversionFilePath.php:
* http/tests/adClickAttribution/resources/conversionReport.php:
* http/tests/adClickAttribution/resources/getConversionData.php:
* http/tests/adClickAttribution/send-attribution-conversion-request.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (244324 => 244325)


--- trunk/LayoutTests/ChangeLog	2019-04-16 02:41:38 UTC (rev 244324)
+++ trunk/LayoutTests/ChangeLog	2019-04-16 04:24:23 UTC (rev 244325)
@@ -1,3 +1,15 @@
+2019-04-15  John Wilander  <[email protected]>
+
+        Add a query string nonce to LayoutTests/http/tests/adClickAttribution/send-attribution-conversion-request.html to address flakiness
+        https://bugs.webkit.org/show_bug.cgi?id=196955
+
+        Unreviewed test gardening.
+
+        * http/tests/adClickAttribution/resources/conversionFilePath.php:
+        * http/tests/adClickAttribution/resources/conversionReport.php:
+        * http/tests/adClickAttribution/resources/getConversionData.php:
+        * http/tests/adClickAttribution/send-attribution-conversion-request.html:
+
 2019-04-15  Devin Rousso  <[email protected]>
 
         Web Inspector: fake value descriptors for promises add a catch handler, preventing "rejectionhandled" events from being fired

Modified: trunk/LayoutTests/http/tests/adClickAttribution/resources/conversionFilePath.php (244324 => 244325)


--- trunk/LayoutTests/http/tests/adClickAttribution/resources/conversionFilePath.php	2019-04-16 02:41:38 UTC (rev 244324)
+++ trunk/LayoutTests/http/tests/adClickAttribution/resources/conversionFilePath.php	2019-04-16 04:24:23 UTC (rev 244325)
@@ -1,6 +1,9 @@
 <?php
 require_once '../../resources/portabilityLayer.php';
 
-$conversionFilePath = sys_get_temp_dir() . "/adClickConversion.txt";
-
+if (isset($_GET["nonce"]))
+    $conversionFileName = "/adClickConversion" . $_GET["nonce"] . ".txt";
+else
+    $conversionFileName = "/adClickConversion.txt";
+$conversionFilePath = sys_get_temp_dir() . $conversionFileName;
 ?>

Modified: trunk/LayoutTests/http/tests/adClickAttribution/resources/conversionReport.php (244324 => 244325)


--- trunk/LayoutTests/http/tests/adClickAttribution/resources/conversionReport.php	2019-04-16 02:41:38 UTC (rev 244324)
+++ trunk/LayoutTests/http/tests/adClickAttribution/resources/conversionReport.php	2019-04-16 04:24:23 UTC (rev 244325)
@@ -5,9 +5,16 @@
 $httpHeaders = $_SERVER;
 $cookiesFound = false;
 foreach ($httpHeaders as $name => $value) {
-    if ($name === "HTTP_HOST" || $name === "REQUEST_URI")
+    if ($name === "HTTP_HOST") {
         fwrite($conversionFile, "$name: $value\n");
-    else if ($name === "HTTP_COOKIE") {
+    } else if ($name === "REQUEST_URI") {
+        $positionOfNonce = strpos($value, "&nonce=");
+        if ($positionOfNonce === false)
+            $outputURL = $value;
+        else
+            $outputURL = substr($value, 0, $positionOfNonce);
+        fwrite($conversionFile, "$name: $outputURL\n");
+    } else if ($name === "HTTP_COOKIE") {
         fwrite($conversionFile, "Cookies in conversion request: $value\n");
         $cookiesFound = true;
     }

Modified: trunk/LayoutTests/http/tests/adClickAttribution/resources/getConversionData.php (244324 => 244325)


--- trunk/LayoutTests/http/tests/adClickAttribution/resources/getConversionData.php	2019-04-16 02:41:38 UTC (rev 244324)
+++ trunk/LayoutTests/http/tests/adClickAttribution/resources/getConversionData.php	2019-04-16 04:24:23 UTC (rev 244325)
@@ -36,7 +36,7 @@
     fclose($conversionFile);
     unlink($conversionFilePath);
 } else {
-    echo "Conversion not received - timed out.";
+    echo "Conversion not received - timed out.<br>";
 }
 
 if (isset($_GET['endTest'])) {

Modified: trunk/LayoutTests/http/tests/adClickAttribution/send-attribution-conversion-request.html (244324 => 244325)


--- trunk/LayoutTests/http/tests/adClickAttribution/send-attribution-conversion-request.html	2019-04-16 02:41:38 UTC (rev 244324)
+++ trunk/LayoutTests/http/tests/adClickAttribution/send-attribution-conversion-request.html	2019-04-16 04:24:23 UTC (rev 244325)
@@ -10,12 +10,15 @@
 <a id="targetLink" href="" adcampaignid="3" addestination="http://localhost:8000">Link</a><br>
 <div id="output"></div>
 <script>
+    const currentTimeMillis = (new Date()).getTime();
+    const highEntropyBits = currentTimeMillis - (Math.floor(currentTimeMillis / 1000000) * 1000000);
+    const nonce = highEntropyBits + "" + Math.floor(Math.random() * 100);
+
     if (window.testRunner) {
         testRunner.waitUntilDone();
         testRunner.dumpChildFramesAsText();
         testRunner.setAllowsAnySSLCertificate(true);
         testRunner.setAdClickAttributionOverrideTimerForTesting(true);
-        testRunner.setAdClickAttributionConversionURLForTesting("http://127.0.0.1:8000/adClickAttribution/resources/conversionReport.php");
     }
 
     function activateElement(elementID) {
@@ -38,7 +41,7 @@
         document.body.removeChild(document.getElementById("pixel"));
 
         let iframeElement = document.createElement("iframe");
-        iframeElement.src = ""
+        iframeElement.src = "" + nonce;
         document.body.appendChild(iframeElement);
     }
 
@@ -45,6 +48,7 @@
     function runTest() {
         if (window.testRunner) {
             if (window.location.search === "?stepTwo") {
+                testRunner.setAdClickAttributionConversionURLForTesting("http://127.0.0.1:8000/adClickAttribution/resources/conversionReport.php?nonce=" + nonce);
                 let imageElement = document.createElement("img");
                 imageElement.src = ""
                 imageElement.id = "pixel";

Modified: trunk/Source/WebCore/ChangeLog (244324 => 244325)


--- trunk/Source/WebCore/ChangeLog	2019-04-16 02:41:38 UTC (rev 244324)
+++ trunk/Source/WebCore/ChangeLog	2019-04-16 04:24:23 UTC (rev 244325)
@@ -1,3 +1,17 @@
+2019-04-15  John Wilander  <[email protected]>
+
+        Add a query string nonce to LayoutTests/http/tests/adClickAttribution/send-attribution-conversion-request.html to address flakiness
+        https://bugs.webkit.org/show_bug.cgi?id=196955
+
+        Unreviewed test gardening. The WebCore change is only in a dedicated
+        test function.
+
+        No new tests. Existing test updated.
+
+        * loader/AdClickAttribution.cpp:
+        (WebCore::AdClickAttribution::urlForTesting const):
+            Now preserves the query string in the test URL.
+
 2019-04-15  Chris Dumez  <[email protected]>
 
         URL set by document.open() is not communicated to the UIProcess

Modified: trunk/Source/WebCore/loader/AdClickAttribution.cpp (244324 => 244325)


--- trunk/Source/WebCore/loader/AdClickAttribution.cpp	2019-04-16 02:41:38 UTC (rev 244324)
+++ trunk/Source/WebCore/loader/AdClickAttribution.cpp	2019-04-16 04:24:23 UTC (rev 244325)
@@ -141,6 +141,10 @@
     builder.appendNumber(m_conversion.value().data);
     builder.appendLiteral("&campaign=");
     builder.appendNumber(m_campaign.id);
+    if (baseURL.hasQuery()) {
+        builder.append('&');
+        builder.append(baseURL.query());
+    }
     return URL(baseURL, builder.toString());
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to