js/ipc/JavaScriptChild.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=4 sw=4 et tw=80:
     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 #ifndef mozilla_jsipc_JavaScriptChild_h_
     9 #define mozilla_jsipc_JavaScriptChild_h_
    11 #include "JavaScriptShared.h"
    12 #include "mozilla/jsipc/PJavaScriptChild.h"
    14 namespace mozilla {
    15 namespace jsipc {
    17 class JavaScriptChild
    18   : public PJavaScriptChild,
    19     public JavaScriptShared
    20 {
    21   public:
    22     JavaScriptChild(JSRuntime *rt);
    23     ~JavaScriptChild();
    25     bool init();
    26     void trace(JSTracer *trc);
    28     bool RecvDropObject(const ObjectId &objId) MOZ_OVERRIDE;
    30     bool AnswerPreventExtensions(const ObjectId &objId, ReturnStatus *rs) MOZ_OVERRIDE;
    31     bool AnswerGetPropertyDescriptor(const ObjectId &objId, const nsString &id,
    32                                      ReturnStatus *rs,
    33                                      PPropertyDescriptor *out) MOZ_OVERRIDE;
    34     bool AnswerGetOwnPropertyDescriptor(const ObjectId &objId,
    35                                         const nsString &id,
    36                                         ReturnStatus *rs,
    37                                         PPropertyDescriptor *out) MOZ_OVERRIDE;
    38     bool AnswerDefineProperty(const ObjectId &objId, const nsString &id,
    39                               const PPropertyDescriptor &flags,
    40                               ReturnStatus *rs) MOZ_OVERRIDE;
    41     bool AnswerDelete(const ObjectId &objId, const nsString &id,
    42                       ReturnStatus *rs, bool *success) MOZ_OVERRIDE;
    44     bool AnswerHas(const ObjectId &objId, const nsString &id,
    45                        ReturnStatus *rs, bool *bp) MOZ_OVERRIDE;
    46     bool AnswerHasOwn(const ObjectId &objId, const nsString &id,
    47                           ReturnStatus *rs, bool *bp) MOZ_OVERRIDE;
    48     bool AnswerGet(const ObjectId &objId, const ObjectId &receiverId,
    49                        const nsString &id,
    50                        ReturnStatus *rs, JSVariant *result) MOZ_OVERRIDE;
    51     bool AnswerSet(const ObjectId &objId, const ObjectId &receiverId,
    52                    const nsString &id, const bool &strict,
    53                    const JSVariant &value, ReturnStatus *rs, JSVariant *result) MOZ_OVERRIDE;
    55     bool AnswerIsExtensible(const ObjectId &objId, ReturnStatus *rs,
    56                             bool *result) MOZ_OVERRIDE;
    57     bool AnswerCall(const ObjectId &objId, const nsTArray<JSParam> &argv,
    58                     ReturnStatus *rs, JSVariant *result,
    59                     nsTArray<JSParam> *outparams) MOZ_OVERRIDE;
    60     bool AnswerObjectClassIs(const ObjectId &objId, const uint32_t &classValue,
    61                              bool *result) MOZ_OVERRIDE;
    62     bool AnswerClassName(const ObjectId &objId, nsString *result) MOZ_OVERRIDE;
    64     bool AnswerGetPropertyNames(const ObjectId &objId, const uint32_t &flags,
    65                                 ReturnStatus *rs, nsTArray<nsString> *names) MOZ_OVERRIDE;
    66     bool AnswerInstanceOf(const ObjectId &objId, const JSIID &iid,
    67                           ReturnStatus *rs, bool *instanceof) MOZ_OVERRIDE;
    68     bool AnswerDOMInstanceOf(const ObjectId &objId, const int &prototypeID, const int &depth,
    69                              ReturnStatus *rs, bool *instanceof) MOZ_OVERRIDE;
    71   protected:
    72     JSObject *unwrap(JSContext *cx, ObjectId id);
    74   private:
    75     bool makeId(JSContext *cx, JSObject *obj, ObjectId *idp);
    76     bool fail(JSContext *cx, ReturnStatus *rs);
    77     bool ok(ReturnStatus *rs);
    79   private:
    80     ObjectId lastId_;
    81     JSRuntime *rt_;
    82     ObjectIdCache ids_;
    83 };
    85 } // mozilla
    86 } // jsipc
    88 #endif

mercurial