⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 244325 in webkit


Ignore:
Timestamp:
Apr 15, 2019, 9:24:23 PM (7 years ago)
Author:
wilander@apple.com
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:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r244312 r244325  
     12019-04-15  John Wilander  <wilander@apple.com>
     2
     3        Add a query string nonce to LayoutTests/http/tests/adClickAttribution/send-attribution-conversion-request.html to address flakiness
     4        https://bugs.webkit.org/show_bug.cgi?id=196955
     5
     6        Unreviewed test gardening.
     7
     8        * http/tests/adClickAttribution/resources/conversionFilePath.php:
     9        * http/tests/adClickAttribution/resources/conversionReport.php:
     10        * http/tests/adClickAttribution/resources/getConversionData.php:
     11        * http/tests/adClickAttribution/send-attribution-conversion-request.html:
     12
    1132019-04-15  Devin Rousso  <drousso@apple.com>
    214
  • trunk/LayoutTests/http/tests/adClickAttribution/resources/conversionFilePath.php

    r244288 r244325  
    22require_once '../../resources/portabilityLayer.php';
    33
    4 $conversionFilePath = sys_get_temp_dir() . "/adClickConversion.txt";
    5 
     4if (isset($_GET["nonce"]))
     5    $conversionFileName = "/adClickConversion" . $_GET["nonce"] . ".txt";
     6else
     7    $conversionFileName = "/adClickConversion.txt";
     8$conversionFilePath = sys_get_temp_dir() . $conversionFileName;
    69?>
  • trunk/LayoutTests/http/tests/adClickAttribution/resources/conversionReport.php

    r244288 r244325  
    66$cookiesFound = false;
    77foreach ($httpHeaders as $name => $value) {
    8     if ($name === "HTTP_HOST" || $name === "REQUEST_URI")
     8    if ($name === "HTTP_HOST") {
    99        fwrite($conversionFile, "$name: $value\n");
    10     else if ($name === "HTTP_COOKIE") {
     10    } else if ($name === "REQUEST_URI") {
     11        $positionOfNonce = strpos($value, "&nonce=");
     12        if ($positionOfNonce === false)
     13            $outputURL = $value;
     14        else
     15            $outputURL = substr($value, 0, $positionOfNonce);
     16        fwrite($conversionFile, "$name: $outputURL\n");
     17    } else if ($name === "HTTP_COOKIE") {
    1118        fwrite($conversionFile, "Cookies in conversion request: $value\n");
    1219        $cookiesFound = true;
  • trunk/LayoutTests/http/tests/adClickAttribution/resources/getConversionData.php

    r244288 r244325  
    3737    unlink($conversionFilePath);
    3838} else {
    39     echo "Conversion not received - timed out.";
     39    echo "Conversion not received - timed out.<br>";
    4040}
    4141
  • trunk/LayoutTests/http/tests/adClickAttribution/send-attribution-conversion-request.html

    r244288 r244325  
    1111<div id="output"></div>
    1212<script>
     13    const currentTimeMillis = (new Date()).getTime();
     14    const highEntropyBits = currentTimeMillis - (Math.floor(currentTimeMillis / 1000000) * 1000000);
     15    const nonce = highEntropyBits + "" + Math.floor(Math.random() * 100);
     16
    1317    if (window.testRunner) {
    1418        testRunner.waitUntilDone();
     
    1620        testRunner.setAllowsAnySSLCertificate(true);
    1721        testRunner.setAdClickAttributionOverrideTimerForTesting(true);
    18         testRunner.setAdClickAttributionConversionURLForTesting("http://127.0.0.1:8000/adClickAttribution/resources/conversionReport.php");
    1922    }
    2023
     
    3942
    4043        let iframeElement = document.createElement("iframe");
    41         iframeElement.src = "http://127.0.0.1:8000/adClickAttribution/resources/getConversionData.php?endTest=true&timeout_ms=2000";
     44        iframeElement.src = "http://127.0.0.1:8000/adClickAttribution/resources/getConversionData.php?endTest=true&timeout_ms=2000&nonce=" + nonce;
    4245        document.body.appendChild(iframeElement);
    4346    }
     
    4649        if (window.testRunner) {
    4750            if (window.location.search === "?stepTwo") {
     51                testRunner.setAdClickAttributionConversionURLForTesting("http://127.0.0.1:8000/adClickAttribution/resources/conversionReport.php?nonce=" + nonce);
    4852                let imageElement = document.createElement("img");
    4953                imageElement.src = "https://127.0.0.1:8443/adClickAttribution/resources/redirectToConversion.php?conversionData=12";
  • trunk/Source/WebCore/ChangeLog

    r244321 r244325  
     12019-04-15  John Wilander  <wilander@apple.com>
     2
     3        Add a query string nonce to LayoutTests/http/tests/adClickAttribution/send-attribution-conversion-request.html to address flakiness
     4        https://bugs.webkit.org/show_bug.cgi?id=196955
     5
     6        Unreviewed test gardening. The WebCore change is only in a dedicated
     7        test function.
     8
     9        No new tests. Existing test updated.
     10
     11        * loader/AdClickAttribution.cpp:
     12        (WebCore::AdClickAttribution::urlForTesting const):
     13            Now preserves the query string in the test URL.
     14
    1152019-04-15  Chris Dumez  <cdumez@apple.com>
    216
  • trunk/Source/WebCore/loader/AdClickAttribution.cpp

    r244288 r244325  
    142142    builder.appendLiteral("&campaign=");
    143143    builder.appendNumber(m_campaign.id);
     144    if (baseURL.hasQuery()) {
     145        builder.append('&');
     146        builder.append(baseURL.query());
     147    }
    144148    return URL(baseURL, builder.toString());
    145149}
Note: See TracChangeset for help on using the changeset viewer.