Bug 1500374 - Show addon warnings using ErrorMessage;r=daisuke,ladybenko
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 18 Jan 2019 13:53:45 +0000
changeset 511548 1c06ef2cea48149efe62ce4e207c6fadded245fd
parent 511547 7aa26271b4c584966b70f16f395e98791211be7e
child 511549 76e2d626f740cbc368018aedd3ec4a2369d4c7e7
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)
reviewersdaisuke, ladybenko
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 - Show addon warnings using ErrorMessage;r=daisuke,ladybenko Depends on D16573 Differential Revision: https://phabricator.services.mozilla.com/D16574
devtools/client/aboutdebugging-new/src/components/debugtarget/ExtensionDetail.css
devtools/client/aboutdebugging-new/src/components/debugtarget/ExtensionDetail.js
devtools/client/aboutdebugging-new/src/middleware/extension-component-data.js
devtools/client/aboutdebugging-new/src/types/debug-target.js
--- a/devtools/client/aboutdebugging-new/src/components/debugtarget/ExtensionDetail.css
+++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/ExtensionDetail.css
@@ -18,8 +18,13 @@
   display: grid;
   grid-template-columns: auto 1fr;
   grid-column-gap: calc(var(--base-distance) * 2);
 }
 
 .extension-detail__manifest {
   margin-inline-start: 1ch;
 }
+
+.extension-details__warning {
+  /* reset for the default <p> styles */
+  margin: initial;
+}
--- a/devtools/client/aboutdebugging-new/src/components/debugtarget/ExtensionDetail.js
+++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/ExtensionDetail.js
@@ -7,31 +7,56 @@
 const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react");
 const dom = require("devtools/client/shared/vendor/react-dom-factories");
 const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
 
 const FluentReact = require("devtools/client/shared/vendor/fluent-react");
 const Localized = createFactory(FluentReact.Localized);
 
 const FieldPair = createFactory(require("./FieldPair"));
+const Message = createFactory(require("../shared/Message"));
 
+const { MESSAGE_LEVEL } = require("../../constants");
 const Types = require("../../types/index");
 
 /**
  * This component displays detail information for extension.
  */
 class ExtensionDetail extends PureComponent {
   static get propTypes() {
     return {
       // Provided by wrapping the component with FluentReact.withLocalization.
       getString: PropTypes.func.isRequired,
       target: Types.debugTarget.isRequired,
     };
   }
 
+  renderWarnings() {
+    const { warnings } = this.props.target.details;
+    return dom.section(
+      {
+        key: "extension-warnings",
+      },
+      warnings.map((warning, index) => {
+        return Message(
+          {
+            level: MESSAGE_LEVEL.WARNING,
+            key: `warning-${index}`,
+          },
+          dom.p(
+            {
+              className: "extension-details__warning technical-text",
+            },
+            warning
+          )
+        );
+      })
+    );
+  }
+
   renderUUID() {
     const { manifestURL, uuid } = this.props.target.details;
     if (!uuid) {
       return null;
     }
 
     const value = [
       uuid,
@@ -101,20 +126,24 @@ class ExtensionDetail extends PureCompon
           label: "Location",
           value: location,
         }
       )
     );
   }
 
   render() {
-    return dom.dl(
-      {
-        className: "extension-detail",
-      },
-      this.renderLocation(),
-      this.renderExtensionId(),
-      this.renderUUID(),
-    );
+    return [
+      this.renderWarnings(),
+      dom.dl(
+        {
+          key: "extension-detail",
+          className: "extension-detail",
+        },
+        this.renderLocation(),
+        this.renderExtensionId(),
+        this.renderUUID(),
+      ),
+    ];
   }
 }
 
 module.exports = FluentReact.withLocalization(ExtensionDetail);
--- a/devtools/client/aboutdebugging-new/src/middleware/extension-component-data.js
+++ b/devtools/client/aboutdebugging-new/src/middleware/extension-component-data.js
@@ -39,29 +39,30 @@ function getFilePath(extension) {
   }
 
   return parseFileUri(extension.url);
 }
 
 function toComponentData(extensions) {
   return extensions.map(extension => {
     const type = DEBUG_TARGETS.EXTENSION;
-    const { actor, iconDataURL, iconURL, id, manifestURL, name } = extension;
+    const { actor, iconDataURL, iconURL, id, manifestURL, name, warnings } = extension;
     const icon =
       iconDataURL || iconURL || "chrome://mozapps/skin/extensions/extensionGeneric.svg";
     const location = getFilePath(extension);
     const uuid = getExtensionUuid(extension);
     return {
       name,
       icon,
       id,
       type,
       details: {
         actor,
         location,
         manifestURL,
         uuid,
+        warnings: warnings || [],
       },
     };
   });
 }
 
 module.exports = extensionComponentDataMiddleware;
--- a/devtools/client/aboutdebugging-new/src/types/debug-target.js
+++ b/devtools/client/aboutdebugging-new/src/types/debug-target.js
@@ -10,16 +10,18 @@ const extensionTargetDetails = {
   // actor ID for this extention.
   actor: PropTypes.string.isRequired,
   location: PropTypes.string.isRequired,
   // manifestURL points to the manifest.json file. This URL is only valid when debugging
   // local extensions so it might be null.
   manifestURL: PropTypes.string,
   // unique extension id.
   uuid: PropTypes.string.isRequired,
+  // warning messages forwarded from the addon manager.
+  warnings: PropTypes.arrayOf(PropTypes.string).isRequired,
 };
 
 const tabTargetDetails = {
   // the url of the tab.
   url: PropTypes.string.isRequired,
 };
 
 const workerTargetDetails = {