Show progress indicator while pretty printing

RESOLVED FIXED in Firefox 27

Status

()

Firefox
Developer Tools: Debugger
P2
normal
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: fitzgen, Assigned: fitzgen)

Tracking

unspecified
Firefox 27
x86
Mac OS X
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

After bug 918802, pretty printing won't block firefox at all, but it will still take a couple seconds to pretty print, most of which are off main thread. We should give the user an idea that things are happening with a progress indicator.
Assignee: nobody → nfitzgerald
Created attachment 814245 [details] [diff] [review]
bug-921630-pp-progress-bar.patch

Played with the "fake" progress bars we talked about in Paris; couldn't make it feel right, don't think it is worth the effort at this time.
Attachment #814245 - Flags: review?(vporof)
Blocks: 912586
Comment on attachment 814245 [details] [diff] [review]
bug-921630-pp-progress-bar.patch

Review of attachment 814245 [details] [diff] [review]:
-----------------------------------------------------------------

In principle this might be ok, but I agree with you that it doesn't feel quite right. It would make more sense to wait for a general purpose progress indicator at the toolbox level, or at least talk about it some more. AFAIK, we didn't come to any decisions about that.

::: browser/devtools/debugger/debugger-panes.js
@@ +393,5 @@
>        dumpn(msg);
>        return;
>      }
>  
> +    const lastIndex = this._editorDeck.selectedIndex;

Doesn't look like you're using this anywhere?

@@ +394,5 @@
>        return;
>      }
>  
> +    const lastIndex = this._editorDeck.selectedIndex;
> +    this._editorDeck.selectedIndex = 2;

Nit: maybe we should define some consts somewhere describing what each tab in the editor deck represents. "2" isn't terribly semantic.

@@ +399,5 @@
> +
> +    const { source } = this.selectedItem.attachment;
> +    DebuggerController.SourceScripts.prettyPrint(source)
> +      .then(resetEditor, printError)
> +      .then(this.maybeShowBlackBoxMessage);

This looks like a hack. I would say it's better to just revert to the previous deck index instead. Blackboxing has nothing to do with pretty printing, and blackboxing a source while pretty printing shouldn't be possible.
Attachment #814245 - Flags: review?(vporof)
Depends on: 924442
(In reply to Victor Porof [:vp] from comment #2)
> Comment on attachment 814245 [details] [diff] [review]
> bug-921630-pp-progress-bar.patch
> 
> Review of attachment 814245 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> In principle this might be ok, but I agree with you that it doesn't feel
> quite right. It would make more sense to wait for a general purpose progress
> indicator at the toolbox level, or at least talk about it some more. AFAIK,
> we didn't come to any decisions about that.

You misunderstand me, originally I had a determined progress bar across the bottom of the toolbar that I faked the percent progress with, and that is what felt even worse than this.

> 
> ::: browser/devtools/debugger/debugger-panes.js
> @@ +393,5 @@
> >        dumpn(msg);
> >        return;
> >      }
> >  
> > +    const lastIndex = this._editorDeck.selectedIndex;
> 
> Doesn't look like you're using this anywhere?

Woops! See comment

> 
> @@ +394,5 @@
> >        return;
> >      }
> >  
> > +    const lastIndex = this._editorDeck.selectedIndex;
> > +    this._editorDeck.selectedIndex = 2;
> 
> Nit: maybe we should define some consts somewhere describing what each tab
> in the editor deck represents. "2" isn't terribly semantic.

In another patch, I have defined showProgressBar, showBlackBoxMessage, and showEditor methods, but they still use numerals directly. Good enough? Or, also add constants for those methods to use?

> 
> @@ +399,5 @@
> > +
> > +    const { source } = this.selectedItem.attachment;
> > +    DebuggerController.SourceScripts.prettyPrint(source)
> > +      .then(resetEditor, printError)
> > +      .then(this.maybeShowBlackBoxMessage);
> 
> This looks like a hack. I would say it's better to just revert to the
> previous deck index instead. Blackboxing has nothing to do with pretty
> printing, and blackboxing a source while pretty printing shouldn't be
> possible.

This is what I was doing (left over lastIndex variable), but realized that maybeShowBlackBoxMessage would do exactly that for me, without me keeping track of things.

I think the better approach would be to disallow pretty printing black boxed sources (filed bug 924442) and then just show the editor again here.
(In reply to Nick Fitzgerald [:fitzgen] from comment #3)
> 
> In another patch, I have defined showProgressBar, showBlackBoxMessage, and
> showEditor methods, but they still use numerals directly. Good enough? Or,
> also add constants for those methods to use?
> 

Nah, that's overkill. Those methods should be enough.

> > 
> > @@ +399,5 @@
> > > +
> > > +    const { source } = this.selectedItem.attachment;
> > > +    DebuggerController.SourceScripts.prettyPrint(source)
> > > +      .then(resetEditor, printError)
> > > +      .then(this.maybeShowBlackBoxMessage);
> > 
> > This looks like a hack. I would say it's better to just revert to the
> > previous deck index instead. Blackboxing has nothing to do with pretty
> > printing, and blackboxing a source while pretty printing shouldn't be
> > possible.
> 
> This is what I was doing (left over lastIndex variable), but realized that
> maybeShowBlackBoxMessage would do exactly that for me, without me keeping
> track of things.
> 

Sounds like maybeShowBlackBoxMessage needs a better (or more generic name) (or more generic functionality)? I don't know what would be better, but it would certainly *look* odd to see such a method being called there.

> I think the better approach would be to disallow pretty printing black boxed
> sources (filed bug 924442) and then just show the editor again here.

That too.
Priority: -- → P2
Created attachment 816003 [details] [diff] [review]
bug-921630-pp-progress-bar.patch

Fixed up comments from last time, added test.
Attachment #814245 - Attachment is obsolete: true
Attachment #816003 - Flags: review?(vporof)
Comment on attachment 816003 [details] [diff] [review]
bug-921630-pp-progress-bar.patch

Review of attachment 816003 [details] [diff] [review]:
-----------------------------------------------------------------

::: browser/devtools/debugger/debugger-view.js
@@ +116,5 @@
> +    this.showEditor = this.showEditor.bind(this);
> +    this.showBlackBoxMessage = this.showBlackBoxMessage.bind(this);
> +    this.showProgressBar = this.showProgressBar.bind(this);
> +    this.maybeShowBlackBoxMessage = this.maybeShowBlackBoxMessage.bind(this);
> +    this._editorDeck = document.getElementById("editor-deck");

Nit: add an _editorDeck: null property along the ones defined at the end of this object literal.

::: browser/devtools/debugger/debugger.xul
@@ +343,5 @@
>                      label="&debuggerUI.blackBoxMessage.unBlackBoxButton;"
>                      image="chrome://browser/skin/devtools/blackBoxMessageEye.png"
>                      command="unBlackBoxCommand"/>
>            </vbox>
> +          <vbox id="source-progress-container" align="center">

Can't you set pack="center" instead of using two flexed spacers underneath?
Attachment #816003 - Flags: review?(vporof) → review+
https://hg.mozilla.org/integration/fx-team/rev/4ab2e3a7d4ff
Whiteboard: [fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/4ab2e3a7d4ff
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 27
You need to log in before you can comment on or make changes to this bug.