Bug 1516408 - Throw explicit error when calling Target.forRemoteTab without activeTab;r=ochameau
authorJulian Descottes <jdescottes@mozilla.com>
Thu, 03 Jan 2019 10:19:21 +0000
changeset 509491 bcf03ee54991dbe752d3dbf4961a453a0f2d2186
parent 509490 6102219fb8f84277ba8366dbe6e4fa9f4e75786b
child 509492 1fd51b59372d5a5455fc4ecf2cc208e8ca254898
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1516408
milestone66.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 1516408 - Throw explicit error when calling Target.forRemoteTab without activeTab;r=ochameau Depends on D15305 Differential Revision: https://phabricator.services.mozilla.com/D15306
devtools/client/framework/target.js
--- a/devtools/client/framework/target.js
+++ b/devtools/client/framework/target.js
@@ -183,35 +183,36 @@ const TargetFactory = exports.TargetFact
  * A Target represents a debuggable context. It can be a browser tab, a tab on
  * a remote device, like a tab on Firefox for Android. But it can also be an add-on,
  * as well as firefox parent process, or just one of its content process.
  * A Target is related to a given TargetActor, for which we pass the form as
  * argument.
  *
  * For now, only workers are having a distinct Target class called WorkerTarget.
  *
- * @param {Object} form
- *                  The TargetActor's form to be connected to. Null if front is passed.
  * @param {Front} activeTab
- *                  If we already have a front for this target, pass it here. Null if
- *                  form is passed.
+ *                  If we already have a front for this target, pass it here.
  * @param {DebuggerClient} client
  *                  The DebuggerClient instance to be used to debug this target.
  * @param {Boolean} chrome
  *                  True, if we allow to see privileged resources like JSM, xpcom,
  *                  frame scripts...
  * @param {xul:tab} tab (optional)
  *                  If the target is a local Firefox tab, a reference to the firefox
  *                  frontend tab object.
  */
-function Target({ client, chrome, activeTab = null, tab = null }) {
+function Target({ activeTab, client, chrome, tab = null }) {
   EventEmitter.decorate(this);
   this.destroy = this.destroy.bind(this);
   this._onTabNavigated = this._onTabNavigated.bind(this);
   this.activeConsole = null;
+
+  if (!activeTab) {
+    throw new Error("Cannot instanciate target without a non-null activeTab");
+  }
   this.activeTab = activeTab;
 
   this._url = this.form.url;
   this._title = this.form.title;
 
   this._client = client;
   this._chrome = chrome;