2017-10-27 01:08:41 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2015-05-06 09:42:27 +03:00
|
|
|
/* 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 http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_TestInterfaceMaplikeObject_h
|
|
|
|
#define mozilla_dom_TestInterfaceMaplikeObject_h
|
|
|
|
|
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
class nsPIDOMWindowInner;
|
2015-05-06 09:42:27 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class ErrorResult;
|
|
|
|
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class GlobalObject;
|
|
|
|
|
|
|
|
// Implementation of test binding for webidl maplike interfaces, using
|
|
|
|
// primitives for key types and objects for value types.
|
|
|
|
class TestInterfaceMaplikeObject final : public nsISupports,
|
|
|
|
public nsWrapperCache {
|
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TestInterfaceMaplikeObject)
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
explicit TestInterfaceMaplikeObject(nsPIDOMWindowInner* aParent);
|
|
|
|
nsPIDOMWindowInner* GetParentObject() const;
|
2015-05-06 09:42:27 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
static already_AddRefed<TestInterfaceMaplikeObject> Constructor(
|
|
|
|
const GlobalObject& aGlobal, ErrorResult& rv);
|
|
|
|
|
|
|
|
// External access for testing internal convenience functions.
|
|
|
|
void SetInternal(const nsAString& aKey);
|
|
|
|
void ClearInternal();
|
|
|
|
bool DeleteInternal(const nsAString& aKey);
|
|
|
|
bool HasInternal(const nsAString& aKey);
|
2018-12-14 21:10:35 +03:00
|
|
|
|
2015-05-06 09:42:27 +03:00
|
|
|
private:
|
|
|
|
virtual ~TestInterfaceMaplikeObject() {}
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> mParent;
|
2015-05-06 09:42:27 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_TestInterfaceMaplikeObject_h
|