Changeset 206105 in webkit


Ignore:
Timestamp:
Sep 19, 2016 11:59:22 AM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Scope sidebar shows "Closure" instead of "Local" when paused in anonymous function
https://bugs.webkit.org/show_bug.cgi?id=162113
<rdar://problem/28348954>

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2016-09-19
Reviewed by Brian Burg.

Source/WebInspectorUI:

  • UserInterface/Models/CallFrame.js:

(WebInspector.CallFrame):
Default the functionName to the empty string. This will compare
favorably against other empty function names instead of null.

LayoutTests:

  • inspector/debugger/paused-scopes-expected.txt:
  • inspector/debugger/paused-scopes.html:
  • inspector/debugger/resources/paused-scopes.js:

Add a third pause to test behavior paused inside an
unnamed anonymous function.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r206102 r206105  
     12016-09-19  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Scope sidebar shows "Closure" instead of "Local" when paused in anonymous function
     4        https://bugs.webkit.org/show_bug.cgi?id=162113
     5        <rdar://problem/28348954>
     6
     7        Reviewed by Brian Burg.
     8
     9        * inspector/debugger/paused-scopes-expected.txt:
     10        * inspector/debugger/paused-scopes.html:
     11        * inspector/debugger/resources/paused-scopes.js:
     12        Add a third pause to test behavior paused inside an
     13        unnamed anonymous function.
     14
    1152016-09-19  Nan Wang  <n_wang@apple.com>
    216
  • trunk/LayoutTests/inspector/debugger/paused-scopes-expected.txt

    r202717 r206105  
    33
    44== Running test suite: PausedCallFrameScope
    5 -- Running test case: TriggerFirstPause
     5-- Running test case: PausedCallFrameScope.TriggerFirstPause
    66CALLFRAME: firstPause
    77
     
    9393
    9494
    95 -- Running test case: TriggerSecondPause
     95-- Running test case: PausedCallFrameScope.TriggerSecondPause
    9696CALLFRAME: secondPause
    9797
     
    204204
    205205
     206-- Running test case: PausedCallFrameScope.TriggerThirdPause
     207CALLFRAME:
     208
     209---- Scope Chain ----
     210  SCOPE: Name () - Type (Closure) - Hash (:<sourceID>:36:14)
     211    - localVariableInsideAnonymousFunction
     212  SCOPE: Name () - Type (Closure) - Hash (:<sourceID>:36:14)
     213  SCOPE: Name (thirdPause) - Type (Closure) - Hash (thirdPause:<sourceID>:34:20)
     214    - closureVariableInsideThirdPause
     215  SCOPE: Name (thirdPause) - Type (Closure) - Hash (thirdPause:<sourceID>:34:20)
     216  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
     217    - globalLet2
     218  SCOPE: Name () - Type (Global) - Hash ()
     219
     220---- Merged Scope Chain ----
     221  SCOPE: Name () - Type (Local) - Hash (:<sourceID>:36:14)
     222    - localVariableInsideAnonymousFunction
     223  SCOPE: Name (thirdPause) - Type (Closure) - Hash (thirdPause:<sourceID>:34:20)
     224    - closureVariableInsideThirdPause
     225  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
     226    - globalLet2
     227  SCOPE: Name () - Type (Global) - Hash ()
     228
     229CALLFRAME: thirdPause
     230
     231---- Scope Chain ----
     232  SCOPE: Name (thirdPause) - Type (Closure) - Hash (thirdPause:<sourceID>:34:20)
     233    - closureVariableInsideThirdPause
     234  SCOPE: Name (thirdPause) - Type (Closure) - Hash (thirdPause:<sourceID>:34:20)
     235  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
     236    - globalLet2
     237  SCOPE: Name () - Type (Global) - Hash ()
     238
     239---- Merged Scope Chain ----
     240  SCOPE: Name (thirdPause) - Type (Local) - Hash (thirdPause:<sourceID>:34:20)
     241    - closureVariableInsideThirdPause
     242  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
     243    - globalLet2
     244  SCOPE: Name () - Type (Global) - Hash ()
     245
     246CALLFRAME: firstPause
     247
     248---- Scope Chain ----
     249  SCOPE: Name (firstPause) - Type (Block) - Hash (firstPause:<sourceID>:21:29)
     250    - barLexicalVariable2
     251  SCOPE: Name (firstPause) - Type (Closure) - Hash (firstPause:<sourceID>:21:29)
     252    - barLexicalVariable2
     253  SCOPE: Name (firstPause) - Type (Closure) - Hash (firstPause:<sourceID>:21:29)
     254    - barVarVariable1
     255  SCOPE: Name (firstPause) - Type (FunctionName) - Hash (firstPause:<sourceID>:21:29)
     256    - firstPause
     257  SCOPE: Name (firstPause) - Type (Closure) - Hash (firstPause:<sourceID>:19:24)
     258    - fakeFirstPauseLexicalVariable
     259  SCOPE: Name (firstPause) - Type (Closure) - Hash (firstPause:<sourceID>:19:24)
     260  SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
     261    - fooLexicalVariable2
     262  SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
     263    - firstPause
     264    - fooVarVariable1
     265  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
     266    - globalLet2
     267  SCOPE: Name () - Type (Global) - Hash ()
     268
     269---- Merged Scope Chain ----
     270  SCOPE: Name (firstPause) - Type (Block) - Hash (firstPause:<sourceID>:21:29)
     271    - barLexicalVariable2
     272  SCOPE: Name (firstPause) - Type (Local) - Hash (firstPause:<sourceID>:21:29)
     273    - barVarVariable1
     274    - barLexicalVariable2
     275  SCOPE: Name (firstPause) - Type (FunctionName) - Hash (firstPause:<sourceID>:21:29)
     276    - firstPause
     277  SCOPE: Name (firstPause) - Type (Closure) - Hash (firstPause:<sourceID>:19:24)
     278    - fakeFirstPauseLexicalVariable
     279  SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
     280    - firstPause
     281    - fooVarVariable1
     282    - fooLexicalVariable2
     283  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
     284    - globalLet2
     285  SCOPE: Name () - Type (Global) - Hash ()
     286
     287CALLFRAME: firstPause
     288
     289---- Scope Chain ----
     290  SCOPE: Name (firstPause) - Type (Closure) - Hash (firstPause:<sourceID>:19:24)
     291    - fakeFirstPauseLexicalVariable
     292  SCOPE: Name (firstPause) - Type (Closure) - Hash (firstPause:<sourceID>:19:24)
     293  SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
     294    - fooLexicalVariable2
     295  SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
     296    - firstPause
     297    - fooVarVariable1
     298  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
     299    - globalLet2
     300  SCOPE: Name () - Type (Global) - Hash ()
     301
     302---- Merged Scope Chain ----
     303  SCOPE: Name (firstPause) - Type (Local) - Hash (firstPause:<sourceID>:19:24)
     304    - fakeFirstPauseLexicalVariable
     305  SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
     306    - firstPause
     307    - fooVarVariable1
     308    - fooLexicalVariable2
     309  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
     310    - globalLet2
     311  SCOPE: Name () - Type (Global) - Hash ()
     312
     313CALLFRAME: entry
     314
     315---- Scope Chain ----
     316  SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
     317    - fooLexicalVariable2
     318  SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
     319    - firstPause
     320    - fooVarVariable1
     321  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
     322    - globalLet2
     323  SCOPE: Name () - Type (Global) - Hash ()
     324
     325---- Merged Scope Chain ----
     326  SCOPE: Name (entry) - Type (Local) - Hash (entry:<sourceID>:14:15)
     327    - firstPause
     328    - fooVarVariable1
     329    - fooLexicalVariable2
     330  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
     331    - globalLet2
     332  SCOPE: Name () - Type (Global) - Hash ()
     333
     334
  • trunk/LayoutTests/inspector/debugger/paused-scopes.html

    r206063 r206105  
    8484
    8585    suite.addTestCase({
    86         name: "TriggerFirstPause",
    87         description: "Verify CallFrames and Scopes with the first pause.",
     86        name: "PausedCallFrameScope.TriggerFirstPause",
     87        description: "Dump CallFrames and Scopes with the first pause.",
    8888        test: (resolve, reject) => {
    8989            InspectorTest.evaluateInPage("setTimeout(entry)");
     
    9595
    9696    suite.addTestCase({
    97         name: "TriggerSecondPause",
    98         description: "Verify CallFrames and Scopes with the first pause.",
     97        name: "PausedCallFrameScope.TriggerSecondPause",
     98        description: "Dump CallFrames and Scopes with the second pause.",
     99        test: (resolve, reject) => {
     100            WebInspector.debuggerManager.resume();
     101            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
     102                dumpCallFrames().then(() => {
     103                    WebInspector.debuggerManager.resume();
     104                    resolve();
     105                }, reject);
     106            });
     107        }
     108    });
     109
     110    suite.addTestCase({
     111        name: "PausedCallFrameScope.TriggerThirdPause",
     112        description: "Dump CallFrames and Scopes with the third pause.",
    99113        test: (resolve, reject) => {
    100114            WebInspector.debuggerManager.resume();
  • trunk/LayoutTests/inspector/debugger/resources/paused-scopes.js

    r202717 r206105  
    2626                debugger;
    2727                secondPause();
     28                thirdPause();
    2829            }
    2930        })();
    3031    }
    3132}
     33
     34function thirdPause() {
     35    let closureVariableInsideThirdPause = false;
     36    (function() {
     37        let localVariableInsideAnonymousFunction = true;
     38        debugger;
     39    })();
     40}
  • trunk/Source/WebInspectorUI/ChangeLog

    r206101 r206105  
     12016-09-19  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Scope sidebar shows "Closure" instead of "Local" when paused in anonymous function
     4        https://bugs.webkit.org/show_bug.cgi?id=162113
     5        <rdar://problem/28348954>
     6
     7        Reviewed by Brian Burg.
     8
     9        * UserInterface/Models/CallFrame.js:
     10        (WebInspector.CallFrame):
     11        Default the functionName to the empty string. This will compare
     12        favorably against other empty function names instead of null.
     13
    1142016-09-19  Matt Baker  <mattbaker@apple.com>
    215
  • trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js

    r202717 r206105  
    3636        this._id = id || null;
    3737        this._sourceCodeLocation = sourceCodeLocation || null;
    38         this._functionName = functionName || null;
     38        this._functionName = functionName || "";
    3939        this._thisObject = thisObject || null;
    4040        this._scopeChain = scopeChain || [];
Note: See TracChangeset for help on using the changeset viewer.