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.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * vim: set ts=8 sts=4 et sw=4 tw=99: |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef builtin_RegExp_h |
michael@0 | 8 | #define builtin_RegExp_h |
michael@0 | 9 | |
michael@0 | 10 | #include "vm/RegExpObject.h" |
michael@0 | 11 | |
michael@0 | 12 | JSObject * |
michael@0 | 13 | js_InitRegExpClass(JSContext *cx, js::HandleObject obj); |
michael@0 | 14 | |
michael@0 | 15 | /* |
michael@0 | 16 | * The following builtin natives are extern'd for pointer comparison in |
michael@0 | 17 | * other parts of the engine. |
michael@0 | 18 | */ |
michael@0 | 19 | |
michael@0 | 20 | namespace js { |
michael@0 | 21 | |
michael@0 | 22 | // Whether RegExp statics should be updated with the input and results of a |
michael@0 | 23 | // regular expression execution. |
michael@0 | 24 | enum RegExpStaticsUpdate { UpdateRegExpStatics, DontUpdateRegExpStatics }; |
michael@0 | 25 | |
michael@0 | 26 | RegExpRunStatus |
michael@0 | 27 | ExecuteRegExp(JSContext *cx, HandleObject regexp, HandleString string, |
michael@0 | 28 | MatchConduit &matches, RegExpStaticsUpdate staticsUpdate); |
michael@0 | 29 | |
michael@0 | 30 | /* |
michael@0 | 31 | * Legacy behavior of ExecuteRegExp(), which is baked into the JSAPI. |
michael@0 | 32 | * |
michael@0 | 33 | * |res| may be nullptr if the RegExpStatics are not to be updated. |
michael@0 | 34 | * |input| may be nullptr if there is no JSString corresponding to |
michael@0 | 35 | * |chars| and |length|. |
michael@0 | 36 | */ |
michael@0 | 37 | bool |
michael@0 | 38 | ExecuteRegExpLegacy(JSContext *cx, RegExpStatics *res, RegExpObject &reobj, |
michael@0 | 39 | Handle<JSLinearString*> input, const jschar *chars, size_t length, |
michael@0 | 40 | size_t *lastIndex, bool test, MutableHandleValue rval); |
michael@0 | 41 | |
michael@0 | 42 | /* Translation from MatchPairs to a JS array in regexp_exec()'s output format. */ |
michael@0 | 43 | bool |
michael@0 | 44 | CreateRegExpMatchResult(JSContext *cx, HandleString input, const MatchPairs &matches, |
michael@0 | 45 | MutableHandleValue rval); |
michael@0 | 46 | |
michael@0 | 47 | extern bool |
michael@0 | 48 | regexp_exec_raw(JSContext *cx, HandleObject regexp, HandleString input, MutableHandleValue output); |
michael@0 | 49 | |
michael@0 | 50 | extern bool |
michael@0 | 51 | regexp_exec(JSContext *cx, unsigned argc, Value *vp); |
michael@0 | 52 | |
michael@0 | 53 | bool |
michael@0 | 54 | regexp_test_raw(JSContext *cx, HandleObject regexp, HandleString input, bool *result); |
michael@0 | 55 | |
michael@0 | 56 | extern bool |
michael@0 | 57 | regexp_test(JSContext *cx, unsigned argc, Value *vp); |
michael@0 | 58 | |
michael@0 | 59 | /* |
michael@0 | 60 | * The following functions are for use by self-hosted code. |
michael@0 | 61 | */ |
michael@0 | 62 | |
michael@0 | 63 | /* |
michael@0 | 64 | * Behaves like regexp.exec(string), but doesn't set RegExp statics. |
michael@0 | 65 | * |
michael@0 | 66 | * Usage: match = regexp_exec_no_statics(regexp, string) |
michael@0 | 67 | */ |
michael@0 | 68 | extern bool |
michael@0 | 69 | regexp_exec_no_statics(JSContext *cx, unsigned argc, Value *vp); |
michael@0 | 70 | |
michael@0 | 71 | /* |
michael@0 | 72 | * Behaves like regexp.test(string), but doesn't set RegExp statics. |
michael@0 | 73 | * |
michael@0 | 74 | * Usage: does_match = regexp_test_no_statics(regexp, string) |
michael@0 | 75 | */ |
michael@0 | 76 | extern bool |
michael@0 | 77 | regexp_test_no_statics(JSContext *cx, unsigned argc, Value *vp); |
michael@0 | 78 | |
michael@0 | 79 | } /* namespace js */ |
michael@0 | 80 | |
michael@0 | 81 | #endif /* builtin_RegExp_h */ |