From a1caccaabea5e69f1eba621f079c2eadc7681cdc Mon Sep 17 00:00:00 2001 From: Alexandre Poirot Date: Thu, 31 Jan 2019 18:30:17 +0000 Subject: [PATCH] Bug 1523943 - Cache SourceActor.url. r=jlast Depends on D18244 Differential Revision: https://phabricator.services.mozilla.com/D18245 --HG-- extra : moz-landing-system : lando --- devtools/server/actors/common.js | 4 +--- devtools/server/actors/source.js | 11 +++++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/devtools/server/actors/common.js b/devtools/server/actors/common.js index 89c6709dac08..d8d4390d5da0 100644 --- a/devtools/server/actors/common.js +++ b/devtools/server/actors/common.js @@ -148,9 +148,7 @@ GeneratedLocation.prototype = { }, get generatedUrl() { - const actor = this.generatedSourceActor; - const source = actor.source; - return source ? source.url : actor._originalUrl; + return this.generatedSourceActor.url; }, get generatedLine() { diff --git a/devtools/server/actors/source.js b/devtools/server/actors/source.js index c8efb8745551..e830b408eb7a 100644 --- a/devtools/server/actors/source.js +++ b/devtools/server/actors/source.js @@ -107,7 +107,7 @@ const SourceActor = ActorClassWithSpec(sourceSpec, { initialize: function({ source, thread, originalUrl, isInlineSource, contentType }) { this._threadActor = thread; - this._originalUrl = originalUrl; + this._url = originalUrl; this._source = source; this._contentType = contentType; this._isInlineSource = isInlineSource; @@ -138,10 +138,13 @@ const SourceActor = ActorClassWithSpec(sourceSpec, { return this.threadActor.breakpointActorMap; }, get url() { - if (this.source) { - return getSourceURL(this.source, this.threadActor._parent.window); + if (this._url) { + return this._url; } - return this._originalUrl; + if (this.source) { + this._url = getSourceURL(this.source, this.threadActor._parent.window); + } + return this._url; }, get isCacheEnabled() {