Changeset 154505 in webkit


Ignore:
Timestamp:
Aug 23, 2013 12:17:58 PM (11 years ago)
Author:
ap@apple.com
Message:

http/tests/cache/partitioned-cache.html breaks subsequent cookie tests
https://bugs.webkit.org/show_bug.cgi?id=120212

Reviewed by Tim Horton.

The test never deleted its localhost cookie, so subsequent third party cookie
relaxing tests saw the existing cookie and failed.

There is no need to use cookies in this test, and it's actually slightly incorrect,
as the network layer may refuse to use a cached result simply because cookies changed,
and then we wouldn't test 3rd party data blocking.

  • platform/qt/http/tests/cache/partitioned-cache-expected.txt:
  • http/tests/cache/partitioned-cache-expected.txt: Updated results. It took me a long time to understand what the test was doing, so made it a bit more self-descriptive.
  • http/tests/cache/partitioned-cache.html: Tabs to spaces.
  • http/tests/cache/resources/echo-cookie.cgi: Removed.
  • http/tests/cache/resources/partitioned-cache-echo-state.php: Added.
  • http/tests/cache/resources/partitioned-cache-loader.html: Changed to use a local file on the server to modify resource content.
Location:
trunk/LayoutTests
Files:
1 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r154500 r154505  
     12013-08-23  Alexey Proskuryakov  <ap@apple.com>
     2
     3        http/tests/cache/partitioned-cache.html breaks subsequent cookie tests
     4        https://bugs.webkit.org/show_bug.cgi?id=120212
     5
     6        Reviewed by Tim Horton.
     7
     8        The test never deleted its localhost cookie, so subsequent third party cookie
     9        relaxing tests saw the existing cookie and failed.
     10
     11        There is no need to use cookies in this test, and it's actually slightly incorrect,
     12        as the network layer may refuse to use a cached result simply because cookies changed,
     13        and then we wouldn't test 3rd party data blocking.
     14
     15        * platform/qt/http/tests/cache/partitioned-cache-expected.txt:
     16        * http/tests/cache/partitioned-cache-expected.txt: Updated results. It took me
     17        a long time to understand what the test was doing, so made it a bit more self-descriptive.
     18
     19        * http/tests/cache/partitioned-cache.html: Tabs to spaces.
     20
     21        * http/tests/cache/resources/echo-cookie.cgi: Removed.
     22        * http/tests/cache/resources/partitioned-cache-echo-state.php: Added.
     23        * http/tests/cache/resources/partitioned-cache-loader.html:
     24        Changed to use a local file on the server to modify resource content.
     25
    1262013-08-23  Bear Travis  <betravis@adobe.com>
    227
  • trunk/LayoutTests/http/tests/cache/partitioned-cache-expected.txt

    r151705 r154505  
    1 CONSOLE MESSAGE: line 10: localhost
    2 CONSOLE MESSAGE: line 10: 127.0.0.1
     1CONSOLE MESSAGE: line 13: Document domain is now localhost
     2CONSOLE MESSAGE: line 14: Setting server-side persistent state to "localhost"
     3CONSOLE MESSAGE: line 23: Server state retrieved via a 1st party resource: "localhost"
     4CONSOLE MESSAGE: line 13: Document domain is now 127.0.0.1
     5CONSOLE MESSAGE: line 14: Setting server-side persistent state to "127.0.0.1"
     6CONSOLE MESSAGE: line 26: Server state retrieved via a 3rd party resource (possibly a cached result, but it shouldn't be): "127.0.0.1"
    37PASS response is "127.0.0.1"
    48
  • trunk/LayoutTests/http/tests/cache/partitioned-cache.html

    r143986 r154505  
    33<script>
    44if (window.testRunner) {
    5         testRunner.dumpAsText();
    6         testRunner.dumpChildFramesAsText();
    7         testRunner.waitUntilDone();
    8         testRunner.setCanOpenWindows(true);
    9         testRunner.setCloseRemainingWindowsWhenComplete(true);
    10         internals.settings.setStorageBlockingPolicy('BlockThirdParty');
     5    testRunner.dumpAsText();
     6    testRunner.dumpChildFramesAsText();
     7    testRunner.waitUntilDone();
     8    internals.settings.setStorageBlockingPolicy('BlockThirdParty');
    119}
    1210
  • trunk/LayoutTests/http/tests/cache/resources/partitioned-cache-loader.html

    r143986 r154505  
    33<script src="../../resources/js-test-pre.js"></script>
    44<script>
    5         var scriptElement = document.createElement('script');
    6         document.cookie = 'value=' + document.domain;
    7         scriptElement.setAttribute('src', 'http://localhost:8000/cache/resources/echo-cookie.cgi');
    8         document.head.appendChild(scriptElement);
    9         window.onload = function() {
    10                 console.log(response);
    11                 shouldBeEqualToString('response',  document.domain);
    12                 if (document.domain == 'localhost') {
    13                         document.cookie = 'value=127.0.0.1';
    14                         document.location = 'http://127.0.0.1:8000/cache/resources/partitioned-cache-loader.html';
    15                 } else if (window.testRunner) {
    16                         internals.settings.setStorageBlockingPolicy('AllowAll');
    17                         testRunner.notifyDone();
    18                 }
    19         };
     5function setServerState(string)
     6{
     7    var xhr = new XMLHttpRequest;
     8    xhr.open('POST', '/resources/write-temp-file.php?filename=partitioned-cache-state&data=' + string, false);
     9    xhr.send();
     10}
     11
     12console.log('Document domain is now ' + document.domain);
     13console.log('Setting server-side persistent state to "' + document.domain + '"');
     14setServerState(document.domain);
     15
     16var scriptElement = document.createElement('script');
     17scriptElement.setAttribute('src', 'http://localhost:8000/cache/resources/partitioned-cache-echo-state.php');
     18document.head.appendChild(scriptElement);
     19
     20window.onload = function() {
     21    if (document.domain == 'localhost') {
     22        console.log('Server state retrieved via a 1st party resource: "' + response + '"');
     23        document.location = 'http://127.0.0.1:8000/cache/resources/partitioned-cache-loader.html';
     24    } else {
     25        console.log('Server state retrieved via a 3rd party resource (possibly a cached result, but it shouldn\'t be): "' + response + '"');
     26        shouldBeEqualToString('response',  document.domain);
     27        if (window.testRunner) {
     28            internals.settings.setStorageBlockingPolicy('AllowAll');
     29            testRunner.notifyDone();
     30        }
     31    }
     32}
    2033</script>
    2134</head>
  • trunk/LayoutTests/platform/qt/http/tests/cache/partitioned-cache-expected.txt

    r151732 r154505  
    1 CONSOLE MESSAGE: line 10: localhost
    2 CONSOLE MESSAGE: line 10: localhost
     1CONSOLE MESSAGE: line 13: Document domain is now localhost
     2CONSOLE MESSAGE: line 14: Setting server-side persistent state to "localhost"
     3CONSOLE MESSAGE: line 23: Server state retrieved via a 1st party resource: "localhost"
     4CONSOLE MESSAGE: line 13: Document domain is now 127.0.0.1
     5CONSOLE MESSAGE: line 14: Setting server-side persistent state to "127.0.0.1"
     6CONSOLE MESSAGE: line 26: Server state retrieved via a 3rd party resource (possibly a cached result, but it shouldn't be): "localhost"
    37FAIL response should be 127.0.0.1. Was localhost.
    48
Note: See TracChangeset for help on using the changeset viewer.