Update Closure compiler to v20190729

The new compiler caught a lot of pre-existing issues in the codebase.
Sadly, the old compiler version was not smart enough to understand the
new changes. Therefore, the changes have be included in the same CL as
the compiler update.

Most of the changes are related to better handling of prototype and
class inheritance, as well as handling of null/undefined tracking.

Change-Id: I3941a3a240a4d09c4945e1e20d2521090ef837c9
Bug: 991710
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1762081
Reviewed-by: Yang Guo <[email protected]>
Commit-Queue: Tim van der Lippe <[email protected]>
Auto-Submit: Tim van der Lippe <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#696761}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: ca93474213278e32e36d6ace1474c56884030757
diff --git a/front_end/extensions/ExtensionAPI.js b/front_end/extensions/ExtensionAPI.js
index 0d3b2ad..367c428 100644
--- a/front_end/extensions/ExtensionAPI.js
+++ b/front_end/extensions/ExtensionAPI.js
@@ -240,7 +240,7 @@
       return panels[name];
     }
     for (const panel in panels)
-      this.__defineGetter__(panel, panelGetter.bind(null, panel));
+      Object.defineProperty(this, panel, {get: panelGetter.bind(null, panel), enumerable: true});
     this.applyStyleSheet = function(styleSheet) {
       extensionServer.sendRequest({command: commands.ApplyStyleSheet, styleSheet: styleSheet});
     };
@@ -361,31 +361,27 @@
   const EventSink = declareInterfaceClass(EventSinkImpl);
   const ExtensionPanel = declareInterfaceClass(ExtensionPanelImpl);
   const ExtensionSidebarPane = declareInterfaceClass(ExtensionSidebarPaneImpl);
-  const PanelWithSidebar = declareInterfaceClass(PanelWithSidebarImpl);
+  /**
+   * @constructor
+   * @param {string} hostPanelName
+   */
+  const PanelWithSidebarClass = declareInterfaceClass(PanelWithSidebarImpl);
   const Request = declareInterfaceClass(RequestImpl);
   const Resource = declareInterfaceClass(ResourceImpl);
   const TraceSession = declareInterfaceClass(TraceSessionImpl);
 
-  /**
-   * @constructor
-   * @extends {PanelWithSidebar}
-   */
-  function ElementsPanel() {
-    PanelWithSidebar.call(this, 'elements');
+  class ElementsPanel extends PanelWithSidebarClass {
+    constructor() {
+      super('elements');
+    }
   }
 
-  ElementsPanel.prototype = {__proto__: PanelWithSidebar.prototype};
-
-  /**
-   * @constructor
-   * @extends {PanelWithSidebar}
-   */
-  function SourcesPanel() {
-    PanelWithSidebar.call(this, 'sources');
+  class SourcesPanel extends PanelWithSidebarClass {
+    constructor() {
+      super('sources');
+    }
   }
 
-  SourcesPanel.prototype = {__proto__: PanelWithSidebar.prototype};
-
   /**
    * @constructor
    * @extends {ExtensionViewImpl}
@@ -779,7 +775,7 @@
 
   // Only expose tabId on chrome.devtools.inspectedWindow, not webInspector.inspectedWindow.
   chrome.devtools.inspectedWindow = {};
-  chrome.devtools.inspectedWindow.__defineGetter__('tabId', getTabId);
+  Object.defineProperty(chrome.devtools.inspectedWindow, 'tabId', {get: getTabId});
   chrome.devtools.inspectedWindow.__proto__ = coreAPI.inspectedWindow;
   chrome.devtools.network = coreAPI.network;
   chrome.devtools.panels = coreAPI.panels;