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.

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

mercurial