Title: [207312] trunk
Revision
207312
Author
commit-qu...@webkit.org
Date
2016-10-13 15:20:22 -0700 (Thu, 13 Oct 2016)

Log Message

Web Inspector: Stepping highlight for dot/bracket expressions in if statements highlights subset of the _expression_
https://bugs.webkit.org/show_bug.cgi?id=163378
<rdar://problem/28749376>

Patch by Joseph Pecoraro <pecor...@apple.com> on 2016-10-13
Reviewed by Saam Barati.

Source/_javascript_Core:

* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseAssignmentExpression):
Since each _expression_ builds on the previous, always keep the starting
location the first location.

LayoutTests:

* inspector/debugger/breakpoints/resolved-dump-all-pause-locations-expected.txt:
* inspector/debugger/breakpoints/resolved-dump-each-line-expected.txt:
* inspector/debugger/breakpoints/resources/dump-general.js:
* inspector/debugger/stepping/stepping-misc-expected.txt:
* inspector/debugger/stepping/stepping-misc.html:
Add tests for these kinds of special cases.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (207311 => 207312)


--- trunk/LayoutTests/ChangeLog	2016-10-13 21:48:43 UTC (rev 207311)
+++ trunk/LayoutTests/ChangeLog	2016-10-13 22:20:22 UTC (rev 207312)
@@ -1,3 +1,18 @@
+2016-10-13  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Stepping highlight for dot/bracket expressions in if statements highlights subset of the _expression_
+        https://bugs.webkit.org/show_bug.cgi?id=163378
+        <rdar://problem/28749376>
+
+        Reviewed by Saam Barati.
+
+        * inspector/debugger/breakpoints/resolved-dump-all-pause-locations-expected.txt:
+        * inspector/debugger/breakpoints/resolved-dump-each-line-expected.txt:
+        * inspector/debugger/breakpoints/resources/dump-general.js:
+        * inspector/debugger/stepping/stepping-misc-expected.txt:
+        * inspector/debugger/stepping/stepping-misc.html:
+        Add tests for these kinds of special cases.
+
 2016-10-13  Antoine Quint  <grao...@apple.com>
 
         [Modern Media Controls] MediaControls base class

Modified: trunk/LayoutTests/inspector/debugger/breakpoints/resolved-dump-all-pause-locations-expected.txt (207311 => 207312)


--- trunk/LayoutTests/inspector/debugger/breakpoints/resolved-dump-all-pause-locations-expected.txt	2016-10-13 21:48:43 UTC (rev 207311)
+++ trunk/LayoutTests/inspector/debugger/breakpoints/resolved-dump-all-pause-locations-expected.txt	2016-10-13 22:20:22 UTC (rev 207312)
@@ -1256,8 +1256,76 @@
     199    
  => 200    |a(a(), b());
     201    
+    202    if (o1.p1)
+    203        a();
 
+INSERTING AT: 200:1
+PAUSES AT: 202:4
+    197    var t1 = `${1} ${x=1} ${a()}`;
+    198    var t2 = a`${1} ${x=1} ${a()}`;
+    199    
+ -> 200    a#(a(), b());
+    201    
+ => 202    if (|o1.p1)
+    203        a();
+    204    
+    205    if (o1["p1"])
 
