Line data Source code
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/. */
6 :
7 : #ifndef mozilla_dom_TestFunctions_h
8 : #define mozilla_dom_TestFunctions_h
9 :
10 : #include "mozilla/ErrorResult.h"
11 : #include "mozilla/dom/BindingDeclarations.h"
12 : #include "mozilla/dom/NonRefcountedDOMObject.h"
13 : #include "nsString.h"
14 :
15 : namespace mozilla {
16 : namespace dom {
17 :
18 : class Promise;
19 : class PromiseReturner;
20 :
21 0 : class TestFunctions : public NonRefcountedDOMObject {
22 : public:
23 : static TestFunctions* Constructor(GlobalObject& aGlobal, ErrorResult& aRv);
24 :
25 : static void
26 : ThrowUncatchableException(GlobalObject& aGlobal, ErrorResult& aRv);
27 :
28 : static Promise*
29 : PassThroughPromise(GlobalObject& aGlobal, Promise& aPromise);
30 :
31 : static already_AddRefed<Promise>
32 : PassThroughCallbackPromise(GlobalObject& aGlobal,
33 : PromiseReturner& aCallback,
34 : ErrorResult& aRv);
35 :
36 : void SetStringData(const nsAString& aString);
37 :
38 : void GetStringDataAsAString(nsAString& aString);
39 : void GetStringDataAsAString(uint32_t aLength, nsAString& aString);
40 : void GetStringDataAsDOMString(const Optional<uint32_t>& aLength,
41 : DOMString& aString);
42 :
43 : bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
44 : JS::MutableHandle<JSObject*> aWrapper);
45 : private:
46 : nsString mStringData;
47 : };
48 :
49 : } // namespace dom
50 : } // namespace mozilla
51 :
52 : #endif // mozilla_dom_TestFunctions_h
|