dom/xslt/xpath/nsXPathExpression.h

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.

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef nsXPathExpression_h__
michael@0 7 #define nsXPathExpression_h__
michael@0 8
michael@0 9 #include "nsIDOMXPathExpression.h"
michael@0 10 #include "nsIDOMNSXPathExpression.h"
michael@0 11 #include "txIXPathContext.h"
michael@0 12 #include "txResultRecycler.h"
michael@0 13 #include "nsAutoPtr.h"
michael@0 14 #include "nsCycleCollectionParticipant.h"
michael@0 15 #include "mozilla/Attributes.h"
michael@0 16
michael@0 17 class Expr;
michael@0 18 class txXPathNode;
michael@0 19
michael@0 20 /**
michael@0 21 * A class for evaluating an XPath expression string
michael@0 22 */
michael@0 23 class nsXPathExpression MOZ_FINAL : public nsIDOMXPathExpression,
michael@0 24 public nsIDOMNSXPathExpression
michael@0 25 {
michael@0 26 public:
michael@0 27 nsXPathExpression(nsAutoPtr<Expr>& aExpression, txResultRecycler* aRecycler,
michael@0 28 nsIDOMDocument *aDocument);
michael@0 29
michael@0 30 // nsISupports interface
michael@0 31 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
michael@0 32 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXPathExpression,
michael@0 33 nsIDOMXPathExpression)
michael@0 34
michael@0 35 // nsIDOMXPathExpression interface
michael@0 36 NS_DECL_NSIDOMXPATHEXPRESSION
michael@0 37
michael@0 38 // nsIDOMNSXPathExpression interface
michael@0 39 NS_DECL_NSIDOMNSXPATHEXPRESSION
michael@0 40
michael@0 41 private:
michael@0 42 nsAutoPtr<Expr> mExpression;
michael@0 43 nsRefPtr<txResultRecycler> mRecycler;
michael@0 44 nsCOMPtr<nsIDOMDocument> mDocument;
michael@0 45
michael@0 46 class EvalContextImpl : public txIEvalContext
michael@0 47 {
michael@0 48 public:
michael@0 49 EvalContextImpl(const txXPathNode& aContextNode,
michael@0 50 uint32_t aContextPosition, uint32_t aContextSize,
michael@0 51 txResultRecycler* aRecycler)
michael@0 52 : mContextNode(aContextNode),
michael@0 53 mContextPosition(aContextPosition),
michael@0 54 mContextSize(aContextSize),
michael@0 55 mLastError(NS_OK),
michael@0 56 mRecycler(aRecycler)
michael@0 57 {
michael@0 58 }
michael@0 59
michael@0 60 nsresult getError()
michael@0 61 {
michael@0 62 return mLastError;
michael@0 63 }
michael@0 64
michael@0 65 TX_DECL_EVAL_CONTEXT;
michael@0 66
michael@0 67 private:
michael@0 68 const txXPathNode& mContextNode;
michael@0 69 uint32_t mContextPosition;
michael@0 70 uint32_t mContextSize;
michael@0 71 nsresult mLastError;
michael@0 72 nsRefPtr<txResultRecycler> mRecycler;
michael@0 73 };
michael@0 74 };
michael@0 75
michael@0 76 #endif

mercurial