+INSERTING AT: 202:5
+PAUSES AT: 203:4
+    199    
+    200    a(a(), b());
+    201    
+ -> 202    if (o#1.p1)
+ => 203        |a();
+    204    
+    205    if (o1["p1"])
+    206        a();
+
+INSERTING AT: 203:5
+PAUSES AT: 205:4
+    200    a(a(), b());
+    201    
+    202    if (o1.p1)
+ -> 203        a#();
+    204    
+ => 205    if (|o1["p1"])
+    206        a();
+    207    
+    208    if (String.raw`test`)
+
+INSERTING AT: 205:5
+PAUSES AT: 206:4
+    202    if (o1.p1)
+    203        a();
+    204    
+ -> 205    if (o#1["p1"])
+ => 206        |a();
+    207    
+    208    if (String.raw`test`)
+    209        a();
+
+INSERTING AT: 206:5
+PAUSES AT: 208:4
+    203        a();
+    204    
+    205    if (o1["p1"])
+ -> 206        a#();
+    207    
+ => 208    if (|String.raw`test`)
+    209        a();
+    210    
+
+INSERTING AT: 208:5
+PAUSES AT: 209:4
+    205    if (o1["p1"])
+    206        a();
+    207    
+ -> 208    if (S#tring.raw`test`)
+ => 209        |a();
+    210    
+
+
 -- Running test case: Debugger.resolvedBreakpoint.dumpAllLocations.Functions
 
 INSERTING AT: 0:0

Modified: trunk/LayoutTests/inspector/debugger/breakpoints/resolved-dump-each-line-expected.txt (207311 => 207312)


--- trunk/LayoutTests/inspector/debugger/breakpoints/resolved-dump-each-line-expected.txt	2016-10-13 21:48:43 UTC (rev 207311)
+++ trunk/LayoutTests/inspector/debugger/breakpoints/resolved-dump-each-line-expected.txt	2016-10-13 22:20:22 UTC (rev 207312)
@@ -2926,6 +2926,8 @@
  -> 199    #
  => 200    |a(a(), b());
     201    
+    202    if (o1.p1)
+    203        a();
 
 
 INSERTING AT: 200:0
@@ -2935,9 +2937,109 @@
     199    
 -=> 200    |a(a(), b());
     201    
+    202    if (o1.p1)
+    203        a();
 
 
 INSERTING AT: 201:0
+PAUSES AT: 202:4
+    198    var t2 = a`${1} ${x=1} ${a()}`;
+    199    
+    200    a(a(), b());
+ -> 201    #
+ => 202    if (|o1.p1)
+    203        a();
+    204    
+    205    if (o1["p1"])
+
+
+INSERTING AT: 202:0
+PAUSES AT: 202:4
+    199    
+    200    a(a(), b());
+    201    
+-=> 202    #if (|o1.p1)
+    203        a();
+    204    
+    205    if (o1["p1"])
+
+
+INSERTING AT: 203:0
+PAUSES AT: 203:4
+    200    a(a(), b());
+    201    
+    202    if (o1.p1)
+-=> 203    #    |a();
+    204    
+    205    if (o1["p1"])
+    206        a();
+
+
+INSERTING AT: 204:0
+PAUSES AT: 205:4
+    201    
+    202    if (o1.p1)
+    203        a();
+ -> 204    #
+ => 205    if (|o1["p1"])
+    206        a();
+    207    
+    208    if (String.raw`test`)
+
+
+INSERTING AT: 205:0
+PAUSES AT: 205:4
+    202    if (o1.p1)
+    203        a();
+    204    
+-=> 205    #if (|o1["p1"])
+    206        a();
+    207    
+    208    if (String.raw`test`)
+
+
+INSERTING AT: 206:0
+PAUSES AT: 206:4
+    203        a();
+    204    
+    205    if (o1["p1"])
+-=> 206    #    |a();
+    207    
+    208    if (String.raw`test`)
+    209        a();
+
+
+INSERTING AT: 207:0
+PAUSES AT: 208:4
+    204    
+    205    if (o1["p1"])
+    206        a();
+ -> 207    #
+ => 208    if (|String.raw`test`)
+    209        a();
+    210    
+
+
+INSERTING AT: 208:0
+PAUSES AT: 208:4
+    205    if (o1["p1"])
+    206        a();
+    207    
+-=> 208    #if (|String.raw`test`)
+    209        a();
+    210    
+
+
+INSERTING AT: 209:0
+PAUSES AT: 209:4
+    206        a();
+    207    
+    208    if (String.raw`test`)
+-=> 209    #    |a();
+    210    
+
+
+INSERTING AT: 210:0
 PRODUCES: Could not resolve breakpoint
 
 -- Running test case: Debugger.resolvedBreakpoint.dumpEachLine.Functions

Modified: trunk/LayoutTests/inspector/debugger/breakpoints/resources/dump-general.js (207311 => 207312)


--- trunk/LayoutTests/inspector/debugger/breakpoints/resources/dump-general.js	2016-10-13 21:48:43 UTC (rev 207311)
+++ trunk/LayoutTests/inspector/debugger/breakpoints/resources/dump-general.js	2016-10-13 22:20:22 UTC (rev 207312)
@@ -199,3 +199,12 @@
 var t2 = a`${1} ${x=1} ${a()}`;
 
 a(a(), b());
+
+if (o1.p1)
+    a();
+
+if (o1["p1"])
+    a();
+
+if (String.raw`test`)
+    a();

Modified: trunk/LayoutTests/inspector/debugger/stepping/stepping-misc-expected.txt (207311 => 207312)


--- trunk/LayoutTests/inspector/debugger/stepping/stepping-misc-expected.txt	2016-10-13 21:48:43 UTC (rev 207311)
+++ trunk/LayoutTests/inspector/debugger/stepping/stepping-misc-expected.txt	2016-10-13 22:20:22 UTC (rev 207312)
@@ -475,7 +475,7 @@
  ->  71        |var [w, z] = arr;
      72    }
      73    
-     74    
+     74    function entryIfWithDotExpression() {
 
 ACTION: step-in
 PAUSE AT entryDestructuring:73:2
@@ -484,10 +484,151 @@
      71        var [w, z] = arr;
  ->  72    }|
      73    
-     74    
-     75    // FIXME: Not Yet Tested
+     74    function entryIfWithDotExpression() {
+     75        var o = {condition: true};
 
 ACTION: resume
 RESUMED
 PASS: Should have used all steps.
 
+-- Running test case: Debugger.stepping.IfWithDotExpression
+_expression_: setTimeout(entryIfWithDotExpression)
+STEPS: over, in, over, resume
+PAUSED (debugger-statement)
+PAUSE AT entryIfWithDotExpression:77:5
+     73    
+     74    function entryIfWithDotExpression() {
+     75        var o = {condition: true};
+ ->  76        |debugger;
+     77        if (o.condition)
+     78            a();
+     79    }
+
+ACTION: step-over
+PAUSE AT entryIfWithDotExpression:78:9
+     74    function entryIfWithDotExpression() {
+     75        var o = {condition: true};
+     76        debugger;
+ ->  77        if (|o.condition)
+     78            a();
+     79    }
+     80    
+
+ACTION: step-in
+PAUSE AT entryIfWithDotExpression:79:9
+     75        var o = {condition: true};
+     76        debugger;
+     77        if (o.condition)
+ ->  78            |a();
+     79    }
+     80    
+     81    function entryIfWithBracketExpression() {
+
+ACTION: step-over
+PAUSE AT entryIfWithDotExpression:80:2
+     76        debugger;
+     77        if (o.condition)
+     78            a();
+ ->  79    }|
+     80    
+     81    function entryIfWithBracketExpression() {
+     82        var o = {condition: true};
+
+ACTION: resume
+RESUMED
+PASS: Should have used all steps.
+
+-- Running test case: Debugger.stepping.IfWithBracketExpression
+_expression_: setTimeout(entryIfWithBracketExpression)
+STEPS: over, in, over, resume
+PAUSED (debugger-statement)
+PAUSE AT entryIfWithBracketExpression:84:5
+     80    
+     81    function entryIfWithBracketExpression() {
+     82        var o = {condition: true};
+ ->  83        |debugger;
+     84        if (o["condition"])
+     85            a();
+     86    }
+
+ACTION: step-over
+PAUSE AT entryIfWithBracketExpression:85:9
+     81    function entryIfWithBracketExpression() {
+     82        var o = {condition: true};
+     83        debugger;
+ ->  84        if (|o["condition"])
+     85            a();
+     86    }
+     87    
+
+ACTION: step-in
+PAUSE AT entryIfWithBracketExpression:86:9
+     82        var o = {condition: true};
+     83        debugger;
+     84        if (o["condition"])
+ ->  85            |a();
+     86    }
+     87    
+     88    function entryIfWithTaggedTemplate() {
+
+ACTION: step-over
+PAUSE AT entryIfWithBracketExpression:87:2
+     83        debugger;
+     84        if (o["condition"])
+     85            a();
+ ->  86    }|
+     87    
+     88    function entryIfWithTaggedTemplate() {
+     89        debugger;
+
+ACTION: resume
+RESUMED
+PASS: Should have used all steps.
+
+-- Running test case: Debugger.stepping.IfWithTaggedTemplate
+_expression_: setTimeout(entryIfWithTaggedTemplate)
+STEPS: over, in, over, resume
+PAUSED (debugger-statement)
+PAUSE AT entryIfWithTaggedTemplate:90:5
+     86    }
+     87    
+     88    function entryIfWithTaggedTemplate() {
+ ->  89        |debugger;
+     90        if (String.raw`test`)
+     91            a();
+     92    }
+
+ACTION: step-over
+PAUSE AT entryIfWithTaggedTemplate:91:9
+     87    
+     88    function entryIfWithTaggedTemplate() {
+     89        debugger;
+ ->  90        if (|String.raw`test`)
+     91            a();
+     92    }
+     93    
+
+ACTION: step-in
+PAUSE AT entryIfWithTaggedTemplate:92:9
+     88    function entryIfWithTaggedTemplate() {
+     89        debugger;
+     90        if (String.raw`test`)
+ ->  91            |a();
+     92    }
+     93    
+     94    
+
+ACTION: step-over
+PAUSE AT entryIfWithTaggedTemplate:93:2
+     89        debugger;
+     90        if (String.raw`test`)
+     91            a();
+ ->  92    }|
+     93    
+     94    
+     95    // FIXME: Not Yet Tested
+
+ACTION: resume
+RESUMED
+PASS: Should have used all steps.
+

Modified: trunk/LayoutTests/inspector/debugger/stepping/stepping-misc.html (207311 => 207312)


--- trunk/LayoutTests/inspector/debugger/stepping/stepping-misc.html	2016-10-13 21:48:43 UTC (rev 207311)
+++ trunk/LayoutTests/inspector/debugger/stepping/stepping-misc.html	2016-10-13 22:20:22 UTC (rev 207312)
@@ -72,7 +72,27 @@
     var [w, z] = arr;
 }
 
