tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

JSWindowActorParent.h (1925B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef mozilla_dom_JSWindowActorParent_h
      8 #define mozilla_dom_JSWindowActorParent_h
      9 
     10 #include "js/TypeDecls.h"
     11 #include "mozilla/dom/BindingDeclarations.h"
     12 #include "mozilla/dom/ContentParent.h"
     13 #include "mozilla/dom/JSActor.h"
     14 #include "nsCycleCollectionParticipant.h"
     15 #include "nsWrapperCache.h"
     16 
     17 namespace mozilla {
     18 class ErrorResult;
     19 
     20 namespace dom {
     21 
     22 class WindowGlobalParent;
     23 
     24 }  // namespace dom
     25 }  // namespace mozilla
     26 
     27 namespace mozilla::dom {
     28 
     29 class JSWindowActorParent final : public JSActor {
     30 public:
     31  NS_DECL_ISUPPORTS_INHERITED
     32  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(JSWindowActorParent, JSActor)
     33 
     34  explicit JSWindowActorParent(nsISupports* aGlobal = nullptr)
     35      : JSActor(aGlobal) {}
     36 
     37  JSObject* WrapObject(JSContext* aCx,
     38                       JS::Handle<JSObject*> aGivenProto) override;
     39 
     40  static already_AddRefed<JSWindowActorParent> Constructor(
     41      GlobalObject& aGlobal) {
     42    return MakeAndAddRef<JSWindowActorParent>(aGlobal.GetAsSupports());
     43  }
     44 
     45  WindowGlobalParent* GetManager() const;
     46  WindowContext* GetWindowContext() const;
     47  void Init(const nsACString& aName, WindowGlobalParent* aManager);
     48  void ClearManager() override;
     49  CanonicalBrowsingContext* GetBrowsingContext(ErrorResult& aRv);
     50 
     51 protected:
     52  void SendRawMessage(const JSActorMessageMeta& aMeta, JSIPCValue&& aData,
     53                      UniquePtr<ipc::StructuredCloneData> aStack,
     54                      ErrorResult& aRv) override;
     55 
     56 private:
     57  ~JSWindowActorParent();
     58 
     59  RefPtr<WindowGlobalParent> mManager;
     60 };
     61 
     62 }  // namespace mozilla::dom
     63 
     64 #endif  // mozilla_dom_JSWindowActorParent_h