dom/smil/nsSMILNullType.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 #include "nsSMILNullType.h"
     7 #include "nsSMILValue.h"
     8 #include "nsDebug.h"
    10 nsresult
    11 nsSMILNullType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
    12 {
    13   NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
    14   NS_PRECONDITION(aSrc.mType == this, "Unexpected source type");
    15   aDest.mU    = aSrc.mU;
    16   aDest.mType = Singleton();
    17   return NS_OK;
    18 }
    20 bool
    21 nsSMILNullType::IsEqual(const nsSMILValue& aLeft,
    22                         const nsSMILValue& aRight) const
    23 {
    24   NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
    25   NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
    27   return true;  // All null-typed values are equivalent.
    28 }
    30 nsresult
    31 nsSMILNullType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
    32                     uint32_t aCount) const
    33 {
    34   NS_NOTREACHED("Adding NULL type");
    35   return NS_ERROR_FAILURE;
    36 }
    38 nsresult
    39 nsSMILNullType::ComputeDistance(const nsSMILValue& aFrom,
    40                                 const nsSMILValue& aTo,
    41                                 double& aDistance) const
    42 {
    43   NS_NOTREACHED("Computing distance for NULL type");
    44   return NS_ERROR_FAILURE;
    45 }
    47 nsresult
    48 nsSMILNullType::Interpolate(const nsSMILValue& aStartVal,
    49                             const nsSMILValue& aEndVal,
    50                             double aUnitDistance,
    51                             nsSMILValue& aResult) const
    52 {
    53   NS_NOTREACHED("Interpolating NULL type");
    54   return NS_ERROR_FAILURE;
    55 }

mercurial