TestInterfaceJS.webidl (3223B)
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/. 5 */ 6 7 dictionary TestInterfaceJSUnionableDictionary { 8 object objectMember; 9 any anyMember; 10 }; 11 12 [JSImplementation="@mozilla.org/dom/test-interface-js;1", 13 Pref="dom.expose_test_interfaces", 14 Exposed=Window] 15 interface TestInterfaceJS : EventTarget { 16 [Throws] 17 constructor(optional any anyArg, optional object objectArg, 18 optional TestInterfaceJSDictionary dictionaryArg = {}); 19 20 readonly attribute any anyArg; 21 readonly attribute object objectArg; 22 TestInterfaceJSDictionary getDictionaryArg(); 23 attribute any anyAttr; 24 attribute object objectAttr; 25 TestInterfaceJSDictionary getDictionaryAttr(); 26 undefined setDictionaryAttr(optional TestInterfaceJSDictionary dict = {}); 27 any pingPongAny(any arg); 28 object pingPongObject(object obj); 29 any pingPongObjectOrString((object or DOMString) objOrString); 30 TestInterfaceJSDictionary pingPongDictionary(optional TestInterfaceJSDictionary dict = {}); 31 long pingPongDictionaryOrLong(optional (TestInterfaceJSUnionableDictionary or long) dictOrLong = {}); 32 DOMString pingPongRecord(record<DOMString, any> rec); 33 long objectSequenceLength(sequence<object> seq); 34 long anySequenceLength(sequence<any> seq); 35 36 // For testing bug 968335. 37 DOMString getCallerPrincipal(); 38 39 DOMString convertSVS(USVString svs); 40 41 (TestInterfaceJS or long) pingPongUnion((TestInterfaceJS or long) something); 42 (DOMString or TestInterfaceJS?) pingPongUnionContainingNull((TestInterfaceJS? or DOMString) something); 43 (TestInterfaceJS or long)? pingPongNullableUnion((TestInterfaceJS or long)? something); 44 (Location or TestInterfaceJS) returnBadUnion(); 45 46 // Test for sequence overloading and union behavior 47 undefined testSequenceOverload(sequence<DOMString> arg); 48 undefined testSequenceOverload(DOMString arg); 49 50 undefined testSequenceUnion((sequence<DOMString> or DOMString) arg); 51 52 // Tests for exception-throwing behavior 53 [Throws] 54 undefined testThrowError(); 55 56 [Throws] 57 undefined testThrowDOMException(); 58 59 [Throws] 60 undefined testThrowTypeError(); 61 62 [Throws] 63 undefined testThrowCallbackError(Function callback); 64 65 [Throws] 66 undefined testThrowXraySelfHosted(); 67 68 [Throws] 69 undefined testThrowSelfHosted(); 70 71 // Tests for promise-rejection behavior 72 Promise<undefined> testPromiseWithThrowingChromePromiseInit(); 73 Promise<undefined> testPromiseWithThrowingContentPromiseInit(Function func); 74 Promise<undefined> testPromiseWithDOMExceptionThrowingPromiseInit(); 75 Promise<undefined> testPromiseWithThrowingChromeThenFunction(); 76 Promise<undefined> testPromiseWithThrowingContentThenFunction(AnyCallback func); 77 Promise<undefined> testPromiseWithDOMExceptionThrowingThenFunction(); 78 Promise<undefined> testPromiseWithThrowingChromeThenable(); 79 Promise<undefined> testPromiseWithThrowingContentThenable(object thenable); 80 Promise<undefined> testPromiseWithDOMExceptionThrowingThenable(); 81 82 // Event handler tests 83 attribute EventHandler onsomething; 84 };