Changeset 245165 in webkit


Ignore:
Timestamp:
May 9, 2019 5:12:31 PM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: Uncaught Exception: null is not an object (evaluating 'url.startsWith')
https://bugs.webkit.org/show_bug.cgi?id=196662
<rdar://problem/49659633>

Reviewed by Timothy Hatcher.

  • UserInterface/Views/ConsoleMessageView.js:

(WI.ConsoleMessageView.prototype._appendLocationLink):
(WI.ConsoleMessageView.prototype._linkifyLocation): Deleted.

  • UserInterface/Base/Main.js:

(WI.linkifyLocation):
(WI.linkifySourceCode): Added.
Split the logic into two functions, as there's no need to re-fetch the SourceCode from a
given url if you already have the SourceCode in the caller.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r245060 r245165  
     12019-05-09  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Uncaught Exception: null is not an object (evaluating 'url.startsWith')
     4        https://bugs.webkit.org/show_bug.cgi?id=196662
     5        <rdar://problem/49659633>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * UserInterface/Views/ConsoleMessageView.js:
     10        (WI.ConsoleMessageView.prototype._appendLocationLink):
     11        (WI.ConsoleMessageView.prototype._linkifyLocation): Deleted.
     12
     13        * UserInterface/Base/Main.js:
     14        (WI.linkifyLocation):
     15        (WI.linkifySourceCode): Added.
     16        Split the logic into two functions, as there's no need to re-fetch the `SourceCode` from a
     17        given url if you already have the `SourceCode` in the caller.
     18
    1192019-05-08  Ryan Haddad  <ryanhaddad@apple.com>
    220
  • trunk/Source/WebInspectorUI/UserInterface/Base/Main.js

    r244318 r245165  
    28502850{
    28512851    var sourceCode = WI.sourceCodeForURL(url);
    2852 
    2853     if (!sourceCode) {
    2854         var anchor = document.createElement("a");
    2855         anchor.href = url;
    2856         anchor.lineNumber = sourceCodePosition.lineNumber;
    2857         if (options.className)
    2858             anchor.className = options.className;
    2859         anchor.append(WI.displayNameForURL(url) + ":" + sourceCodePosition.lineNumber);
    2860         return anchor;
    2861     }
    2862 
     2852    if (sourceCode)
     2853        return WI.linkifySourceCode(sourceCode);
     2854
     2855    var anchor = document.createElement("a");
     2856    anchor.href = url;
     2857    anchor.lineNumber = sourceCodePosition.lineNumber;
     2858    if (options.className)
     2859        anchor.className = options.className;
     2860    anchor.append(WI.displayNameForURL(url) + ":" + sourceCodePosition.lineNumber);
     2861    return anchor;
     2862};
     2863
     2864WI.linkifySourceCode = function(sourceCode, sourceCodePosition, options = {})
     2865{
    28632866    let sourceCodeLocation = sourceCode.createSourceCodeLocation(sourceCodePosition.lineNumber, sourceCodePosition.columnNumber);
    28642867    let linkElement = WI.createSourceCodeLocationLink(sourceCodeLocation, {
  • trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js

    r243355 r245165  
    377377                    return;
    378378
    379                 var link = this._linkifyLocation(result.sourceCode.sourceURL || result.sourceCode.url, result.lineNumber, result.columnNumber);
     379                let link = WI.linkifySourceCode(result.sourceCode, new WI.SourceCodePosition(result.lineNumber, result.columnNumber), {
     380                    className: "console-message-url",
     381                    ignoreNetworkTab: true,
     382                    ignoreSearchTab: true,
     383                });
    380384                link.classList.add("console-message-location");
    381385
     
    767771    }
    768772
    769     _linkifyLocation(url, lineNumber, columnNumber)
    770     {
    771         const options = {
    772             className: "console-message-url",
    773             ignoreNetworkTab: true,
    774             ignoreSearchTab: true,
    775         };
    776         return WI.linkifyLocation(url, new WI.SourceCodePosition(lineNumber, columnNumber), options);
    777     }
    778 
    779773    _userProvidedColumnNames(columnNamesArgument)
    780774    {
Note: See TracChangeset for help on using the changeset viewer.