Closed Bug 882790 Opened 11 years ago Closed 7 years ago

Add toolbar button for pause on exceptions

Categories

(DevTools :: Debugger, defect, P3)

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: fitzgen, Assigned: b4bomsy)

References

Details

(Whiteboard: [lang=js][lang=xul])

Attachments

(1 file, 7 obsolete files)

The "pause on exceptions" functionality is currently hard to find, and is often something that you want to toggle on/off fairly frequently. We should move it from the settings menu to a toolbar button.
Assignee: nobody → nfitzgerald
Blocks: 879408
Priority: -- → P3
Patch bit rotted and I'm not picking this back up in the near future. Free for someone else to take if they want.
Assignee: nfitzgerald → nobody
Note that this should probably be a 3 state toggle since we have 3 possible states now:

* Do not pause on exceptions
* Pause on ALL exceptions
* Pause on uncaught exceptions
Whiteboard: [mentor=nfitzgerald@mozilla.com][lang=js][lang=xul]
Can i work on this?
Assignee: nobody → b4bomsy
Go for it!
Mentor: nfitzgerald
Whiteboard: [mentor=nfitzgerald@mozilla.com][lang=js][lang=xul] → [lang=js][lang=xul]
Summary: Add toolbar button for "pause on exceptions" → Add toolbar button for pause on exceptions
Summary: Add toolbar button for pause on exceptions → Add toolbar button for break on exceptions
Summary: Add toolbar button for break on exceptions → Add toolbar button for pause on exceptions
Attached patch wip.patch (obsolete) (deleted) — Splinter Review
Just got back to start fixing this after a while.
Just a WIP to make sure i'm on the right path.

TODO:
Add tests.
Need to add icons for the toggle button.

