Changeset 198585 in webkit


Ignore:
Timestamp:
Mar 23, 2016, 8:53:52 AM (9 years ago)
Author:
timothy@apple.com
Message:

Web Inspector: String double quoting in the console and elsewhere needs to escape backslash too

https://bugs.webkit.org/show_bug.cgi?id=155752
rdar://problem/25293141

Reviewed by Joseph Pecoraro.

  • UserInterface/Base/Utilities.js:

(doubleQuotedString): Escape backslashes too.

  • UserInterface/Views/FormattedValue.js:

(WebInspector.FormattedValue.createLinkifiedElementString): Ditto.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r198563 r198585  
     12016-03-22  Timothy Hatcher  <timothy@apple.com>
     2
     3        Web Inspector: String double quoting in the console and elsewhere needs to escape backslash too
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=155752
     6        rdar://problem/25293141
     7
     8        Reviewed by Joseph Pecoraro.
     9
     10        * UserInterface/Base/Utilities.js:
     11        (doubleQuotedString): Escape backslashes too.
     12        * UserInterface/Views/FormattedValue.js:
     13        (WebInspector.FormattedValue.createLinkifiedElementString): Ditto.
     14
    1152016-03-22  Joseph Pecoraro  <pecoraro@apple.com>
    216
  • trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js

    r198555 r198585  
    11991199function doubleQuotedString(str)
    12001200{
    1201     return "\"" + str.replace(/"/g, "\\\"") + "\"";
     1201    return "\"" + str.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\"";
    12021202}
    12031203
  • trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js

    r197954 r198585  
    4040    var span = document.createElement("span");
    4141    span.className = "formatted-string";
    42     span.append("\"", WebInspector.linkifyStringAsFragment(string.replace(/"/g, "\\\"")), "\"");
     42    span.append("\"", WebInspector.linkifyStringAsFragment(string.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")), "\"");
    4343    return span;
    4444};
Note: See TracChangeset for help on using the changeset viewer.