js/xpconnect/wrappers/FilteringWrapper.h

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 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef __FilteringWrapper_h__
     8 #define __FilteringWrapper_h__
    10 #include "mozilla/Attributes.h"
    11 #include "jswrapper.h"
    12 #include "js/CallNonGenericMethod.h"
    14 struct JSPropertyDescriptor;
    16 namespace JS {
    17 class AutoIdVector;
    18 }
    20 namespace xpc {
    22 template <typename Base, typename Policy>
    23 class FilteringWrapper : public Base {
    24   public:
    25     FilteringWrapper(unsigned flags);
    26     virtual ~FilteringWrapper();
    28     virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
    29                                        JS::Handle<jsid> id,
    30                                        JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
    31     virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
    32                                           JS::Handle<jsid> id,
    33                                           JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
    34     virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject*> wrapper,
    35                                      JS::AutoIdVector &props) MOZ_OVERRIDE;
    36     virtual bool enumerate(JSContext *cx, JS::Handle<JSObject*> wrapper,
    37                            JS::AutoIdVector &props) MOZ_OVERRIDE;
    38     virtual bool keys(JSContext *cx, JS::Handle<JSObject*> wrapper,
    39                       JS::AutoIdVector &props) MOZ_OVERRIDE;
    40     virtual bool iterate(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned flags,
    41                          JS::MutableHandle<JS::Value> vp) MOZ_OVERRIDE;
    42     virtual bool nativeCall(JSContext *cx, JS::IsAcceptableThis test, JS::NativeImpl impl,
    43                             JS::CallArgs args) MOZ_OVERRIDE;
    45     virtual bool defaultValue(JSContext *cx, JS::Handle<JSObject*> obj, JSType hint, JS::MutableHandleValue vp) MOZ_OVERRIDE;
    47     virtual bool enter(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
    48                        js::Wrapper::Action act, bool *bp) MOZ_OVERRIDE;
    50     static FilteringWrapper singleton;
    51 };
    53 }
    55 #endif /* __FilteringWrapper_h__ */

mercurial