author Mike Hommey <>
Wed, 01 Jun 2016 07:22:49 +0900
changeset 342755 1d2c46c8c7c764daf8638663524033dfe330cf0a
parent 334321 3558dbf6f998834768f57c7c5c57a6472923a3a8
child 350170 56321464405dc99b8a9b68c0fc60e9d628f75bf5
permissions -rw-r--r--
Bug 1244446 - Run automation build steps before postflight_all. r=gps,r=ted Killing the sccache background daemon is part of postflight_all, but in the current setup, postflight_all happens at the end of a "normal" build, but we run automation build steps after that. What happens then is that more compilations happen (gtests), which start sccache again, but there's nothing to kill sccache again once this is all done. Now that the OSX universal builds postflight is gone, it is not necessary for postflight_all to happen before the automation build steps. So ensure postflight_all scripts happen last. The downside of this change is that this now prevents sccache.log from being uploaded, but we should probably send processed data to the graph server instead.

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

#ifndef nsCookie_h__
#define nsCookie_h__

#include "nsICookie.h"
#include "nsICookie2.h"
#include "nsString.h"

#include "mozilla/MemoryReporting.h"
#include "mozilla/BasePrincipal.h"

using mozilla::OriginAttributes;

 * The nsCookie class is the main cookie storage medium for use within cookie
 * code. It implements nsICookie2, which extends nsICookie, a frozen interface
 * for xpcom access of cookie objects.

 * nsCookie:
 * implementation

class nsCookie : public nsICookie2
    // nsISupports

    // for internal use only. see nsCookie::Create().
    nsCookie(const char     *aName,
             const char     *aValue,
             const char     *aHost,
             const char     *aPath,
             const char     *aEnd,
             int64_t         aExpiry,
             int64_t         aLastAccessed,
             int64_t         aCreationTime,
             bool            aIsSession,
             bool            aIsSecure,
             bool            aIsHttpOnly,
             const OriginAttributes& aOriginAttributes)
     : mName(aName)
     , mValue(aValue)
     , mHost(aHost)
     , mPath(aPath)
     , mEnd(aEnd)
     , mExpiry(aExpiry)
     , mLastAccessed(aLastAccessed)
     , mCreationTime(aCreationTime)
     , mIsSession(aIsSession)
     , mIsSecure(aIsSecure)
     , mIsHttpOnly(aIsHttpOnly)
     , mOriginAttributes(aOriginAttributes)

    // Generate a unique and monotonically increasing creation time. See comment
    // in nsCookie.cpp.
    static int64_t GenerateUniqueCreationTime(int64_t aCreationTime);

    // public helper to create an nsCookie object. use |operator delete|
    // to destroy an object created by this method.
    static nsCookie * Create(const nsACString &aName,
                             const nsACString &aValue,
                             const nsACString &aHost,
                             const nsACString &aPath,
                             int64_t           aExpiry,
                             int64_t           aLastAccessed,
                             int64_t           aCreationTime,
                             bool              aIsSession,
                             bool              aIsSecure,
                             bool              aIsHttpOnly,
                             const OriginAttributes& aOriginAttributes);

    size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;

    // fast (inline, non-xpcom) getters
    inline const nsDependentCString Name()  const { return nsDependentCString(mName, mValue - 1); }
    inline const nsDependentCString Value() const { return nsDependentCString(mValue, mHost - 1); }
    inline const nsDependentCString Host()  const { return nsDependentCString(mHost, mPath - 1); }
    inline const nsDependentCString RawHost() const { return nsDependentCString(IsDomain() ? mHost + 1 : mHost, mPath - 1); }
    inline const nsDependentCString Path()  const { return nsDependentCString(mPath, mEnd); }
    inline int64_t Expiry()                 const { return mExpiry; }        // in seconds
    inline int64_t LastAccessed()           const { return mLastAccessed; }  // in microseconds
    inline int64_t CreationTime()           const { return mCreationTime; }  // in microseconds
    inline bool IsSession()               const { return mIsSession; }
    inline bool IsDomain()                const { return *mHost == '.'; }
    inline bool IsSecure()                const { return mIsSecure; }
    inline bool IsHttpOnly()              const { return mIsHttpOnly; }

    // setters
    inline void SetExpiry(int64_t aExpiry)        { mExpiry = aExpiry; }
    inline void SetLastAccessed(int64_t aTime)    { mLastAccessed = aTime; }
    inline void SetIsSession(bool aIsSession)     { mIsSession = aIsSession; }
    // Set the creation time manually, overriding the monotonicity checks in
    // Create(). Use with caution!
    inline void SetCreationTime(int64_t aTime)    { mCreationTime = aTime; }

    bool IsStale() const;

    virtual ~nsCookie() {}

    // member variables
    // we use char* ptrs to store the strings in a contiguous block,
    // so we save on the overhead of using nsCStrings. However, we
    // store a terminating null for each string, so we can hand them
    // out as nsAFlatCStrings.
    // Please update SizeOfIncludingThis if this strategy changes.
    const char  *mName;
    const char  *mValue;
    const char  *mHost;
    const char  *mPath;
    const char  *mEnd;
    int64_t      mExpiry;
    int64_t      mLastAccessed;
    int64_t      mCreationTime;
    bool mIsSession;
    bool mIsSecure;
    bool mIsHttpOnly;
    mozilla::OriginAttributes mOriginAttributes;

#endif // nsCookie_h__