+function entryIfWithDotExpression() {
+    var o = {condition: true};
+    debugger;
+    if (o.condition)
+        a();
+}
 
+function entryIfWithBracketExpression() {
+    var o = {condition: true};
+    debugger;
+    if (o["condition"])
+        a();
+}
+
+function entryIfWithTaggedTemplate() {
+    debugger;
+    if (String.raw`test`)
+        a();
+}
+
+
 // FIXME: Not Yet Tested
 // - Iterators
 // - Spread (...)
@@ -188,6 +208,42 @@
         ]
     });
 
+    addSteppingTestCase({
+        name: "Debugger.stepping.IfWithDotExpression",
+        description: "Should step to the entire _expression_, not the dot.",
+        _expression_: "setTimeout(entryIfWithDotExpression)",
+        steps: [
+            "over",
+                "in",    // o.condition
+                "over",  // a
+            "resume",
+        ]
+    });
+
+    addSteppingTestCase({
+        name: "Debugger.stepping.IfWithBracketExpression",
+        description: "Should step to the entire _expression_, not the bracket dot.",
+        _expression_: "setTimeout(entryIfWithBracketExpression)",
+        steps: [
+            "over",
+                "in",    // o["condition"]
+                "over",  // a
+            "resume",
+        ]
+    });
+
+    addSteppingTestCase({
+        name: "Debugger.stepping.IfWithTaggedTemplate",
+        description: "Should step to the entire _expression_, not the template.",
+        _expression_: "setTimeout(entryIfWithTaggedTemplate)",
+        steps: [
+            "over",
+                "in",    // String.raw`test`
+                "over",  // a
+            "resume",
+        ]
+    });
+
     loadMainPageContent().then(() => {
         suite.runTestCasesAndFinish();
     });

