test_bug643051.html 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=643051
  5. -->
  6. <head>
  7. <title>Test for Bug 643051</title>
  8. <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  9. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  10. </head>
  11. <body>
  12. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=643051">Mozilla Bug 643051</a>
  13. <p id="display"></p>
  14. <div id="content" style="display: none">
  15. </div>
  16. <pre id="test">
  17. <script type="application/javascript">
  18. /** Test for Bug 643051 **/
  19. document.cookie = "a=; expires=Thu, 01-Jan-1970 00:00:01 GMT"; // clear cookie
  20. document.cookie = "a2=; expires=Thu, 01-Jan-1970 00:00:01 GMT"; // clear cookie
  21. document.cookie = "a3=; expires=Thu, 01-Jan-1970 00:00:01 GMT"; // clear cookie
  22. // single cookie, should work
  23. document.cookie = "a=bar";
  24. is(document.cookie, "a=bar", "Can't read stored cookie!");
  25. document.cookie = "a2=bar\na3=bar";
  26. is(document.cookie, "a=bar; a2=bar", "Wrong cookie value");
  27. document.cookie = "a2=baz; a3=bar";
  28. is(document.cookie, "a=bar; a2=baz", "Wrong cookie value");
  29. // clear cookies again to avoid affecting other tests
  30. document.cookie = "a=; expires=Thu, 01-Jan-1970 00:00:01 GMT";
  31. document.cookie = "a2=; expires=Thu, 01-Jan-1970 00:00:01 GMT";
  32. document.cookie = "a3=; expires=Thu, 01-Jan-1970 00:00:01 GMT";
  33. </script>
  34. </pre>
  35. </body>
  36. </html>