* SUMMARY When debugging javascript paused in the debugger, hovering over a line of the form ++n actually mutates the value of n. n++ does not have this behavior. * TEST <script type="text/javascript"> function test() { debugger; var n = 0; console.log(n); // Hover over next line. n shouldn't change n++; console.log(n); // Hover over next line. n changes but shouldn't ++n; console.log(n); } document.onload = test(); </script> * STEPS TO REPRODUCE 1. Inspect test case 2. Reload or type test() into the console 3. Test hovering over n++ and see it doesn't mutate 4. Test hovering over ++n and see that it mutates n every time you hover over it
<rdar://problem/19018280>
Created attachment 241796 [details] [PATCH] Proposed Fix
<rdar://problem/18995374>
Comment on attachment 241796 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=241796&action=review > Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js:490 > + if (isExpression && token.string === "++") What about --?
(In reply to comment #4) > Comment on attachment 241796 [details] > [PATCH] Proposed Fix > > View in context: > https://bugs.webkit.org/attachment.cgi?id=241796&action=review > > > Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js:490 > > + if (isExpression && token.string === "++") > > What about --? Doh! Tim also caught other operators, like: n+=n; I'll put up another patch.
Created attachment 241810 [details] [PATCH] Proposed Fix
Comment on attachment 241810 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=241810&action=review > Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js:492 > + // Disallow operators. We want the hovered expression to be just a single operand. > + // Also, some operators can modify values, such as pre-increment and assignment operators. > + if (isExpression && token.type.contains("operator")) > + break; Nice!
Comment on attachment 241810 [details] [PATCH] Proposed Fix Clearing flags on attachment: 241810 Committed r176325: <http://trac.webkit.org/changeset/176325>
All reviewed patches have been landed. Closing bug.