Title: [206105] trunk
Revision
206105
Author
commit-qu...@webkit.org
Date
2016-09-19 11:59:22 -0700 (Mon, 19 Sep 2016)

Log 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 <pecor...@apple.com> 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.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (206104 => 206105)


--- trunk/LayoutTests/ChangeLog	2016-09-19 18:46:07 UTC (rev 206104)
+++ trunk/LayoutTests/ChangeLog	2016-09-19 18:59:22 UTC (rev 206105)
@@ -1,3 +1,17 @@
+2016-09-19  Joseph Pecoraro  <pecor...@apple.com>
+
+        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>
+
+        Reviewed by Brian Burg.
+
+        * 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.
+
 2016-09-19  Nan Wang  <n_w...@apple.com>
 
         AX: Add accessibility support for details element on iOS

Modified: trunk/LayoutTests/inspector/debugger/paused-scopes-expected.txt (206104 => 206105)


--- trunk/LayoutTests/inspector/debugger/paused-scopes-expected.txt	2016-09-19 18:46:07 UTC (rev 206104)
+++ trunk/LayoutTests/inspector/debugger/paused-scopes-expected.txt	2016-09-19 18:59:22 UTC (rev 206105)
@@ -2,7 +2,7 @@
 
 
 == Running test suite: PausedCallFrameScope
--- Running test case: TriggerFirstPause
+-- Running test case: PausedCallFrameScope.TriggerFirstPause
 CALLFRAME: firstPause
 
 ---- Scope Chain ----
@@ -92,7 +92,7 @@
   SCOPE: Name () - Type (Global) - Hash ()
 
 
--- Running test case: TriggerSecondPause
+-- Running test case: PausedCallFrameScope.TriggerSecondPause
 CALLFRAME: secondPause
 
 ---- Scope Chain ----
@@ -160,6 +160,135 @@
 ---- Scope Chain ----
   SCOPE: Name (firstPause) - Type (Closure) - Hash (firstPause:<sourceID>:19:24)
     - fakeFirstPauseLexicalVariable
