Add clearHistory jsterm helper to remove persisted console input history

RESOLVED FIXED in Firefox 39

Status

()

Firefox
Developer Tools: Console
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: bgrins, Assigned: bgrins)

Tracking

({dev-doc-complete})

unspecified
Firefox 39
x86
Mac OS X
dev-doc-complete
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(firefox39 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
This is a follow up to Bug 943306 to allow a way to clear the saved console history.

The proposal is to add a jsterm helper for "clearHistory()" that will send a helperResult of clearHistory to indicate to the frontend to do so.
We have this old bug to alias our clear() helper to console.clear - I wonder if it would make sense to also add this method to the console object as they are related? We could see if the chrome folks were interested in adding it as well.

See bug 659625
See Also: → bug 659625
(Assignee)

Comment 2

3 years ago
(In reply to Jeff Griffiths (:canuckistani) from comment #1)
> We have this old bug to alias our clear() helper to console.clear - I wonder
> if it would make sense to also add this method to the console object as they
> are related? We could see if the chrome folks were interested in adding it
> as well.

The only problem with that is that a web page could call console.clearHistory and wipe out your saved data. (and/or clear your output).  To me, this makes sense as a js term helper (only available when inputting directly into the console).
(In reply to Brian Grinstead [:bgrins] from comment #2)
> (In reply to Jeff Griffiths (:canuckistani) from comment #1)
> > We have this old bug to alias our clear() helper to console.clear - I wonder
> > if it would make sense to also add this method to the console object as they
> > are related? We could see if the chrome folks were interested in adding it
> > as well.
> 
> The only problem with that is that a web page could call
> console.clearHistory and wipe out your saved data. (and/or clear your
> output).  To me, this makes sense as a js term helper (only available when
> inputting directly into the console).

Yeah, forget I said anything.
(Assignee)

Comment 4

3 years ago
Created attachment 8567361 [details] [diff] [review]
console-clearHistory.patch

Adds a jsterm helper for clearHistory() that will remove all entries from the active toolbox any future ones.

Try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=443cf848d591
Assignee: nobody → bgrinstead
Status: NEW → ASSIGNED
Attachment #8567361 - Flags: review?(past)
Comment on attachment 8567361 [details] [diff] [review]
console-clearHistory.patch

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

Great, don't forget to update MDN once this lands:

https://developer.mozilla.org/docs/Tools/Web_Console/Helpers
Attachment #8567361 - Flags: review?(past) → review+
https://hg.mozilla.org/integration/fx-team/rev/e1a7c0e78a9d
Flags: in-testsuite+
Keywords: checkin-needed
Whiteboard: [fixed-in-fx-team]
(Assignee)

Comment 8

3 years ago
Will, could you please add a note for this new 'clearHistory()' jsterm helper?  It will clear out any webconsole commands that have been saved to your profile (a feature added for 39 in Bug 943306).
Flags: needinfo?(wbamberg)
Keywords: dev-doc-needed
https://hg.mozilla.org/mozilla-central/rev/e1a7c0e78a9d
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
status-firefox39: --- → fixed
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 39
I'll update MDN when this is in Developer Edition, unless you need it sooner.
Flags: needinfo?(wbamberg)
(Assignee)

Comment 11

3 years ago
(In reply to Will Bamberg [:wbamberg] from comment #10)
> I'll update MDN when this is in Developer Edition, unless you need it sooner.

That'd be perfect, thanks!
bgrins, I've added notes here: https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Command_history
and here: https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Helper_commands. Does that cover it?
Flags: needinfo?(bgrinstead)
(Assignee)

Comment 13

3 years ago
(In reply to Will Bamberg [:wbamberg] from comment #12)
> bgrins, I've added notes here:
> https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Command_history
> and here:
> https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Helper_commands.
> Does that cover it?

Looks good, thanks.
Flags: needinfo?(bgrinstead)
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.