js/xpconnect/public/SandboxPrivate.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 __SANDBOXPRIVATE_H__
     8 #define __SANDBOXPRIVATE_H__
    10 #include "nsIGlobalObject.h"
    11 #include "nsIScriptObjectPrincipal.h"
    12 #include "nsIPrincipal.h"
    13 #include "nsWeakReference.h"
    14 #include "nsWrapperCache.h"
    16 #include "js/RootingAPI.h"
    18 // This interface is public only because it is used in jsd.
    19 // Once jsd is gone this file should be moved back to xpconnect/src.
    21 class SandboxPrivate : public nsIGlobalObject,
    22                        public nsIScriptObjectPrincipal,
    23                        public nsSupportsWeakReference,
    24                        public nsWrapperCache
    25 {
    26 public:
    27     SandboxPrivate(nsIPrincipal *principal, JSObject *global)
    28         : mPrincipal(principal)
    29     {
    30         SetWrapper(global);
    31     }
    32     virtual ~SandboxPrivate() { }
    34     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    35     NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(SandboxPrivate,
    36                                                            nsIGlobalObject)
    38     nsIPrincipal *GetPrincipal()
    39     {
    40         return mPrincipal;
    41     }
    43     JSObject *GetGlobalJSObject()
    44     {
    45         return GetWrapper();
    46     }
    48     void ForgetGlobalObject()
    49     {
    50         ClearWrapper();
    51     }
    52 private:
    53     nsCOMPtr<nsIPrincipal> mPrincipal;
    54 };
    56 #endif // __SANDBOXPRIVATE_H__

mercurial