Closed
Bug 1129155
Opened 9 years ago
Closed 9 years ago
Add system for opening a new tab from the console
Categories
(DevTools :: Console, defect)
DevTools
Console
Tracking
(firefox37 fixed, firefox38 fixed)
RESOLVED
FIXED
Firefox 38
People
(Reporter: jwalker, Assigned: bgrins)
Details
Attachments
(1 file, 2 obsolete files)
1.54 KB,
patch
|
bgrins
:
review+
lsblakk
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•9 years ago
|
||
Boris, we want to add a simple new console method that just logs out a string as an easter egg. Here is a patch that adds this method in the same manner I've seen for other ones. Do you know of a way to make it non-enumerable and/or do you have any ideas about how to define a method on the console object that basically just calls console.log("Some string") regardless of any arguments that were passed in? For example, is there somewhere in JS that we could run something like this: Object.defineProperty(console, 'foo', { value: function() { console.log('bar'); } });
Attachment #8559443 -
Flags: review?(bzbarsky)
Comment 2•9 years ago
|
||
> Do you know of a way to make it non-enumerable Not right now, but we could add something like this to our bindings. I've been considering doing that anyway. > For example, is there somewhere in JS that we could run something like this: You could do it on window creation, but that has some undesirable performance implications, right? Or we could add some notification the console sends when it's created. Do you want this method in workers too? I'm having a bit of trouble reconciling the summary of this bug and comment 1, and hence evaluating how much complexity we should take on here and which sort.
Comment 3•9 years ago
|
||
Comment on attachment 8559443 [details] [diff] [review] new-console-method.patch This is fine as far as it goes, except I doubt we're planning to actually ship it with this name, yes? ;)
Attachment #8559443 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 4•9 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #2) > > Do you know of a way to make it non-enumerable > > Not right now, but we could add something like this to our bindings. I've > been considering doing that anyway. > > > For example, is there somewhere in JS that we could run something like this: > > You could do it on window creation, but that has some undesirable > performance implications, right? Or we could add some notification the > console sends when it's created. Do you want this method in workers too? > > I'm having a bit of trouble reconciling the summary of this bug and comment > 1, and hence evaluating how much complexity we should take on here and which > sort. We don't need it in workers. In fact, we only need it if the command was run from the webconsole input prompt. We shouldn't take on any extra complexity for this bug. It's really just going to be an easter egg, printing out a string whenever someone types the command. In fact, when going over your review comments I realized that there is a way we can handle these requirements without any platform changes by just matching the input string in the evalWithDebugger[0] function in JS similar to how we detect the "help" command. [0]: https://dxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webconsole.js#1064
Comment 5•9 years ago
|
||
OK. Or you could define something on the Console object when the console is opened.
Assignee | ||
Comment 6•9 years ago
|
||
New approach as explained in Comment 4
Assignee: nobody → bgrinstead
Attachment #8559443 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #8562227 -
Flags: review?(past)
Comment 7•9 years ago
|
||
Comment on attachment 8562227 [details] [diff] [review] console-mihai.patch Review of attachment 8562227 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/devtools/server/actors/webconsole.js @@ +1065,5 @@ > aString = "help()"; > } > > + // Add easter egg for console.mihai(). > + if (aString.trim() == "console.mihai()" || aString.trim() == "console.mihai();") { Nit: we now have to needlessly trim the string 4 times in the common case, which seems excessive. I think it would be better to calculate a trimmedString once and later use it in these 4 checks instead.
Attachment #8562227 -
Flags: review?(past) → review+
Assignee | ||
Comment 8•9 years ago
|
||
Updated for comment 7
Attachment #8562227 -
Attachment is obsolete: true
Attachment #8562858 -
Flags: review+
Assignee | ||
Comment 9•9 years ago
|
||
https://hg.mozilla.org/integration/fx-team/rev/fdcb26aac28c
Whiteboard: [fixed-in-fx-team]
Comment 10•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/fdcb26aac28c
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox38:
--- → fixed
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 38
Assignee | ||
Comment 11•9 years ago
|
||
Comment on attachment 8562858 [details] [diff] [review] console-mihai.patch Approval Request Comment [Feature/regressing bug #]: console.mihai method [User impact if declined]: new method will not be available in Dev Edition [Describe test coverage new/current, TreeHerder]: [Risks and why]: Super low risk, just modifies the webconsole frontend to change the output when a particular string was passed in [String/UUID change made/needed]:
Attachment #8562858 -
Flags: approval-mozilla-aurora?
Updated•9 years ago
|
Attachment #8562858 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 12•9 years ago
|
||
https://hg.mozilla.org/releases/mozilla-aurora/rev/74827b8f61eb
status-firefox37:
--- → fixed
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•