1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
7 // A dumping ground for random testing functions
9 callback PromiseReturner = Promise<any>();
11 [Pref="dom.expose_test_interfaces"]
12 interface WrapperCachedNonISupportsTestInterface {
15 [Pref="dom.expose_test_interfaces",
17 interface TestFunctions {
19 static void throwUncatchableException();
21 // Simply returns its argument. Can be used to test Promise
22 // argument processing behavior.
23 static Promise<any> passThroughPromise(Promise<any> arg);
25 // Returns whatever Promise the given PromiseReturner returned.
27 static Promise<any> passThroughCallbackPromise(PromiseReturner callback);
29 // Some basic tests for string binding round-tripping behavior.
30 void setStringData(DOMString arg);
32 // Get the string data, using an nsAString argument on the C++ side.
33 // This will just use Assign/operator=, whatever that does.
34 DOMString getStringDataAsAString();
36 // Get the string data, but only "length" chars of it, using an
37 // nsAString argument on the C++ side. This will always copy on the
39 DOMString getStringDataAsAString(unsigned long length);
41 // Get the string data, but only "length" chars of it, using a
42 // DOMString argument on the C++ side and trying to hand it
43 // stringbuffers. If length not passed, use our full length.
44 DOMString getStringDataAsDOMString(optional unsigned long length);
46 // Functions that just punch through to mozITestInterfaceJS.idl
48 void testThrowNsresult();
50 void testThrowNsresultFromNative();
52 // Throws an InvalidStateError to auto-create a rejected promise.
54 static Promise<any> throwToRejectPromise();
56 // Some attributes for the toJSON to work with.
57 readonly attribute long one;
58 [Func="mozilla::dom::TestFunctions::ObjectFromAboutBlank"]
59 readonly attribute long two;
61 // Testing for how default toJSON behaves.
62 [Default] object toJSON();
64 // This returns a wrappercached non-ISupports object. While this will always
65 // return the same object, no optimization attributes like [Pure] should be
66 // used here because the object should not be held alive from JS by the
67 // bindings. This is needed to test wrapper preservation for weak map keys.
69 readonly attribute WrapperCachedNonISupportsTestInterface wrapperCachedNonISupportsObject;