Bug 1623350 - Convert exited response to an error. r=jdescottes
authorAlexandre Poirot <poirot.alex@gmail.com>
Thu, 19 Mar 2020 15:08:07 +0000
changeset 519687 9c4b273fd66d2f1e311ea039ec4481a734b08b48
parent 519686 ff6cd60c7a6b3c223728404603b03b53cfe81d12
child 519688 e0f4381591e1496db9e445642d42445b3f5cf356
push id37232
push usercsabou@mozilla.com
push dateFri, 20 Mar 2020 09:53:53 +0000
treeherdermozilla-central@32d6a3f1f83c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1623350
milestone76.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1623350 - Convert exited response to an error. r=jdescottes Differential Revision: https://phabricator.services.mozilla.com/D67456
devtools/docs/backend/protocol.md
devtools/server/actors/targets/browsing-context.js
--- a/devtools/docs/backend/protocol.md
+++ b/devtools/docs/backend/protocol.md
@@ -667,17 +667,17 @@ The target actor replies:
 { "from":<targetActor>, "threadActor":<tabThreadActor> }
 ```
 
 where *tabThreadActor* is the name of a thread-like actor representing the tab's current content. If the user navigates the tab, *tabThreadActor* switches to the new content; we do not create a separate thread-like actor each page the tab visits.
 
 If the user closes the tab before the client attaches to it, *targetActor* replies:
 
 ```
-{ "from":<targetActor>, "type":"exited" }
+{ "from":<targetActor>, "error":"exited" }
 ```
 
 When the client is no longer interested in interacting with the tab, the client can request:
 
 ```
 { "to":<targetActor>, "type":"detach" }
 ```
 
--- a/devtools/server/actors/targets/browsing-context.js
+++ b/devtools/server/actors/targets/browsing-context.js
@@ -1,16 +1,20 @@
 /* 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/. */
 
 "use strict";
 
 /* global XPCNativeWrapper */
 
+// protocol.js uses objects as exceptions in order to define
+// error packets.
+/* eslint-disable no-throw-literal */
+
 /*
  * BrowsingContextTargetActor is an abstract class used by target actors that hold
  * documents, such as frames, chrome windows, etc.
  *
  * This class is extended by FrameTargetActor, ParentProcessTargetActor, and
  * ChromeWindowTargetActor.
  *
  * See devtools/docs/backend/actor-hierarchy.md for more details.
@@ -983,17 +987,19 @@ const browsingContextTargetPrototype = {
 
     return true;
   },
 
   // Protocol Request Handlers
 
   attach(request) {
     if (this.exited) {
-      return { type: "exited" };
+      throw {
+        error: "exited",
+      };
     }
 
     this._attach();
 
     return {
       threadActor: this.threadActor.actorID,
       cacheDisabled: this._getCacheDisabled(),
       javascriptEnabled: this._getJavascriptEnabled(),