Modified: trunk/Source/_javascript_Core/ChangeLog (207311 => 207312)


--- trunk/Source/_javascript_Core/ChangeLog	2016-10-13 21:48:43 UTC (rev 207311)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-10-13 22:20:22 UTC (rev 207312)
@@ -1,3 +1,16 @@
+2016-10-13  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Stepping highlight for dot/bracket expressions in if statements highlights subset of the _expression_
+        https://bugs.webkit.org/show_bug.cgi?id=163378
+        <rdar://problem/28749376>
+
+        Reviewed by Saam Barati.
+
+        * parser/Parser.cpp:
+        (JSC::Parser<LexerType>::parseAssignmentExpression):
+        Since each _expression_ builds on the previous, always keep the starting
+        location the first location.
+
 2016-10-13  Per Arne Vollan  <pvol...@apple.com>
 
         [Win64] Compile fix.

Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (207311 => 207312)


--- trunk/Source/_javascript_Core/parser/Parser.cpp	2016-10-13 21:48:43 UTC (rev 207311)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp	2016-10-13 22:20:22 UTC (rev 207312)
@@ -4484,7 +4484,7 @@
             int initialAssignments = m_parserState.assignmentCount;
             TreeExpression property = parseExpression(context);
             failIfFalse(property, "Cannot parse subscript _expression_");
