Sat, 03 Jan 2015 20:18:00 +0100
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 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #include "js/OldDebugAPI.h"
9 #include "jsapi-tests/tests.h"
11 const char code[] =
12 "xx = 1; \n\
13 \n\
14 try { \n\
15 debugger; \n\
16 \n\
17 xx += 1; \n\
18 } \n\
19 catch (e) \n\
20 { \n\
21 xx += 1; \n\
22 }\n\
23 //@ sourceMappingURL=http://example.com/path/to/source-map.json";
25 // Bug 670958 - fix JS_GetScriptLineExtent, among others
26 BEGIN_TEST(testScriptInfo)
27 {
28 unsigned startLine = 1000;
30 JS::CompileOptions options(cx);
31 options.setFileAndLine(__FILE__, startLine);
32 JS::RootedScript script(cx, JS_CompileScript(cx, global, code, strlen(code),
33 options));
35 CHECK(script);
37 jsbytecode *start = JS_LineNumberToPC(cx, script, startLine);
38 CHECK_EQUAL(JS_GetScriptBaseLineNumber(cx, script), startLine);
39 CHECK_EQUAL(JS_PCToLineNumber(cx, script, start), startLine);
40 CHECK_EQUAL(JS_GetScriptLineExtent(cx, script), 11);
41 CHECK(strcmp(JS_GetScriptFilename(script), __FILE__) == 0);
42 const jschar *sourceMap = JS_GetScriptSourceMap(cx, script);
43 CHECK(sourceMap);
44 CHECK(CharsMatch(sourceMap, "http://example.com/path/to/source-map.json"));
46 return true;
47 }
48 static bool
49 CharsMatch(const jschar *p, const char *q)
50 {
51 while (*q) {
52 if (*p++ != *q++)
53 return false;
54 }
55 return true;
56 }
57 END_TEST(testScriptInfo)