js/src/jsapi-tests/testErrorCopying.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 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     2  * vim: set ts=8 sts=4 et sw=4 tw=99:
     3  *
     4  * Tests that the column number of error reports is properly copied over from
     5  * other reports when invoked from the C++ api.
     6  */
     7 /* This Source Code Form is subject to the terms of the Mozilla Public
     8  * License, v. 2.0. If a copy of the MPL was not distributed with this
     9  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    11 #include "jsapi-tests/tests.h"
    13 static uint32_t column = 0;
    15 BEGIN_TEST(testErrorCopying_columnCopied)
    16 {
    17         //0         1         2
    18         //0123456789012345678901234567
    19     EXEC("function check() { Object; foo; }");
    21     JS::RootedValue rval(cx);
    22     JS_SetErrorReporter(cx, my_ErrorReporter);
    23     CHECK(!JS_CallFunctionName(cx, global, "check", JS::HandleValueArray::empty(),
    24                                &rval));
    25     CHECK(column == 27);
    26     return true;
    27 }
    29 static void
    30 my_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
    31 {
    32     column = report->column;
    33 }
    35 END_TEST(testErrorCopying_columnCopied)

mercurial