-            base = context.createBracketAccess(location, base, property, initialAssignments != m_parserState.assignmentCount, expressionStart, expressionEnd, tokenEndPosition());
+            base = context.createBracketAccess(startLocation, base, property, initialAssignments != m_parserState.assignmentCount, expressionStart, expressionEnd, tokenEndPosition());
             
             if (UNLIKELY(baseIsSuper && currentScope()->isArrowFunction()))
                 currentFunctionScope()->setInnerArrowFunctionUsesSuperProperty();
@@ -4542,7 +4542,7 @@
             JSTextPosition expressionEnd = lastTokenEndPosition();
             nextExpectIdentifier(LexerFlagsIgnoreReservedWords | TreeBuilder::DontBuildKeywords);
             matchOrFail(IDENT, "Expected a property name after '.'");
-            base = context.createDotAccess(location, base, m_token.m_data.ident, expressionStart, expressionEnd, tokenEndPosition());
+            base = context.createDotAccess(startLocation, base, m_token.m_data.ident, expressionStart, expressionEnd, tokenEndPosition());
             if (UNLIKELY(baseIsSuper && currentScope()->isArrowFunction()))
                 currentFunctionScope()->setInnerArrowFunctionUsesSuperProperty();
             next();
@@ -4554,7 +4554,7 @@
             int nonLHSCount = m_parserState.nonLHSCount;
             typename TreeBuilder::TemplateLiteral templateLiteral = parseTemplateLiteral(context, LexerType::RawStringsBuildMode::BuildRawStrings);
             failIfFalse(templateLiteral, "Cannot parse template literal");
-            base = context.createTaggedTemplate(location, base, templateLiteral, expressionStart, expressionEnd, lastTokenEndPosition());
+            base = context.createTaggedTemplate(startLocation, base, templateLiteral, expressionStart, expressionEnd, lastTokenEndPosition());
             m_parserState.nonLHSCount = nonLHSCount;
             break;
         }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to