+  SCOPE: Name (firstPause) - Type (Closure) - Hash (firstPause:<sourceID>:19:24)
+  SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
+    - fooLexicalVariable2
+  SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
+    - firstPause
+    - fooVarVariable1
+  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
+    - globalLet2
+  SCOPE: Name () - Type (Global) - Hash ()
+
+---- Merged Scope Chain ----
+  SCOPE: Name (firstPause) - Type (Local) - Hash (firstPause:<sourceID>:19:24)
+    - fakeFirstPauseLexicalVariable
+  SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
+    - firstPause
+    - fooVarVariable1
+    - fooLexicalVariable2
+  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
+    - globalLet2
+  SCOPE: Name () - Type (Global) - Hash ()
+
+CALLFRAME: entry
+
+---- Scope Chain ----
+  SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
+    - fooLexicalVariable2
+  SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
+    - firstPause
+    - fooVarVariable1
+  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
+    - globalLet2
+  SCOPE: Name () - Type (Global) - Hash ()
+
+---- Merged Scope Chain ----
+  SCOPE: Name (entry) - Type (Local) - Hash (entry:<sourceID>:14:15)
+    - firstPause
+    - fooVarVariable1
+    - fooLexicalVariable2
+  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
+    - globalLet2
+  SCOPE: Name () - Type (Global) - Hash ()
+
+
+-- Running test case: PausedCallFrameScope.TriggerThirdPause
+CALLFRAME: 
+
+---- Scope Chain ----
+  SCOPE: Name () - Type (Closure) - Hash (:<sourceID>:36:14)
+    - localVariableInsideAnonymousFunction
+  SCOPE: Name () - Type (Closure) - Hash (:<sourceID>:36:14)
+  SCOPE: Name (thirdPause) - Type (Closure) - Hash (thirdPause:<sourceID>:34:20)
+    - closureVariableInsideThirdPause
+  SCOPE: Name (thirdPause) - Type (Closure) - Hash (thirdPause:<sourceID>:34:20)
+  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
+    - globalLet2
+  SCOPE: Name () - Type (Global) - Hash ()
+
+---- Merged Scope Chain ----
+  SCOPE: Name () - Type (Local) - Hash (:<sourceID>:36:14)
+    - localVariableInsideAnonymousFunction
+  SCOPE: Name (thirdPause) - Type (Closure) - Hash (thirdPause:<sourceID>:34:20)
+    - closureVariableInsideThirdPause
+  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
+    - globalLet2
+  SCOPE: Name () - Type (Global) - Hash ()
+
+CALLFRAME: thirdPause
+
+---- Scope Chain ----
+  SCOPE: Name (thirdPause) - Type (Closure) - Hash (thirdPause:<sourceID>:34:20)
+    - closureVariableInsideThirdPause
+  SCOPE: Name (thirdPause) - Type (Closure) - Hash (thirdPause:<sourceID>:34:20)
+  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
+    - globalLet2
+  SCOPE: Name () - Type (Global) - Hash ()
+
+---- Merged Scope Chain ----
+  SCOPE: Name (thirdPause) - Type (Local) - Hash (thirdPause:<sourceID>:34:20)
+    - closureVariableInsideThirdPause
+  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
+    - globalLet2
+  SCOPE: Name () - Type (Global) - Hash ()
+
+CALLFRAME: firstPause
+
+---- Scope Chain ----
+  SCOPE: Name (firstPause) - Type (Block) - Hash (firstPause:<sourceID>:21:29)
+    - barLexicalVariable2
+  SCOPE: Name (firstPause) - Type (Closure) - Hash (firstPause:<sourceID>:21:29)
+    - barLexicalVariable2
+  SCOPE: Name (firstPause) - Type (Closure) - Hash (firstPause:<sourceID>:21:29)
+    - barVarVariable1
+  SCOPE: Name (firstPause) - Type (FunctionName) - Hash (firstPause:<sourceID>:21:29)
+    - firstPause
+  SCOPE: Name (firstPause) - Type (Closure) - Hash (firstPause:<sourceID>:19:24)
+    - fakeFirstPauseLexicalVariable
+  SCOPE: Name (firstPause) - Type (Closure) - Hash (firstPause:<sourceID>:19:24)
+  SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
+    - fooLexicalVariable2
+  SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
+    - firstPause
+    - fooVarVariable1
+  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
+    - globalLet2
+  SCOPE: Name () - Type (Global) - Hash ()
+
+---- Merged Scope Chain ----
+  SCOPE: Name (firstPause) - Type (Block) - Hash (firstPause:<sourceID>:21:29)
+    - barLexicalVariable2
+  SCOPE: Name (firstPause) - Type (Local) - Hash (firstPause:<sourceID>:21:29)
+    - barVarVariable1
+    - barLexicalVariable2
+  SCOPE: Name (firstPause) - Type (FunctionName) - Hash (firstPause:<sourceID>:21:29)
+    - firstPause
+  SCOPE: Name (firstPause) - Type (Closure) - Hash (firstPause:<sourceID>:19:24)
+    - fakeFirstPauseLexicalVariable
+  SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
+    - firstPause
+    - fooVarVariable1
+    - fooLexicalVariable2
+  SCOPE: Name () - Type (GlobalLexicalEnvironment) - Hash ()
+    - globalLet2
+  SCOPE: Name () - Type (Global) - Hash ()
+
+CALLFRAME: firstPause
+
+---- Scope Chain ----
+  SCOPE: Name (firstPause) - Type (Closure) - Hash (firstPause:<sourceID>:19:24)
+    - fakeFirstPauseLexicalVariable
   SCOPE: Name (firstPause) - Type (Closure) - Hash (firstPause:<sourceID>:19:24)
   SCOPE: Name (entry) - Type (Closure) - Hash (entry:<sourceID>:14:15)
     - fooLexicalVariable2

