intl/locale/tests/unit/test_bug371611.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 const Cc = Components.classes;
     2 const Ci = Components.interfaces;
     3 const Cr = Components.results;
     5 function test_formatdatetime_return()
     6 {
     7   var dateConv = Cc["@mozilla.org/intl/scriptabledateformat;1"].
     8     getService(Ci.nsIScriptableDateFormat);
    10   /* Testing if we throw instead of crashing when we are passed 0s. */
    11   var x = false;
    12   try {
    13     dateConv.FormatDate("", Ci.nsIScriptableDateFormat.dateFormatLong,
    14                         0, 0, 0);
    15   }
    16   catch (e if (e.result == Cr.NS_ERROR_INVALID_ARG)) {
    17     x = true;
    18   }
    19   if (!x)
    20     do_throw("FormatDate didn't throw when passed 0 for its arguments.");
    21 }
    23 function run_test()
    24 {
    25   test_formatdatetime_return();
    26 }

mercurial