Changeset 245741 in webkit


Ignore:
Timestamp:
May 23, 2019 8:19:52 PM (5 years ago)
Author:
Devin Rousso
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):

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r245730 r245741  
     12019-05-23  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: prevent stripping `console.assert` if it's used inside a string
     4        https://bugs.webkit.org/show_bug.cgi?id=198207
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        * Scripts/remove-console-asserts.pl:
     9        (removeConsoleAssertsInFile):
     10
    1112019-05-23  Devin Rousso  <drousso@apple.com>
    212
  • trunk/Source/WebInspectorUI/Scripts/remove-console-asserts.pl

    r226395 r245741  
    5050        }
    5151
    52         s/\s*console\.assert\(.*\);\s*//g;
     52        s/^\s*console\.assert\(.*\);\s*//g;
    5353        print $out $_;
    5454        $previousLine = $_ if $_ !~ /^\s*$/;
     
    5656        # If console.assert is still on the line, either we missed a semicolon or it is multi-line. These did not get stripped.
    5757        if ($_ =~ /\s*console\.assert\(/) {
     58            # Allow "console.assert()" to be used as part of a string.
     59            next if /^.*?["'`].*?console\.assert/;
     60
     61            # Allow "console.assert()" to be used as part of a comment.
     62            next if /^.*?(\/\/|\/\*).*?console\.assert/;
     63
    5864            if ($_ =~ /\)\s*$/) {
    5965                print "WARNING: console.assert missing trailing semicolon on line $.: $_" ;
Note: See TracChangeset for help on using the changeset viewer.