Title: [245741] trunk/Source/WebInspectorUI
Revision
245741
Author
[email protected]
Date
2019-05-23 20:19:52 -0700 (Thu, 23 May 2019)

Log Message

Web Inspector: prevent stripping `console.assert` if it's used inside a string
https://bugs.webkit.org/show_bug.cgi?id=198207

Reviewed by Joseph Pecoraro.

* Scripts/remove-console-asserts.pl:
(removeConsoleAssertsInFile):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (245740 => 245741)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-05-24 02:55:34 UTC (rev 245740)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-05-24 03:19:52 UTC (rev 245741)
@@ -1,5 +1,15 @@
 2019-05-23  Devin Rousso  <[email protected]>
 
+        Web Inspector: prevent stripping `console.assert` if it's used inside a string
+        https://bugs.webkit.org/show_bug.cgi?id=198207
+
+        Reviewed by Joseph Pecoraro.
+
+        * Scripts/remove-console-asserts.pl:
+        (removeConsoleAssertsInFile):
+
+2019-05-23  Devin Rousso  <[email protected]>
+
         Web Inspector: Overlay: rulers/guides should be shown whenever element selection is enabled
         https://bugs.webkit.org/show_bug.cgi?id=198088
 

Modified: trunk/Source/WebInspectorUI/Scripts/remove-console-asserts.pl (245740 => 245741)


--- trunk/Source/WebInspectorUI/Scripts/remove-console-asserts.pl	2019-05-24 02:55:34 UTC (rev 245740)
+++ trunk/Source/WebInspectorUI/Scripts/remove-console-asserts.pl	2019-05-24 03:19:52 UTC (rev 245741)
@@ -49,12 +49,18 @@
             }
         }
 
-        s/\s*console\.assert\(.*\);\s*//g;
+        s/^\s*console\.assert\(.*\);\s*//g;
         print $out $_;
         $previousLine = $_ if $_ !~ /^\s*$/;
 
         # If console.assert is still on the line, either we missed a semicolon or it is multi-line. These did not get stripped.
         if ($_ =~ /\s*console\.assert\(/) {
+            # Allow "console.assert()" to be used as part of a string.
+            next if /^.*?["'`].*?console\.assert/;
+
+            # Allow "console.assert()" to be used as part of a comment.
+            next if /^.*?(\/\/|\/\*).*?console\.assert/;
+
             if ($_ =~ /\)\s*$/) {
                 print "WARNING: console.assert missing trailing semicolon on line $.: $_" ;
             } else {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to