author Cosmin Sabou <>
Sat, 02 Mar 2019 20:40:01 +0200
changeset 462132 bf3cbcc825276823afba2778333cf62cfa75039c
parent 452446 f0a91d36587266d7454a450c6044d573664fbed5
child 470418 e85cb54e594431e3b60f2e32cc6222872ba64f55
permissions -rw-r--r--
Backed out 16 changesets (bug 827976) for causing bug 1532054. a=backout Backed out changeset 54c0b12443ed (bug 827976) Backed out changeset 92b45080d080 (bug 827976) Backed out changeset 443087a359f9 (bug 827976) Backed out changeset f976c2d4cebb (bug 827976) Backed out changeset 66cffb171024 (bug 827976) Backed out changeset 845e1d0b2402 (bug 827976) Backed out changeset fd94066a1d76 (bug 827976) Backed out changeset e253b264e7bd (bug 827976) Backed out changeset 07ef335770a8 (bug 827976) Backed out changeset 9d3805d77b99 (bug 827976) Backed out changeset eed600ceb606 (bug 827976) Backed out changeset 3b64368cff52 (bug 827976) Backed out changeset 69d0378e0c09 (bug 827976) Backed out changeset 9203871a5c6f (bug 827976) Backed out changeset 96a507c818e2 (bug 827976) Backed out changeset e254496ff95b (bug 827976)

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 nsXBLDocumentInfo_h__
#define nsXBLDocumentInfo_h__

#include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsWeakReference.h"
#include "mozilla/dom/Document.h"
#include "nsCycleCollectionParticipant.h"

class nsXBLPrototypeBinding;

class nsXBLDocumentInfo final : public nsSupportsWeakReference {

  explicit nsXBLDocumentInfo(mozilla::dom::Document* aDocument);

  mozilla::dom::Document* GetDocument() const { return mDocument; }

  bool GetScriptAccess() const { return mScriptAccess; }

  nsIURI* DocumentURI() { return mDocument->GetDocumentURI(); }

  nsXBLPrototypeBinding* GetPrototypeBinding(const nsACString& aRef);
  nsresult SetPrototypeBinding(const nsACString& aRef,
                               nsXBLPrototypeBinding* aBinding);

  // This removes the binding without deleting it
  void RemovePrototypeBinding(const nsACString& aRef);

  nsresult WritePrototypeBindings();

  void SetFirstPrototypeBinding(nsXBLPrototypeBinding* aBinding);

  void FlushSkinStylesheets();

  bool IsChrome() { return mIsChrome; }

  void MarkInCCGeneration(uint32_t aGeneration);

  static nsresult ReadPrototypeBindings(nsIURI* aURI,
                                        nsXBLDocumentInfo** aDocInfo,
                                        mozilla::dom::Document* aBoundDocument);

  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;


  virtual ~nsXBLDocumentInfo();

  RefPtr<mozilla::dom::Document> mDocument;
  bool mScriptAccess;
  bool mIsChrome;
  // the binding table owns each nsXBLPrototypeBinding
  nsAutoPtr<nsClassHashtable<nsCStringHashKey, nsXBLPrototypeBinding>>

  // non-owning pointer to the first binding in the table
  nsXBLPrototypeBinding* mFirstBinding;

#ifdef DEBUG
void AssertInCompilationScope();
inline void AssertInCompilationScope() {}