WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
142061
Web Inspector: Save Console Evaluations into Command Line variables $1-$99 ($n)
https://bugs.webkit.org/show_bug.cgi?id=142061
Summary
Web Inspector: Save Console Evaluations into Command Line variables $1-$99 ($n)
Joseph Pecoraro
Reported
2015-02-26 15:11:33 PST
* SUMMARY Save Console Evaluations into Command Line variables $1-$99 ($n). Currently: - $0 is special (often the selected node in the DOM tree, or potentially other uses for the item in context within the frontend). - $1-$4 mean "the previous $0 values" pushed into this list. They are not useful or commonly used. Proposal: - $0 remains the same - $1-$99 assign to unique non-null/non-undefined console evaluations For example: js> 10 + 15 // new value, stashed in $n <- 25 = $1 js> "hello" + "world" // new value, stashed in $n <- "helloworld" = $2 js> [$1, $2] // new value, stashed in $n <- [25, "helloworld"] = $3 js> null // not a useful value, do not stash <- null js> 100 - 75 // value already stashed (strict equality existing values), show the existing $n <- 25 = $1
Attachments
[PATCH] Proposed Fix
(62.27 KB, patch)
2015-02-26 16:06 PST
,
Joseph Pecoraro
timothy
: review+
Details
Formatted Diff
Diff
[IMAGE] Basic $n in console
(74.42 KB, image/png)
2015-02-26 16:06 PST
,
Joseph Pecoraro
no flags
Details
[IMAGE] UI in Preview / Tree and Property Path tooltips
(65.59 KB, image/png)
2015-02-26 16:07 PST
,
Joseph Pecoraro
no flags
Details
[IMAGE] Looping, after $99 reuse $1...
(131.29 KB, image/png)
2015-02-26 16:08 PST
,
Joseph Pecoraro
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2015-02-26 15:11:52 PST
<
rdar://problem/19976979
>
Joseph Pecoraro
Comment 2
2015-02-26 16:06:14 PST
Created
attachment 247459
[details]
[PATCH] Proposed Fix
Joseph Pecoraro
Comment 3
2015-02-26 16:06:49 PST
Created
attachment 247460
[details]
[IMAGE] Basic $n in console
Joseph Pecoraro
Comment 4
2015-02-26 16:07:44 PST
Created
attachment 247461
[details]
[IMAGE] UI in Preview / Tree and Property Path tooltips
Joseph Pecoraro
Comment 5
2015-02-26 16:08:28 PST
Created
attachment 247462
[details]
[IMAGE] Looping, after $99 reuse $1...
Timothy Hatcher
Comment 6
2015-02-26 16:26:14 PST
Comment on
attachment 247459
[details]
[PATCH] Proposed Fix View in context:
https://bugs.webkit.org/attachment.cgi?id=247459&action=review
> Source/JavaScriptCore/inspector/InjectedScriptSource.js:841 > + for (var i = 1; i < this._savedResults.length; ++i) { > + if (this._savedResults[i] === result) { > + this._savedResultIndex = i; > + return; > + } > + }
var existingIndex = this._savedResults.indexOf(result); if (existingIndex != -1) { this._savedResultIndex = existingIndex; return; }
> Source/JavaScriptCore/inspector/InjectedScriptSource.js:1189 > + this.__defineGetter__("$" + i, bind(injectedScript._savedResult, injectedScript, i));
Slick.
> Source/WebCore/inspector/CommandLineAPIModuleSource.js:127 > + this.__defineGetter__("$" + i, bind(injectedScript._savedResult, injectedScript, i));
Why do we need this twice again?
> Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js:334 > + if (!this.savedResultIndex) > + return null;
What will this display as?
Joseph Pecoraro
Comment 7
2015-02-26 16:37:57 PST
(In reply to
comment #6
)
> Comment on
attachment 247459
[details]
> [PATCH] Proposed Fix > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=247459&action=review
> > > Source/JavaScriptCore/inspector/InjectedScriptSource.js:841 > > + for (var i = 1; i < this._savedResults.length; ++i) { > > + if (this._savedResults[i] === result) { > > + this._savedResultIndex = i; > > + return; > > + } > > + } > > var existingIndex = this._savedResults.indexOf(result); > if (existingIndex != -1) { > this._savedResultIndex = existingIndex; > return; > }
Nice!
> > Source/JavaScriptCore/inspector/InjectedScriptSource.js:1189 > > + this.__defineGetter__("$" + i, bind(injectedScript._savedResult, injectedScript, i)); > > Slick. > > > Source/WebCore/inspector/CommandLineAPIModuleSource.js:127 > > + this.__defineGetter__("$" + i, bind(injectedScript._savedResult, injectedScript, i)); > > Why do we need this twice again?
We have BasicCommandLineAPI (JSContext) and CommandLineAPI (Web Page / DOM aware). Someday I will try to merge the two to prevent duplication. Already JSContext inspection lacks command line api basics like "keys", "values", "dir", "log", etc. However we provide a few basics with no outside knowledge. See <
rdar://problem/19184801
> for even more thoughts on this.
> > Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js:334 > > + if (!this.savedResultIndex) > > + return null; > > What will this display as?
The default root property path in ObjectTreeView will be "obj": this._propertyPath = propertyPath || new WebInspector.PropertyPath(this._object, "obj"); Suggestions welcome.
Joseph Pecoraro
Comment 8
2015-02-26 16:45:36 PST
> > > Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js:334 > > > + if (!this.savedResultIndex) > > > + return null; > > > > What will this display as? > > The default root property path in ObjectTreeView will be "obj": > > this._propertyPath = propertyPath || new > WebInspector.PropertyPath(this._object, "obj"); > > Suggestions welcome.
Changing to "this" per IRC discussion.
Joseph Pecoraro
Comment 9
2015-02-26 17:17:18 PST
http://trac.webkit.org/changeset/180715
Joseph Pecoraro
Comment 10
2015-05-05 21:07:46 PDT
***
Bug 140864
has been marked as a duplicate of this bug. ***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug