Bug 1660051 [wpt PR 25111] - Origin isolation: expand getter test coverage, a=testonly
[gecko.git] / dom / base / PlacesWeakCallbackWrapper.h
blobc399623fb395d64a57f80a98d5f992e88b96a84b
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_PlacesWeakCallbackWrapper_h
8 #define mozilla_dom_PlacesWeakCallbackWrapper_h
10 #include "mozilla/dom/PlacesObserversBinding.h"
11 #include "mozilla/ErrorResult.h"
12 #include "nsWrapperCache.h"
14 namespace mozilla {
15 namespace dom {
17 class PlacesWeakCallbackWrapper final : public nsWrapperCache,
18 public SupportsWeakPtr {
19 public:
20 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PlacesWeakCallbackWrapper)
21 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(PlacesWeakCallbackWrapper)
23 explicit PlacesWeakCallbackWrapper(nsISupports* aParent,
24 PlacesEventCallback& aCallback);
26 static already_AddRefed<PlacesWeakCallbackWrapper> Constructor(
27 const GlobalObject& aGlobal, PlacesEventCallback& aCallback);
29 nsISupports* GetParentObject() const;
31 JSObject* WrapObject(JSContext* aCx,
32 JS::Handle<JSObject*> aGivenProto) override;
34 protected:
35 friend class PlacesObservers;
36 ~PlacesWeakCallbackWrapper();
37 nsWeakPtr mParent;
38 RefPtr<PlacesEventCallback> mCallback;
41 } // namespace dom
42 } // namespace mozilla
44 #endif // mozilla_dom_PlacesWeakCallbackWrapper_h