js/src/jsapi-tests/testIntTypesABI.cpp

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 /* 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/. */
     5 /*
     6  * This test exercises the full, deliberately-exposed JSAPI interface to ensure
     7  * that no internal integer typedefs leak out.  Include every intentionally
     8  * public header file (and those headers included by them, for completeness),
     9  * even the ones tests.h itself included, to verify this.
    10  */
    12 #include "jscpucfg.h"
    13 #include "jspubtd.h"
    14 #include "jstypes.h"
    16 #include "js/Anchor.h"
    17 #include "js/CallArgs.h"
    18 #include "js/CallNonGenericMethod.h"
    19 #include "js/CharacterEncoding.h"
    20 #include "js/Class.h"
    21 #include "js/Date.h"
    22 #include "js/GCAPI.h"
    23 #include "js/HashTable.h"
    24 #include "js/HeapAPI.h"
    25 #include "js/Id.h"
    26 /* LegacyIntTypes.h is deliberately exempted from this requirement */
    27 #include "js/MemoryMetrics.h"
    28 #include "js/OldDebugAPI.h"
    29 #include "js/ProfilingStack.h"
    30 #include "js/PropertyKey.h"
    31 #include "js/RequiredDefines.h"
    32 #include "js/RootingAPI.h"
    33 #include "js/SliceBudget.h"
    34 #include "js/StructuredClone.h"
    35 #include "js/TracingAPI.h"
    36 #include "js/TypeDecls.h"
    37 #include "js/Utility.h"
    38 #include "js/Value.h"
    39 #include "js/Vector.h"
    40 #include "js/WeakMapPtr.h"
    41 #include "jsapi-tests/tests.h"
    43 /*
    44  * Verify that our public (and intended to be public, versus being that way
    45  * because we haven't made them private yet) headers don't define
    46  * {u,}int{8,16,32,64} or JS{Ui,I}nt{8,16,32,64} types.  If any do, they will
    47  * assuredly conflict with a corresponding typedef below mapping to a *struct*.
    48  *
    49  * Note that tests.h includes a few internal headers; in order that this
    50  * jsapi-test be writable, those internal headers must not import the legacy
    51  * typedefs.
    52  */
    54 struct ConflictingType {
    55     uint64_t u64;
    56 };
    58 typedef ConflictingType uint8;
    59 typedef ConflictingType uint16;
    60 typedef ConflictingType uint32;
    61 typedef ConflictingType uint64;
    63 typedef ConflictingType int8;
    64 typedef ConflictingType int16;
    65 typedef ConflictingType int32;
    66 typedef ConflictingType int64;
    68 typedef ConflictingType JSUint8;
    69 typedef ConflictingType JSUint16;
    70 typedef ConflictingType JSUint32;
    71 typedef ConflictingType JSUint64;
    73 typedef ConflictingType JSInt8;
    74 typedef ConflictingType JSInt16;
    75 typedef ConflictingType JSInt32;
    76 typedef ConflictingType JSInt64;
    78 typedef ConflictingType jsword;
    79 typedef ConflictingType jsuword;
    80 typedef ConflictingType JSWord;
    81 typedef ConflictingType JSUword;
    83 BEGIN_TEST(testIntTypesABI)
    84 {
    85     /* This passes if the typedefs didn't conflict at compile time. */
    86     return true;
    87 }
    88 END_TEST(testIntTypesABI)

mercurial