Bug 1368695 - don't emit event when tooltip already destroyed; r=jdescottes
authorTom Tromey <tom@tromey.com>
Tue, 30 May 2017 08:08:18 -0600
changeset 361833 21e673ba5a1669277b4d2752d20b8d220260e1ff
parent 361832 a3bdbdd4d95a22b3cdc190d2a62ac3cdcc2addde
child 361834 e603b83ca39530ab7eccb6f2e999905ecb209e1a
push id31945
push userryanvm@gmail.com
push dateThu, 01 Jun 2017 20:42:17 +0000
treeherdermozilla-central@15e32469eb04 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1368695
milestone55.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 1368695 - don't emit event when tooltip already destroyed; r=jdescottes If a reply comes from source-map-url-service but the tooltip has already been destroyed, don't try to emit the event-tooltip-source-map-ready event. MozReview-Commit-ID: EKrT7V4qLJq
devtools/client/shared/widgets/tooltip/EventTooltipHelper.js
--- a/devtools/client/shared/widgets/tooltip/EventTooltipHelper.js
+++ b/devtools/client/shared/widgets/tooltip/EventTooltipHelper.js
@@ -106,26 +106,30 @@ EventTooltip.prototype = {
       if (listener.hide.filename) {
         text = L10N.getStr("eventsTooltip.unknownLocation");
         title = L10N.getStr("eventsTooltip.unknownLocationExplanation");
       } else if (sourceMapService) {
         const location = this._parseLocation(text);
         if (location) {
           sourceMapService.originalPositionFor(location.url, location.line)
             .then((originalLocation) => {
-              if (originalLocation) {
-                const { sourceUrl, line } = originalLocation;
-                let newURI = sourceUrl + ":" + line;
-                filename.textContent = newURI;
-                filename.setAttribute("title", newURI);
-                let eventEditor = this._eventEditors.get(content);
-                eventEditor.uri = newURI;
+              // Do nothing if the tooltip was destroyed while we were
+              // waiting for a response.
+              if (this._tooltip) {
+                if (originalLocation) {
+                  const { sourceUrl, line } = originalLocation;
+                  let newURI = sourceUrl + ":" + line;
+                  filename.textContent = newURI;
+                  filename.setAttribute("title", newURI);
+                  let eventEditor = this._eventEditors.get(content);
+                  eventEditor.uri = newURI;
+                }
+                // This is emitted for testing.
+                this._tooltip.emit("event-tooltip-source-map-ready");
               }
-              // This is emitted for testing.
-              this._tooltip.emit("event-tooltip-source-map-ready");
             });
         }
       }
 
       filename.textContent = text;
       filename.setAttribute("title", title);
       header.appendChild(filename);