js/src/gdb/tests/test-JSString.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 #include "gdb-tests.h"
     2 #include "jsatom.h"
     3 #include "jscntxt.h"
     5 // When JSGC_ANALYSIS is #defined, Rooted<JSFlatString*> needs the definition
     6 // of JSFlatString in order to figure out its ThingRootKind
     7 #include "vm/String.h"
     9 FRAGMENT(JSString, simple) {
    10   JS::Rooted<JSString *> empty(cx, JS_NewStringCopyN(cx, nullptr, 0));
    11   JS::Rooted<JSString *> x(cx, JS_NewStringCopyN(cx, "x", 1));
    12   JS::Rooted<JSString *> z(cx, JS_NewStringCopyZ(cx, "z"));
    14   // I expect this will be a non-inlined string.
    15   JS::Rooted<JSString *> stars(cx, JS_NewStringCopyZ(cx,
    16                                                      "*************************"
    17                                                      "*************************"
    18                                                      "*************************"
    19                                                      "*************************"));
    21   // This may well be an inlined string.
    22   JS::Rooted<JSString *> xz(cx, JS_ConcatStrings(cx, x, z));
    24   // This will probably be a rope.
    25   JS::Rooted<JSString *> doubleStars(cx, JS_ConcatStrings(cx, stars, stars));
    27   // Ensure we're not confused by typedefs for pointer types.
    28   JSString *xRaw = x;
    30   breakpoint();
    32   (void) empty;
    33   (void) x;
    34   (void) z;
    35   (void) stars;
    36   (void) xz;
    37   (void) doubleStars;
    38   (void) xRaw;
    39 }
    41 FRAGMENT(JSString, null) {
    42   JS::Rooted<JSString *> null(cx, nullptr);
    43   JSString *nullRaw = null;
    45   breakpoint();
    47   (void) null;
    48   (void) nullRaw;
    49 }
    51 FRAGMENT(JSString, subclasses) {
    52   JS::Rooted<JSFlatString *> flat(cx, JS_FlattenString(cx, JS_NewStringCopyZ(cx, "Hi!")));
    54   breakpoint();
    56   (void) flat;
    57 }
    59 FRAGMENT(JSString, atom) {
    60   JSAtom *molybdenum = js::Atomize(cx, "molybdenum", 10);
    61   breakpoint();
    63   (void) molybdenum;
    64 }

mercurial