Bug 1500374 - Move addon extension id rendering to dedicated method;r=daisuke
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 18 Jan 2019 13:48:12 +0000
changeset 454442 160cc7a53e2142dd5165c7ed5d28c2d224cf451c
parent 454441 e902aece9ed7f640a7be789ff2cb5ccdfa8a5719
child 454443 1a9e703e70d1ab05dc51605afaf44936c77d3568
push id35397
push useropoprus@mozilla.com
push dateSat, 19 Jan 2019 03:35:41 +0000
treeherdermozilla-central@57dc8bbbc38f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaisuke
bugs1500374
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 1500374 - Move addon extension id rendering to dedicated method;r=daisuke Not strictly needed but I think it makes the component easier to read Differential Revision: https://phabricator.services.mozilla.com/D16571
devtools/client/aboutdebugging-new/src/components/debugtarget/ExtensionDetail.js
--- a/devtools/client/aboutdebugging-new/src/components/debugtarget/ExtensionDetail.js
+++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/ExtensionDetail.js
@@ -23,18 +23,20 @@ class ExtensionDetail extends PureCompon
     return {
       // Provided by wrapping the component with FluentReact.withLocalization.
       getString: PropTypes.func.isRequired,
       target: Types.debugTarget.isRequired,
     };
   }
 
   renderUUID() {
-    const { target } = this.props;
-    const { manifestURL, uuid } = target.details;
+    const { manifestURL, uuid } = this.props.target.details;
+    if (!uuid) {
+      return null;
+    }
 
     const value = [
       uuid,
       Localized(
         {
           id: "about-debugging-extension-manifest-link",
           key: "manifest",
         },
@@ -59,18 +61,39 @@ class ExtensionDetail extends PureCompon
           slug: "uuid",
           label: "Internal UUID",
           value,
         }
       )
     );
   }
 
+  renderExtensionId() {
+    const { id } = this.props.target;
+
+    return Localized(
+      {
+        id: "about-debugging-extension-id",
+        attrs: { label: true },
+      },
+      FieldPair(
+        {
+          slug: "extension",
+          label: "Extension ID",
+          value: id,
+        }
+      )
+    );
+  }
+
   renderLocation() {
     const { location } = this.props.target.details;
+    if (!location) {
+      return null;
+    }
 
     return Localized(
       {
         id: "about-debugging-extension-location",
         attrs: { label: true },
       },
       FieldPair(
         {
@@ -78,36 +101,20 @@ class ExtensionDetail extends PureCompon
           label: "Location",
           value: location,
         }
       )
     );
   }
 
   render() {
-    const { target } = this.props;
-    const { id, details } = target;
-    const { location, uuid } = details;
-
     return dom.dl(
       {
         className: "extension-detail",
       },
-      location ? this.renderLocation() : null,
-      Localized(
-        {
-          id: "about-debugging-extension-id",
-          attrs: { label: true },
-        },
-        FieldPair(
-          {
-            slug: "extension",
-            label: "Extension ID",
-            value: id,
-          }
-        )
-      ),
-      uuid ? this.renderUUID() : null,
+      this.renderLocation(),
+      this.renderExtensionId(),
+      this.renderUUID(),
     );
   }
 }
 
 module.exports = FluentReact.withLocalization(ExtensionDetail);