summaryrefslogtreecommitdiffstats
path: root/js/xpconnect/idl/nsIAddonInterposition.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/idl/nsIAddonInterposition.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/idl/nsIAddonInterposition.idl')
-rw-r--r--js/xpconnect/idl/nsIAddonInterposition.idl67
1 files changed, 67 insertions, 0 deletions
diff --git a/js/xpconnect/idl/nsIAddonInterposition.idl b/js/xpconnect/idl/nsIAddonInterposition.idl
new file mode 100644
index 000000000..1d1166ef2
--- /dev/null
+++ b/js/xpconnect/idl/nsIAddonInterposition.idl
@@ -0,0 +1,67 @@
+/* -*- 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 interface allows Firefox to expose different implementations of its own
+ * classes to add-ons. Once an interposition is created, it must be assigned to
+ * an add-on using Cu.setAddonInterposition (JS) or xpc::SetAddonInterposition
+ * (C++). In both cases, the arguments should be the add-on ID and the
+ * interposition object (which must be an nsIAddonInterposition). This must
+ * happen before any compartments are created for the given add-on.
+ *
+ * Every time the add-on accesses a property on any object outside its own set
+ * of compartments, XPConnect will call the interposition's
+ * interpose method. If the interposition wants to replace the given
+ * property, it should return a replacement property descriptor for it. If not,
+ * it should return null.
+ */
+[scriptable,uuid(d05cc5fd-ad88-41a6-854c-36fd94d69ddb)]
+interface nsIAddonInterposition : nsISupports
+{
+ /**
+ * Returns a replacement property descriptor for a browser object.
+ *
+ * @param addonId The ID of the add-on accessing the property.
+ * @param target The browser object being accessed.
+ * @param iface The IID of the interface the property is associated with. This
+ * parameter is only available for XPCWrappedNative targets. As
+ * such, it's only useful as an optimization to avoid
+ * instanceof checks on the target.
+ * @param prop The name of the property being accessed.
+ * @return A property descriptor or null.
+ */
+ jsval interposeProperty(in jsval addonId,
+ in jsval target,
+ in nsIIDPtr iface,
+ in jsval prop);
+ /**
+ * We're intercepting calls from add-ons scopes into non-addon scopes.
+ *
+ * @param addonId The ID of the add-on accessing the property.
+ * @param originalFunc The function object being intercepted.
+ * @param originalThis The |this| value for the intercepted call.
+ * @param args The arguments of the original call in an array.
+ * @return The result of the call. NOTE: after the call interception,
+ * the original function will not be called automatically, so the
+ * implementer has to do that.
+ */
+ jsval interposeCall(in jsval addonId,
+ in jsval originalFunc,
+ in jsval originalThis,
+ in jsval args);
+
+ /**
+ * For the first time when the interposition is registered the engine
+ * calls getWhitelist and expects an array of strings. The strings are
+ * the name of properties the interposition wants interposeProperty
+ * to be called. It can be an empty array.
+ * Note: for CPOWs interposeProperty is always called regardless if
+ * the name of the property is on the whitelist or not.
+ */
+ jsval getWhitelist();
+};