summaryrefslogtreecommitdiffstats
path: root/js/xpconnect/tests/idl
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/xpconnect/tests/idl
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/xpconnect/tests/idl')
-rw-r--r--js/xpconnect/tests/idl/moz.build25
-rw-r--r--js/xpconnect/tests/idl/xpctest_attributes.idl33
-rw-r--r--js/xpconnect/tests/idl/xpctest_bug809674.idl18
-rw-r--r--js/xpconnect/tests/idl/xpctest_interfaces.idl27
-rw-r--r--js/xpconnect/tests/idl/xpctest_params.idl90
-rw-r--r--js/xpconnect/tests/idl/xpctest_returncode.idl45
-rw-r--r--js/xpconnect/tests/idl/xpctest_utils.idl19
7 files changed, 257 insertions, 0 deletions
diff --git a/js/xpconnect/tests/idl/moz.build b/js/xpconnect/tests/idl/moz.build
new file mode 100644
index 000000000..7ed9954b5
--- /dev/null
+++ b/js/xpconnect/tests/idl/moz.build
@@ -0,0 +1,25 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+XPIDL_SOURCES += [
+ 'xpctest_attributes.idl',
+ 'xpctest_bug809674.idl',
+ 'xpctest_interfaces.idl',
+ 'xpctest_params.idl',
+ 'xpctest_returncode.idl',
+ 'xpctest_utils.idl',
+]
+
+XPIDL_MODULE = 'xpctest'
+
+# XXX: This relies on xpctest.xpt being created in dist/bin/components/ during
+# the export tier AND TEST_HARNESS_FILES being processed after that.
+TEST_HARNESS_FILES.xpcshell.js.xpconnect.tests.components.native.components += [
+ '!/dist/bin/components/xpctest.xpt',
+]
+TEST_HARNESS_FILES.xpcshell.js.xpconnect.tests.components.js += [
+ '!/dist/bin/components/xpctest.xpt',
+]
diff --git a/js/xpconnect/tests/idl/xpctest_attributes.idl b/js/xpconnect/tests/idl/xpctest_attributes.idl
new file mode 100644
index 000000000..cbecaa08e
--- /dev/null
+++ b/js/xpconnect/tests/idl/xpctest_attributes.idl
@@ -0,0 +1,33 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * 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/. */
+
+#include "nsISupports.idl"
+/*
+ * This defines the interface for a test object.
+ *
+ */
+
+[scriptable, uuid(42fbd9f6-b12d-47ef-b7a1-02d73c11fe53)]
+interface nsIXPCTestObjectReadOnly : nsISupports {
+ readonly attribute string strReadOnly;
+ readonly attribute boolean boolReadOnly;
+ readonly attribute short shortReadOnly;
+ readonly attribute long longReadOnly;
+ readonly attribute float floatReadOnly;
+ readonly attribute char charReadOnly;
+ readonly attribute PRTime timeReadOnly;
+};
+
+[scriptable, uuid(f07529b0-a479-4954-aba5-ab3142c6b1cb)]
+interface nsIXPCTestObjectReadWrite : nsISupports {
+ attribute string stringProperty;
+ attribute boolean booleanProperty;
+ attribute short shortProperty;
+ attribute long longProperty;
+ attribute float floatProperty;
+ attribute char charProperty;
+ attribute PRTime timeProperty;
+};
diff --git a/js/xpconnect/tests/idl/xpctest_bug809674.idl b/js/xpconnect/tests/idl/xpctest_bug809674.idl
new file mode 100644
index 000000000..c276f027f
--- /dev/null
+++ b/js/xpconnect/tests/idl/xpctest_bug809674.idl
@@ -0,0 +1,18 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * 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/. */
+
+#include "nsISupports.idl"
+/*
+ * Test interface for https://bugzilla.mozilla.org/show_bug.cgi?id=809674 .
+ *
+ * This test makes sure that accessing an attribute marked with
+ * [implicit_jscontext] will throw without crashing.
+ */
+
+[scriptable, uuid(2df46559-da21-49bf-b863-0d7b7bbcbc73)]
+interface nsIXPCTestBug809674 : nsISupports {
+ [implicit_jscontext] attribute jsval jsvalProperty;
+};
diff --git a/js/xpconnect/tests/idl/xpctest_interfaces.idl b/js/xpconnect/tests/idl/xpctest_interfaces.idl
new file mode 100644
index 000000000..2abc14962
--- /dev/null
+++ b/js/xpconnect/tests/idl/xpctest_interfaces.idl
@@ -0,0 +1,27 @@
+/* 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/. */
+
+/**
+ * Very simple test interfaces.
+ *
+ * This is used by the other test functionality when it needs to play around with
+ * interface pointers.
+ */
+
+#include "nsISupports.idl"
+
+[scriptable, uuid(3c8fd2f5-970c-42c6-b5dd-cda1c16dcfd8)]
+interface nsIXPCTestInterfaceA : nsISupports {
+ attribute string name;
+};
+
+[scriptable, uuid(ff528c3a-2410-46de-acaa-449aa6403a33)]
+interface nsIXPCTestInterfaceB : nsISupports {
+ attribute string name;
+};
+
+[scriptable, uuid(401cf1b4-355b-4cee-b7b3-c7973aee49bd)]
+interface nsIXPCTestInterfaceC : nsISupports {
+ attribute long someInteger;
+};
diff --git a/js/xpconnect/tests/idl/xpctest_params.idl b/js/xpconnect/tests/idl/xpctest_params.idl
new file mode 100644
index 000000000..f324a4595
--- /dev/null
+++ b/js/xpconnect/tests/idl/xpctest_params.idl
@@ -0,0 +1,90 @@
+/* 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/. */
+
+/**
+ * Test pararameter passing and argument conversion.
+ *
+ * Each test method returns the value in 'b', and copies 'a' into 'b'. This lets
+ * us test return values, in params, and inout params (out params should be
+ * covered by the intersection of return values and inout).
+ */
+
+#include "nsISupports.idl"
+
+interface nsIXPCTestInterfaceA;
+interface nsIXPCTestInterfaceB;
+
+[scriptable, uuid(812145c7-9fcc-425e-a878-36ad1b7730b7)]
+interface nsIXPCTestParams : nsISupports {
+
+ // These types correspond to the ones in typelib.py
+ boolean testBoolean(in boolean a, inout boolean b);
+ octet testOctet(in octet a, inout octet b);
+ short testShort(in short a, inout short b);
+ long testLong(in long a, inout long b);
+ long long testLongLong(in long long a, inout long long b);
+ unsigned short testUnsignedShort(in unsigned short a, inout unsigned short b);
+ unsigned long testUnsignedLong(in unsigned long a, inout unsigned long b);
+ unsigned long long testUnsignedLongLong(in unsigned long long a, inout unsigned long long b);
+ float testFloat(in float a, inout float b);
+ double testDouble(in double a, inout float b);
+ char testChar(in char a, inout char b);
+ string testString(in string a, inout string b);
+ wchar testWchar(in wchar a, inout wchar b);
+ wstring testWstring(in wstring a, inout wstring b);
+ DOMString testDOMString(in DOMString a, inout DOMString b);
+ AString testAString(in AString a, inout AString b);
+ AUTF8String testAUTF8String(in AUTF8String a, inout AUTF8String b);
+ ACString testACString(in ACString a, inout ACString b);
+ jsval testJsval(in jsval a, inout jsval b);
+
+ //
+ // Dependent parameters use the same types as above, but are handled much differently.
+ //
+
+ // Test arrays.
+ void testShortArray(in unsigned long aLength, [array, size_is(aLength)] in short a,
+ inout unsigned long bLength, [array, size_is(bLength)] inout short b,
+ out unsigned long rvLength, [retval, array, size_is(rvLength)] out short rv);
+ void testDoubleArray(in unsigned long aLength, [array, size_is(aLength)] in double a,
+ inout unsigned long bLength, [array, size_is(bLength)] inout double b,
+ out unsigned long rvLength, [retval, array, size_is(rvLength)] out double rv);
+ void testStringArray(in unsigned long aLength, [array, size_is(aLength)] in string a,
+ inout unsigned long bLength, [array, size_is(bLength)] inout string b,
+ out unsigned long rvLength, [retval, array, size_is(rvLength)] out string rv);
+ void testWstringArray(in unsigned long aLength, [array, size_is(aLength)] in wstring a,
+ inout unsigned long bLength, [array, size_is(bLength)] inout wstring b,
+ out unsigned long rvLength, [retval, array, size_is(rvLength)] out wstring rv);
+ void testInterfaceArray(in unsigned long aLength, [array, size_is(aLength)] in nsIXPCTestInterfaceA a,
+ inout unsigned long bLength, [array, size_is(bLength)] inout nsIXPCTestInterfaceA b,
+ out unsigned long rvLength, [retval, array, size_is(rvLength)] out nsIXPCTestInterfaceA rv);
+
+ // Test sized strings.
+ void testSizedString(in unsigned long aLength, [size_is(aLength)] in string a,
+ inout unsigned long bLength, [size_is(bLength)] inout string b,
+ out unsigned long rvLength, [retval, size_is(rvLength)] out string rv);
+ void testSizedWstring(in unsigned long aLength, [size_is(aLength)] in wstring a,
+ inout unsigned long bLength, [size_is(bLength)] inout wstring b,
+ out unsigned long rvLength, [retval, size_is(rvLength)] out wstring rv);
+
+ // Test iid_is.
+ void testInterfaceIs(in nsIIDPtr aIID, [iid_is(aIID)] in nsQIResult a,
+ inout nsIIDPtr bIID, [iid_is(bIID)] inout nsQIResult b,
+ out nsIIDPtr rvIID, [retval, iid_is(rvIID)] out nsQIResult rv);
+
+ // Test arrays of iid_is. According to khuey we don't use it for anything
+ // in mozilla-central, but calendar stuff depends on it.
+ void testInterfaceIsArray(in unsigned long aLength, in nsIIDPtr aIID,
+ [array, size_is(aLength), iid_is(aIID)] in nsQIResult a,
+ inout unsigned long bLength, inout nsIIDPtr bIID,
+ [array, size_is(bLength), iid_is(bIID)] inout nsQIResult b,
+ out unsigned long rvLength, out nsIIDPtr rvIID,
+ [retval, array, size_is(rvLength), iid_is(rvIID)] out nsQIResult rv);
+
+ // Test for out dipper parameters
+ void testOutAString(out AString o);
+
+ // Test for optional array size_is.
+ ACString testStringArrayOptionalSize([array, size_is(aLength)] in string a, [optional] in unsigned long aLength);
+};
diff --git a/js/xpconnect/tests/idl/xpctest_returncode.idl b/js/xpconnect/tests/idl/xpctest_returncode.idl
new file mode 100644
index 000000000..d6555b9e2
--- /dev/null
+++ b/js/xpconnect/tests/idl/xpctest_returncode.idl
@@ -0,0 +1,45 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * 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/. */
+
+/**
+ * Test the use of Components.returnCode
+ *
+ * This ("parent") interface defines a method that in-turn calls another
+ * ("child") interface implemented in JS, and returns the nsresult from that
+ * child interface. The child interface manages the return code by way of
+ * Components.returnCode.
+ */
+
+#include "nsISupports.idl"
+
+
+[scriptable, uuid(479e4532-95cf-48b8-a99b-8a5881e47138)]
+interface nsIXPCTestReturnCodeParent : nsISupports {
+ // Calls the "child" interface with the specified behavior flag. Returns
+ // the NSRESULT from the child interface.
+ nsresult callChild(in long childBehavior);
+};
+
+[scriptable, uuid(672cfd34-1fd1-455d-9901-d879fa6fdb95)]
+interface nsIXPCTestReturnCodeChild : nsISupports {
+ void doIt(in long behavior);
+
+ // Flags to control that the child does.
+ // child will throw a JS exception
+ const long CHILD_SHOULD_THROW = 0;
+
+ // child will just return normally
+ const long CHILD_SHOULD_RETURN_SUCCESS = 1;
+
+ // child will return after setting Components.returnCode to NS_ERROR_FAILURE
+ const long CHILD_SHOULD_RETURN_RESULTCODE = 2;
+
+ // child will set Components.returnCode to NS_ERROR_UNEXPECTED, then create
+ // a new component that sets Components.returnCode to NS_ERROR_FAILURE.
+ // Our caller should see the NS_ERROR_UNEXPECTED we set rather than the
+ // value set later by the "inner" child.
+ const long CHILD_SHOULD_NEST_RESULTCODES = 3;
+};
diff --git a/js/xpconnect/tests/idl/xpctest_utils.idl b/js/xpconnect/tests/idl/xpctest_utils.idl
new file mode 100644
index 000000000..e59814272
--- /dev/null
+++ b/js/xpconnect/tests/idl/xpctest_utils.idl
@@ -0,0 +1,19 @@
+/* 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/. */
+
+/**
+ * Utility interfaces for testing.
+ */
+
+#include "nsISupports.idl"
+
+[scriptable, function, uuid(d58a82ab-d8f7-4ca9-9273-b3290d42a0cf)]
+interface nsIXPCTestFunctionInterface : nsISupports {
+ string echo(in string arg);
+};
+
+[scriptable, uuid(1e9cddeb-510d-449a-b152-3c1b5b31d41d)]
+interface nsIXPCTestUtils : nsISupports {
+ nsIXPCTestFunctionInterface doubleWrapFunction(in nsIXPCTestFunctionInterface f);
+};