Question:
How do handle adding icons for the buttons?
Attachment #8578003 - Flags: feedback?(nfitzgerald)
Specifics about the icons: who creates the icons for buttons and what kinda icon we should use?
(In reply to Hubert B Manilla from comment #8)
> Specifics about the icons: who creates the icons for buttons and what kinda
> icon we should use?

I find the best way to get icons is to draw your own crappy one, land that, and then ping ui people like "hey, we need a real icon, or this is going to ship." Otherwise, you'll end up waiting forever...
Comment on attachment 8578003 [details] [diff] [review]
wip.patch

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

::: browser/devtools/debugger/debugger-commands.js
@@ +372,5 @@
>      }
>    }
>  });
>  
> +/**:

Accidental change?
Attachment #8578003 - Flags: feedback?(nfitzgerald) → feedback+
(In reply to Hubert B Manilla from comment #7)
> Question:
> How do handle adding icons for the buttons?

Usually we would want to use a button and toggle the "checked" attribute, but becuase we have three states rather than two, I think we need something different. Perhaps a deck[0] with 3 buttons (one for each state) and we only show one at a time?

Victor, how do you think we should do a 3-state toggle button?

[0] https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/deck
Flags: needinfo?(vporof)
(In reply to Nick Fitzgerald [:fitzgen] from comment #10)
> Comment on attachment 8578003 [details] [diff] [review]
> wip.patch
> 
> Review of attachment 8578003 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: browser/devtools/debugger/debugger-commands.js
> @@ +372,5 @@
> >      }
> >    }
> >  });
> >  
> > +/**:
> 
> Accidental change?

yeah. will fix this.
(In reply to Nick Fitzgerald [:fitzgen] from comment #9)
> (In reply to Hubert B Manilla from comment #8)
> > Specifics about the icons: who creates the icons for buttons and what kinda
> > icon we should use?
> 
> I find the best way to get icons is to draw your own **** one, land that,
> and then ping ui people like "hey, we need a real icon, or this is going to
> ship." Otherwise, you'll end up waiting forever...

Nice! will do that! Anyone in particular i can buzz?
(In reply to Hubert B Manilla from comment #13)
> (In reply to Nick Fitzgerald [:fitzgen] from comment #9)
> > (In reply to Hubert B Manilla from comment #8)
> > > Specifics about the icons: who creates the icons for buttons and what kinda
> > > icon we should use?
> > 
> > I find the best way to get icons is to draw your own **** one, land that,
> > and then ping ui people like "hey, we need a real icon, or this is going to
> > ship." Otherwise, you'll end up waiting forever...
> 
> Nice! will do that! Anyone in particular i can bug when i'm done?
(In reply to Hubert B Manilla from comment #13)
> (In reply to Nick Fitzgerald [:fitzgen] from comment #9)
> > (In reply to Hubert B Manilla from comment #8)
> > > Specifics about the icons: who creates the icons for buttons and what kinda
> > > icon we should use?
> > 
> > I find the best way to get icons is to draw your own **** one, land that,
> > and then ping ui people like "hey, we need a real icon, or this is going to
> > ship." Otherwise, you'll end up waiting forever...
> 
> Nice! will do that! Anyone in particular i can buzz?

:shorlander
(In reply to Nick Fitzgerald [:fitzgen] from comment #11)
> (In reply to Hubert B Manilla from comment #7)
> > Question:
> > How do handle adding icons for the buttons?
> 
> Usually we would want to use a button and toggle the "checked" attribute,
> but becuase we have three states rather than two, I think we need something
> different. Perhaps a deck[0] with 3 buttons (one for each state) and we only
> show one at a time?
> 
> Victor, how do you think we should do a 3-state toggle button?
> 
> [0] https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/deck

Why not a button with 3 possible attributes, each styled differently in css?

button[state=whatever1]
button[state=whatever2]
button[state=whatever3]
Flags: needinfo?(vporof)
Great solution!
Attached patch 882790wip.patch (obsolete) (deleted) — Splinter Review
Stephen, i just used existing icons, since i'm really **** at designing any kinda icon. We would be need proper icons for the pause on exceptions button. I was directed your way. Thanks for your help!
Attachment #8578003 - Attachment is obsolete: true
Flags: needinfo?(shorlander)
Attachment #8625718 - Flags: review?(nfitzgerald)
Attachment #8625718 - Flags: feedback?
Comment on attachment 8625718 [details] [diff] [review]
882790wip.patch

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

Looks pretty straightforward, which is always good.

We shouldn't have tests "blah-03" and "blah-04" without -01 and -02. Just reuse the -01 and -02 names.

The new test files and icons aren't attached in the patch.

::: browser/devtools/debugger/views/sources-view.js
@@ +632,5 @@
> +    let state = Number(this._togglePauseOnExceptionsButton.getAttribute("state"));
> +    let tooltip;
> +
> +    state = state === 2 ? 0 : state + 1;
> +    if (state === 0) {

Let's define constants at the top for these to make it more readable:

const DO_NOT_PAUSE_ON_EXCEPTIONS = 0;
const PAUSE_ON_UNCAUGHT_EXCEPTIONS = 1;
const PAUSE_ON_ALL_EXCEPTIONS = 2;
Attachment #8625718 - Flags: review?(nfitzgerald)
Attachment #8625718 - Flags: feedback?
Attached patch 882790wip.patch (obsolete) (deleted) — Splinter Review
Updated based on reviews feedback.
Attachment #8625718 - Attachment is obsolete: true
Attachment #8626166 - Flags: review?(nfitzgerald)
Attached patch 882790wip.patch (obsolete) (deleted) — Splinter Review
Updated.
Attachment #8626166 - Attachment is obsolete: true
Attachment #8626166 - Flags: review?(nfitzgerald)
Attachment #8626500 - Flags: review?(nfitzgerald)
Comment on attachment 8626500 [details] [diff] [review]
882790wip.patch

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

Looks great!

::: browser/devtools/debugger/views/sources-view.js
@@ +635,5 @@
> +    let state = Number(this._togglePauseOnExceptionsButton.getAttribute("state"));
> +    let tooltip;
> +
> +    state = state === PAUSE_ON_UNCAUGHT_EXCEPTIONS ?
> +                      DO_NOT_PAUSE_ON_EXCEPTIONS : state + PAUSE_ON_ALL_EXCEPTIONS;

How about this:

    state = (state + 1) % 3;

Or this:

    ++state % 3;
Attachment #8626500 - Flags: review?(nfitzgerald) → review+
(In reply to Nick Fitzgerald [:fitzgen][:nf] from comment #22)
> Comment on attachment 8626500 [details] [diff] [review]
> 882790wip.patch
> 
> Review of attachment 8626500 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Looks great!
> 
> ::: browser/devtools/debugger/views/sources-view.js
> @@ +635,5 @@
> > +    let state = Number(this._togglePauseOnExceptionsButton.getAttribute("state"));
> > +    let tooltip;
> > +
> > +    state = state === PAUSE_ON_UNCAUGHT_EXCEPTIONS ?
> > +                      DO_NOT_PAUSE_ON_EXCEPTIONS : state + PAUSE_ON_ALL_EXCEPTIONS;
> 
> How about this:
> 
>     state = (state + 1) % 3;
> 
> Or this:
> 
>     ++state % 3;

Good idea!
Attached patch 882790wip.patch (obsolete) (deleted) — Splinter Review
Attachment #8626500 - Attachment is obsolete: true
Comment on attachment 8627058 [details] [diff] [review]
882790wip.patch

updated!
Attachment #8627058 - Flags: feedback?(nfitzgerald)
Comment on attachment 8627058 [details] [diff] [review]
882790wip.patch

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

FYI, unless you make significant changes to a patch, if someone has already given r+ (or says "r=me with X, Y, and Z changes") you don't need to request review again. You can just add the r+ yourself.

Do you need me to do a try push for you? I forget if you have commit access for try.
Attachment #8627058 - Flags: feedback?(nfitzgerald) → review+
(In reply to Nick Fitzgerald [:fitzgen][:nf] from comment #26)
> Comment on attachment 8627058 [details] [diff] [review]
> 882790wip.patch
> 
> Review of attachment 8627058 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> FYI, unless you make significant changes to a patch, if someone has already
> given r+ (or says "r=me with X, Y, and Z changes") you don't need to request
> review again. You can just add the r+ yourself.
> 
Good to know! was not sure if i should add the r+ myself.

> Do you need me to do a try push for you? I forget if you have commit access
> for try.
i got commit access while back, i'm not sure if anything has changed since then.
i'll give a try n i'll let you know if i can't.
Hey nick, i think i might need you to do a try push for me. Thanks.

I think sometime late last year there was a mail, mentioning that i would need revouching to continue contributing, but didnt get around to asking anyone.
Flags: needinfo?(nfitzgerald)
Hm, I can't apply this on latest fx-team. Can you rebase and/or push yourself. Happy to revouch for you if you flag me.
Flags: needinfo?(nfitzgerald)
Attached patch 882790wip.patch (obsolete) (deleted) — Splinter Review
Rebased and updated patch!
Attachment #8627058 - Attachment is obsolete: true
Attachment #8628753 - Flags: review+
(In reply to Hubert B Manilla from comment #30)
> Created attachment 8628753 [details] [diff] [review]
> 882790wip.patch
> 
> Rebased and updated patch!

Try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=13e66decde48
ni?me for checking back in on the try push
Flags: needinfo?(nfitzgerald)
Try push has a bunch of devtools mochitest failures like:


698 INFO TEST-UNEXPECTED-FAIL | browser/devtools/debugger/test/browser_dbg_server-conditional-bp-01.js | Test timed out - expected PASS
812 INFO TEST-UNEXPECTED-FAIL | browser/devtools/debugger/test/browser_dbg_server-conditional-bp-05.js | Test timed out - expected PASS
835 INFO TEST-UNEXPECTED-FAIL | browser/devtools/debugger/test/browser_dbg_source-maps-04.js | The pause-on-exceptions pref should be disabled by default. - Got true, expected false
838 INFO TEST-UNEXPECTED-FAIL | browser/devtools/debugger/test/browser_dbg_source-maps-04.js | Test timed out - expected PASS 

Hubert, can you reproduce these locally? They don't seem restricted to a single platform or anything like that. You can dig into the log by selecting a failing job and then clicking on the "log" button that is on the left in the split view that pops up after clicking on the failed job.
Flags: needinfo?(nfitzgerald) → needinfo?(b4bomsy)
Attached patch 882790wip.patch (obsolete) (deleted) — Splinter Review
Fixed the tests!
Attachment #8628753 - Attachment is obsolete: true
Flags: needinfo?(b4bomsy)
It's not applying on fx-team for me:

applying 882790wip.patch
patching file browser/devtools/debugger/debugger-controller.js
Hunk #1 FAILED at 780
1 out of 1 hunks FAILED -- saving rejects to file browser/devtools/debugger/debugger-controller.js.rej
patching file browser/devtools/debugger/views/stack-frames-view.js
Hunk #1 FAILED at 10
Hunk #2 FAILED at 106
2 out of 3 hunks FAILED -- saving rejects to file browser/devtools/debugger/views/stack-frames-view.js.rej
patch failed, unable to continue (try -v)
patch failed, rejects left in working dir
errors during apply, please fix and refresh 882790wip.patch

Do you have try access again now? If not, please request commit level 1 again, so I don't need to do try pushes for you and then ask you to rebase and then try again anymore :P

https://www.mozilla.org/en-US/about/governance/policies/commit/
Attached patch 882790wip.patch (deleted) — Splinter Review
Attachment #8631575 - Attachment is obsolete: true
Hey Nick, 
There are a couple of other failures but they don't look like errors from our end.
Can these be ignored?
Flags: needinfo?(nfitzgerald)
Yeah that push looks fine, all those seem like existing intermittents. Ready to add the checkin-needed keyword?
Flags: needinfo?(nfitzgerald)
(In reply to Nick Fitzgerald [:fitzgen][:nf] from comment #39)
> Yeah that push looks fine, all those seem like existing intermittents. Ready
> to add the checkin-needed keyword?

Yeah!
Attachment #8632826 - Flags: checkin?
Comment on attachment 8632826 [details] [diff] [review]
882790wip.patch

In the future, please just use the checkin-needed bug keyword. It works better with the automated bug marking tools we use. Thanks for the patch!
Attachment #8632826 - Flags: checkin?
(In reply to Ryan VanderMeulen [:RyanVM UTC-4] from comment #41)
> Comment on attachment 8632826 [details] [diff] [review]
> 882790wip.patch
> 
> In the future, please just use the checkin-needed bug keyword. It works
> better with the automated bug marking tools we use. Thanks for the patch!

Ok, noted! many thanks!
https://hg.mozilla.org/mozilla-central/rev/85303b3d8d17
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 42
Hubert, can you make sure to ping UX for a real icon? shorlander who usually helps with UX for us is away till 7/20. Let me know if you want me to file a new bug for this.
Oh oops just saw he was already ni?
Noticed that the new toolbar button also needs a tooltip text.
Flags: needinfo?(b4bomsy)
(In reply to Gabriel Luong [:gl] from comment #45)
> Hubert, can you make sure to ping UX for a real icon? shorlander who usually
> helps with UX for us is away till 7/20. Let me know if you want me to file a
> new bug for this.

Yeah, it would be cool to have a bug to track for this.
Flags: needinfo?(b4bomsy)
(In reply to Gabriel Luong [:gl] from comment #47)
> Noticed that the new toolbar button also needs a tooltip text.

Sorry abit confused? Is it when you mouseover the pause on exceptions button, no tooltiptext shows up?
Depends on: 1184160
(In reply to Hubert B Manilla from comment #49)
> (In reply to Gabriel Luong [:gl] from comment #47)
> > Noticed that the new toolbar button also needs a tooltip text.
> 
> Sorry abit confused? Is it when you mouseover the pause on exceptions
> button, no tooltiptext shows up?

Yes, this would be the tooltip text that shows up when you mouseover the button.
(In reply to Gabriel Luong [:gl] from comment #50)
> (In reply to Hubert B Manilla from comment #49)
> > (In reply to Gabriel Luong [:gl] from comment #47)
> > > Noticed that the new toolbar button also needs a tooltip text.
> > 
> > Sorry abit confused? Is it when you mouseover the pause on exceptions
> > button, no tooltiptext shows up?
> 
> Yes, this would be the tooltip text that shows up when you mouseover the
> button.

Interestingly, it shows up for me.
(In reply to Hubert B Manilla from comment #51)
> (In reply to Gabriel Luong [:gl] from comment #50)
> > (In reply to Hubert B Manilla from comment #49)
> > > (In reply to Gabriel Luong [:gl] from comment #47)
> > > > Noticed that the new toolbar button also needs a tooltip text.
> > > 
> > > Sorry abit confused? Is it when you mouseover the pause on exceptions
> > > button, no tooltiptext shows up?
> > 
> > Yes, this would be the tooltip text that shows up when you mouseover the
> > button.
> 
> Interestingly, it shows up for me.

it shows "Pause on all exceptions" initially..
(In reply to Hubert B Manilla from comment #52)
> (In reply to Hubert B Manilla from comment #51)
> > (In reply to Gabriel Luong [:gl] from comment #50)
> > > (In reply to Hubert B Manilla from comment #49)
> > > > (In reply to Gabriel Luong [:gl] from comment #47)
> > > > > Noticed that the new toolbar button also needs a tooltip text.
> > > > 
> > > > Sorry abit confused? Is it when you mouseover the pause on exceptions
> > > > button, no tooltiptext shows up?
> > > 
> > > Yes, this would be the tooltip text that shows up when you mouseover the
> > > button.
> > 
> > Interestingly, it shows up for me.
> 
> it shows "Pause on all exceptions" initially..

Oh indeed, I was looking at the source and noticed the tooltiptext attribute was not set in debugger.xul

I see you are setting the attribute in the options-view.js. Perhaps as a follow up we should remove setting these attributes in options-view.js to reduce the amount of code needed, and only have one place where the attributes need to be defined.
I think we definitely want this button to standout similar to what chrome has done with having a blue button to toggle a panel to enable pause on exception. This is a fairly important feature and we want to make sure it is discoverable now that it was removed from the setting context menu. Even with just a button it might be hard to tell what the state is for pause on exception (on/off). One idea is to have a checkbox similar to the "Browser styles" in the computed view somewhere appropriate in the Debugger.
I looked for pause on exceptions button on toolbar menu,but didn't found on Firefox nightly windows 8.1(32bit):

Build ID 	20150613030206
User Agent 	Mozilla/5.0 (Windows NT 6.3; rv:41.0) Gecko/20100101 Firefox/41.0

I found this pause on exceptions button on Latest nightly:

Build ID 	20150722030205
User Agent 	Mozilla/5.0 (Windows NT 6.3; rv:42.0) Gecko/20100101 Firefox/42.0

[bugday-20150723]
Status: RESOLVED → VERIFIED
Backed out until we address Bug 1184160

https://hg.mozilla.org/integration/fx-team/rev/789ccabdbadc
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
Target Milestone: Firefox 42 → ---
Stephen is already ni? in Bug 1184160
Flags: needinfo?(shorlander)
Mentor: nfitzgerald
This is done in the new debugger front end.
Status: REOPENED → RESOLVED
Closed: 9 years ago7 years ago
Depends on: 1288511
Resolution: --- → FIXED
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: