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 jit_AsmJSLink_h |
michael@0 | 8 | #define jit_AsmJSLink_h |
michael@0 | 9 | |
michael@0 | 10 | #include "NamespaceImports.h" |
michael@0 | 11 | |
michael@0 | 12 | class JSAtom; |
michael@0 | 13 | |
michael@0 | 14 | namespace js { |
michael@0 | 15 | |
michael@0 | 16 | class AsmJSActivation; |
michael@0 | 17 | class AsmJSModule; |
michael@0 | 18 | namespace jit { class CallSite; } |
michael@0 | 19 | |
michael@0 | 20 | // Iterates over the frames of a single AsmJSActivation. |
michael@0 | 21 | class AsmJSFrameIterator |
michael@0 | 22 | { |
michael@0 | 23 | const AsmJSModule *module_; |
michael@0 | 24 | const jit::CallSite *callsite_; |
michael@0 | 25 | uint8_t *sp_; |
michael@0 | 26 | uint8_t *returnAddress_; |
michael@0 | 27 | |
michael@0 | 28 | void popFrame(); |
michael@0 | 29 | void settle(); |
michael@0 | 30 | |
michael@0 | 31 | public: |
michael@0 | 32 | AsmJSFrameIterator(const AsmJSActivation *activation); |
michael@0 | 33 | void operator++() { popFrame(); settle(); } |
michael@0 | 34 | bool done() const { return !callsite_; } |
michael@0 | 35 | JSAtom *functionDisplayAtom() const; |
michael@0 | 36 | unsigned computeLine(uint32_t *column) const; |
michael@0 | 37 | }; |
michael@0 | 38 | |
michael@0 | 39 | #ifdef JS_ION |
michael@0 | 40 | |
michael@0 | 41 | // Create a new JSFunction to replace originalFun as the representation of the |
michael@0 | 42 | // function defining the succesfully-validated module 'moduleObj'. |
michael@0 | 43 | extern JSFunction * |
michael@0 | 44 | NewAsmJSModuleFunction(ExclusiveContext *cx, JSFunction *originalFun, HandleObject moduleObj); |
michael@0 | 45 | |
michael@0 | 46 | // Return whether this is the js::Native returned by NewAsmJSModuleFunction. |
michael@0 | 47 | extern bool |
michael@0 | 48 | IsAsmJSModuleNative(JSNative native); |
michael@0 | 49 | |
michael@0 | 50 | // Return whether the given value is a function containing "use asm" that has |
michael@0 | 51 | // been validated according to the asm.js spec. |
michael@0 | 52 | extern bool |
michael@0 | 53 | IsAsmJSModule(JSContext *cx, unsigned argc, JS::Value *vp); |
michael@0 | 54 | extern bool |
michael@0 | 55 | IsAsmJSModule(HandleFunction fun); |
michael@0 | 56 | |
michael@0 | 57 | extern JSString* |
michael@0 | 58 | AsmJSModuleToString(JSContext *cx, HandleFunction fun, bool addParenToLambda); |
michael@0 | 59 | |
michael@0 | 60 | // Return whether the given value is a function containing "use asm" that was |
michael@0 | 61 | // loaded directly from the cache (and hence was validated previously). |
michael@0 | 62 | extern bool |
michael@0 | 63 | IsAsmJSModuleLoadedFromCache(JSContext *cx, unsigned argc, Value *vp); |
michael@0 | 64 | |
michael@0 | 65 | // Return whether the given value is a nested function in an asm.js module that |
michael@0 | 66 | // has been both compile- and link-time validated. |
michael@0 | 67 | extern bool |
michael@0 | 68 | IsAsmJSFunction(JSContext *cx, unsigned argc, JS::Value *vp); |
michael@0 | 69 | extern bool |
michael@0 | 70 | IsAsmJSFunction(HandleFunction fun); |
michael@0 | 71 | |
michael@0 | 72 | extern JSString * |
michael@0 | 73 | AsmJSFunctionToString(JSContext *cx, HandleFunction fun); |
michael@0 | 74 | |
michael@0 | 75 | #else // JS_ION |
michael@0 | 76 | |
michael@0 | 77 | inline bool |
michael@0 | 78 | IsAsmJSModuleNative(JSNative native) |
michael@0 | 79 | { |
michael@0 | 80 | return false; |
michael@0 | 81 | } |
michael@0 | 82 | |
michael@0 | 83 | inline bool |
michael@0 | 84 | IsAsmJSFunction(JSContext *cx, unsigned argc, Value *vp) |
michael@0 | 85 | { |
michael@0 | 86 | CallArgs args = CallArgsFromVp(argc, vp); |
michael@0 | 87 | args.rval().set(BooleanValue(false)); |
michael@0 | 88 | return true; |
michael@0 | 89 | } |
michael@0 | 90 | |
michael@0 | 91 | inline bool |
michael@0 | 92 | IsAsmJSFunction(HandleFunction fun) |
michael@0 | 93 | { |
michael@0 | 94 | return false; |
michael@0 | 95 | } |
michael@0 | 96 | |
michael@0 | 97 | inline JSString * |
michael@0 | 98 | AsmJSFunctionToString(JSContext *cx, HandleFunction fun) |
michael@0 | 99 | { |
michael@0 | 100 | return nullptr; |
michael@0 | 101 | } |
michael@0 | 102 | |
michael@0 | 103 | inline bool |
michael@0 | 104 | IsAsmJSModule(JSContext *cx, unsigned argc, Value *vp) |
michael@0 | 105 | { |
michael@0 | 106 | CallArgs args = CallArgsFromVp(argc, vp); |
michael@0 | 107 | args.rval().set(BooleanValue(false)); |
michael@0 | 108 | return true; |
michael@0 | 109 | } |
michael@0 | 110 | |
michael@0 | 111 | inline bool |
michael@0 | 112 | IsAsmJSModule(HandleFunction fun) |
michael@0 | 113 | { |
michael@0 | 114 | return false; |
michael@0 | 115 | } |
michael@0 | 116 | |
michael@0 | 117 | inline JSString* |
michael@0 | 118 | AsmJSModuleToString(JSContext *cx, HandleFunction fun, bool addParenToLambda) |
michael@0 | 119 | { |
michael@0 | 120 | return nullptr; |
michael@0 | 121 | } |
michael@0 | 122 | |
michael@0 | 123 | inline bool |
michael@0 | 124 | IsAsmJSModuleLoadedFromCache(JSContext *cx, unsigned argc, Value *vp) |
michael@0 | 125 | { |
michael@0 | 126 | CallArgs args = CallArgsFromVp(argc, vp); |
michael@0 | 127 | args.rval().set(BooleanValue(false)); |
michael@0 | 128 | return true; |
michael@0 | 129 | } |
michael@0 | 130 | |
michael@0 | 131 | #endif // JS_ION |
michael@0 | 132 | |
michael@0 | 133 | } // namespace js |
michael@0 | 134 | |
michael@0 | 135 | #endif // jit_AsmJS_h |