Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

[Console] Following link to large file from Console doesn't react for a while #4654

Closed
digitarald opened this issue Nov 10, 2017 · 6 comments

Comments

@digitarald
Copy link
Contributor

STR:

image

AR:

  • Nothing happens for me, for about 10sec, then Debugger opens with the file (not correct line)

ER:

  • Open Debugger and show the file with the right line
@digitarald
Copy link
Contributor Author

Same on Github, takes 3sec to click:

image

@juliandescottes
Copy link
Member

For the record, the workaround I used on #4705 also makes the performance of this scenario much better.

@jasonLaster
Copy link
Contributor

I just looked into this and the slow down comes from our current strategy of blocking opening the debugger on fetching all of the sources.

  • We fetch all the sources because the debugger can open after the page is open
  • We block because when a user clicks a link in the console, we check to see if the debugger has the source before deciding to show the source in view-source or the debugger.

We can speed up the debugger opening by not blocking:

diff --git a/src/client/firefox.js b/src/client/firefox.js
index 0715faf..fb0a6d1 100644
--- a/src/client/firefox.js
+++ b/src/client/firefox.js
@@ -45,9 +45,9 @@ export async function onConnect(connection: any, actions: Object): Object {
   // the debugger (if it's paused already, or if loading the page from
   // bfcache) so explicity fire `newSource` events for all returned
   // sources.
-  const sources = await clientCommands.fetchSources();
+  clientCommands.fetchSources().then(sources => actions.newSources(sources));
+
   await actions.connect(tabTarget.url);
-  await actions.newSources(sources);

   // If the threadClient is already paused, make sure to show a
   // paused state.

navigating to viewSource

We can check the source map url service to see if the source has been seen before opening the debugger

Note

One thing to watch out for if we stop blocking the debugger opening is that we scroll when the source loads.

@jasonLaster
Copy link
Contributor

Here is a sketch of what the changes could look like in the panel:

diff --git a/devtools/client/framework/source-map-url-service.js b/devtools/client/framework/source-map-url-service.js
index fe4ff87..f2940f7 100644
--- a/devtools/client/framework/source-map-url-service.js
+++ b/devtools/client/framework/source-map-url-service.js
@@ -347,4 +347,6 @@ SourceMapURLService.prototype._onPrefChanged = function () {
   }
 };
 
+SourceMapURLService.prototype.hasSource = // YAY
+ 
 exports.SourceMapURLService = SourceMapURLService;
diff --git a/devtools/client/shared/view-source.js b/devtools/client/shared/view-source.js
index 94a6dff..3ec74b6 100644
--- a/devtools/client/shared/view-source.js
+++ b/devtools/client/shared/view-source.js
@@ -59,8 +59,7 @@ exports.viewSourceInDebugger = Task.async(function* (toolbox, sourceURL, sourceL
 
   // New debugger frontend
   if (Services.prefs.getBoolPref("devtools.debugger.new-debugger-frontend")) {
-    const source = dbg.getSource(sourceURL);
-    if (source) {
+    if (toolbox.sourceMapService.hasSource(sourceURL)) {
       yield toolbox.selectTool("jsdebugger");
       dbg.selectSource(sourceURL, sourceLine);
return true;

@codehag
Copy link
Contributor

codehag commented Feb 22, 2018

p1 of this fix: https://reviewboard.mozilla.org/r/222292/

@jasonLaster jasonLaster modified the milestones: February 27th, March 13 Feb 27, 2018
@codehag codehag self-assigned this Mar 6, 2018
@jasonLaster jasonLaster removed this from the March 13 milestone Mar 6, 2018
@jasonLaster jasonLaster modified the milestones: March 13, March 27th Mar 6, 2018
@jasonLaster jasonLaster changed the title Following link to large file from Console doesn't react for a while [Console] Following link to large file from Console doesn't react for a while Mar 14, 2018
@jasonLaster jasonLaster removed this from the March 27th milestone Mar 20, 2018
@jasonLaster jasonLaster mentioned this issue May 23, 2018
24 tasks
@digitarald
Copy link
Contributor Author

Works snappy for me now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants