tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_storage_cookies_edit_expiry.js (1141B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 // Basic test to check the editing of cookies with the keyboard.
      6 
      7 "use strict";
      8 
      9 add_task(async function () {
     10  await openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies.html");
     11  showAllColumns(true);
     12  showColumn("uniqueKey", false);
     13 
     14  const date = new Date();
     15  const futureExpires = date.setDate(date.getDate() + 2000);
     16 
     17  const id = getCookieId("test4", "test1.example.org", "/browser");
     18  const originalExpires = Date.parse(getRowValues(id).expires);
     19 
     20  await editCell(id, "expires", date.toGMTString(), false);
     21  const capExpires = Date.parse(getRowValues(id).expires);
     22 
     23  Assert.greater(
     24    futureExpires,
     25    originalExpires,
     26    "We have tried to set an expires greater than the original one"
     27  );
     28  Assert.greater(
     29    capExpires,
     30    originalExpires,
     31    "The final expires is greater than the original one"
     32  );
     33  Assert.greater(
     34    futureExpires,
     35    capExpires,
     36    "But still lower than the future value"
     37  );
     38 });