Bug 1892041 - Part 1: Update test262 features. r=spidermonkey-reviewers,dminor
[gecko.git] / dom / events / ImageCaptureError.h
blob9c56c3f004da926c47b6da642a0ef35cc1f37e0e
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
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_ImageCaptureError_h
8 #define mozilla_dom_ImageCaptureError_h
10 #include "mozilla/Attributes.h"
11 #include "nsCOMPtr.h"
12 #include "nsString.h"
13 #include "nsWrapperCache.h"
15 namespace mozilla::dom {
17 /**
18 * This is the implementation of ImageCaptureError on W3C specification
19 * https://dvcs.w3.org/hg/dap/raw-file/default/media-stream-capture/ImageCapture.html#idl-def-ImageCaptureError.
20 * This object should be generated by ImageCapture object only.
22 class ImageCaptureError final : public nsISupports, public nsWrapperCache {
23 public:
24 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
25 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(ImageCaptureError)
27 ImageCaptureError(nsISupports* aParent, uint16_t aCode,
28 const nsAString& aMessage);
30 nsISupports* GetParentObject() const;
32 virtual JSObject* WrapObject(JSContext* aCx,
33 JS::Handle<JSObject*> aGivenProto) override;
35 uint16_t Code() const;
37 enum {
38 FRAME_GRAB_ERROR = 1,
39 SETTINGS_ERROR = 2,
40 PHOTO_ERROR = 3,
41 ERROR_UNKNOWN = 4,
44 void GetMessage(nsAString& retval) const;
46 private:
47 ~ImageCaptureError();
49 nsCOMPtr<nsISupports> mParent;
50 nsString mMessage;
51 uint16_t mCode;
54 } // namespace mozilla::dom
56 #endif // mozilla_dom_ImageCaptureError_h