Bug 1370368 - Fix some JSDocs
(not related to the bug, should have been part of
bug 1356546)
MozReview-Commit-ID: GKAFfdpknt4
--- a/toolkit/components/extensions/ExtensionChild.jsm
+++ b/toolkit/components/extensions/ExtensionChild.jsm
@@ -225,18 +225,19 @@ class Port {
}
/**
* Register a callback that is called when the port is disconnected by the
* *other* end. The callback is automatically unregistered when the port or
* context is closed.
*
* @param {function} callback Called when the other end disconnects the port.
- * If the disconnect is caused by an error, the first parameter is an
- * object with a "message" string property that describes the cause.
+ * If the disconnect is caused by an error, the first parameter is a
+ * StructuredCloneHolder, which holds an object with a "message"
+ * string property that describes the cause.
* @returns {function} Function to unregister the listener.
*/
registerOnDisconnect(callback) {
let listener = error => {
if (this.context.active) {
callback(error);
}
};
@@ -324,18 +325,18 @@ class Port {
}
this.context.forgetOnClose(this);
this.disconnected = true;
}
/**
* Disconnect the port from the other end (which may not even exist).
*
- * @param {Error|{message: string}} [error] The reason for disconnecting,
- * if it is an abnormal disconnect.
+ * @param {StructuredCloneHolder<Error|{message: string}>} [error]
+ * The reason for disconnecting, if it is an abnormal disconnect.
*/
disconnectByOtherEnd(error = null) {
if (this.disconnected) {
return;
}
for (let listener of this.disconnectListeners) {
listener(error);
@@ -344,17 +345,17 @@ class Port {
this.handleDisconnection();
}
/**
* Disconnect the port from this end.
*
* @param {Error|{message: string}} [error] The reason for disconnecting,
- * if it is an abnormal disconnect.
+ * if it is an abnormal disconnect.
* @param {boolean} [keepDisconnectListener] Whether to keep the onDisconnect
* listeners, so that they can be called later.
*/
disconnect(error = null, keepDisconnectListener = false) {
if (!keepDisconnectListener) {
this.disconnectListeners.clear();
}
if (this.disconnected) {