Modified: trunk/LayoutTests/inspector/debugger/paused-scopes.html (206104 => 206105)


--- trunk/LayoutTests/inspector/debugger/paused-scopes.html	2016-09-19 18:46:07 UTC (rev 206104)
+++ trunk/LayoutTests/inspector/debugger/paused-scopes.html	2016-09-19 18:59:22 UTC (rev 206105)
@@ -83,8 +83,8 @@
     let suite = InspectorTest.createAsyncSuite("PausedCallFrameScope");
 
     suite.addTestCase({
-        name: "TriggerFirstPause",
-        description: "Verify CallFrames and Scopes with the first pause.",
+        name: "PausedCallFrameScope.TriggerFirstPause",
+        description: "Dump CallFrames and Scopes with the first pause.",
         test: (resolve, reject) => {
             InspectorTest.evaluateInPage("setTimeout(entry)");
             WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
@@ -94,8 +94,8 @@
     });
 
     suite.addTestCase({
-        name: "TriggerSecondPause",
-        description: "Verify CallFrames and Scopes with the first pause.",
+        name: "PausedCallFrameScope.TriggerSecondPause",
+        description: "Dump CallFrames and Scopes with the second pause.",
         test: (resolve, reject) => {
             WebInspector.debuggerManager.resume();
             WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
@@ -107,6 +107,20 @@
         }
     });
 
+    suite.addTestCase({
+        name: "PausedCallFrameScope.TriggerThirdPause",
+        description: "Dump CallFrames and Scopes with the third pause.",
+        test: (resolve, reject) => {
+            WebInspector.debuggerManager.resume();
+            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
+                dumpCallFrames().then(() => {
+                    WebInspector.debuggerManager.resume();
+                    resolve();
+                }, reject);
+            });
+        }
+    });
+
     suite.runTestCasesAndFinish();
 }
 </script>

Modified: trunk/LayoutTests/inspector/debugger/resources/paused-scopes.js (206104 => 206105)


--- trunk/LayoutTests/inspector/debugger/resources/paused-scopes.js	2016-09-19 18:46:07 UTC (rev 206104)
+++ trunk/LayoutTests/inspector/debugger/resources/paused-scopes.js	2016-09-19 18:59:22 UTC (rev 206105)
@@ -25,7 +25,16 @@
                 let barLexicalVariable2 = window.navigator; // NestedBlockScope (barLexicalVariable2)
                 debugger;
                 secondPause();
+                thirdPause();
             }
         })();
     }
 }
+
+function thirdPause() {
+    let closureVariableInsideThirdPause = false;
+    (function() {
+        let localVariableInsideAnonymousFunction = true;
+        debugger;
+    })();
+}

Modified: trunk/Source/WebInspectorUI/ChangeLog (206104 => 206105)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-09-19 18:46:07 UTC (rev 206104)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-09-19 18:59:22 UTC (rev 206105)
@@ -1,3 +1,16 @@
+2016-09-19  Joseph Pecoraro  <pecor...@apple.com>
+
+        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>
+
+        Reviewed by Brian Burg.
+
+        * 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.
+
 2016-09-19  Matt Baker  <mattba...@apple.com>
 
         Web Inspector: Make it easier to create a view from an existing DOM element

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js (206104 => 206105)


--- trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js	2016-09-19 18:46:07 UTC (rev 206104)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js	2016-09-19 18:59:22 UTC (rev 206105)
@@ -35,7 +35,7 @@
 
         this._id = id || null;
         this._sourceCodeLocation = sourceCodeLocation || null;
-        this._functionName = functionName || null;
+        this._functionName = functionName || "";
         this._thisObject = thisObject || null;
         this._scopeChain = scopeChain || [];
         this._nativeCode = nativeCode || false;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to