layout/style/nsDOMCSSRect.cpp

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 /* DOM object representing rectangle values in DOM computed style */
     8 #include "mozilla/dom/RectBinding.h"
     9 #include "nsROCSSPrimitiveValue.h"
    10 #include "nsDOMCSSRect.h"
    12 using namespace mozilla;
    14 nsDOMCSSRect::nsDOMCSSRect(nsROCSSPrimitiveValue* aTop,
    15                            nsROCSSPrimitiveValue* aRight,
    16                            nsROCSSPrimitiveValue* aBottom,
    17                            nsROCSSPrimitiveValue* aLeft)
    18   : mTop(aTop), mRight(aRight), mBottom(aBottom), mLeft(aLeft)
    19 {
    20   SetIsDOMBinding();
    21 }
    23 nsDOMCSSRect::~nsDOMCSSRect(void)
    24 {
    25 }
    27 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMCSSRect)
    28   NS_INTERFACE_MAP_ENTRY(nsIDOMRect)
    29   NS_INTERFACE_MAP_ENTRY(nsISupports)
    30   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
    31 NS_INTERFACE_MAP_END
    33 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCSSRect)
    34 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCSSRect)
    36 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_4(nsDOMCSSRect, mTop, mBottom, mLeft, mRight)
    38 JSObject*
    39 nsDOMCSSRect::WrapObject(JSContext* cx)
    40 {
    41  return dom::RectBinding::Wrap(cx, this);
    42 }
    44 NS_IMETHODIMP
    45 nsDOMCSSRect::GetTop(nsIDOMCSSPrimitiveValue** aTop)
    46 {
    47   NS_ENSURE_TRUE(mTop, NS_ERROR_NOT_INITIALIZED);
    48   *aTop = mTop;
    49   NS_ADDREF(*aTop);
    50   return NS_OK;
    51 }
    53 NS_IMETHODIMP
    54 nsDOMCSSRect::GetRight(nsIDOMCSSPrimitiveValue** aRight)
    55 {
    56   NS_ENSURE_TRUE(mRight, NS_ERROR_NOT_INITIALIZED);
    57   *aRight = mRight;
    58   NS_ADDREF(*aRight);
    59   return NS_OK;
    60 }
    62 NS_IMETHODIMP
    63 nsDOMCSSRect::GetBottom(nsIDOMCSSPrimitiveValue** aBottom)
    64 {
    65   NS_ENSURE_TRUE(mBottom, NS_ERROR_NOT_INITIALIZED);
    66   *aBottom = mBottom;
    67   NS_ADDREF(*aBottom);
    68   return NS_OK;
    69 }
    71 NS_IMETHODIMP
    72 nsDOMCSSRect::GetLeft(nsIDOMCSSPrimitiveValue** aLeft)
    73 {
    74   NS_ENSURE_TRUE(mLeft, NS_ERROR_NOT_INITIALIZED);
    75   *aLeft = mLeft;
    76   NS_ADDREF(*aLeft);
    77   return NS_OK;
    78 }

mercurial