Changeset 141547 in webkit


Ignore:
Timestamp:
Feb 1, 2013 12:19:35 AM (11 years ago)
Author:
vsevik@chromium.org
Message:

Web Inspector: Use String.prototype.startsWith instead of String.prototype.indexOf when possible
https://bugs.webkit.org/show_bug.cgi?id=108575

Reviewed by Yury Semikhatsky.

Source/WebCore:

  • inspector/front-end/FileMapping.js:

(WebInspector.FileMapping.prototype._entryMatchesURL):
(WebInspector.FileMapping.prototype.urlForURI):

  • inspector/front-end/FileSystemMapping.js:

(get WebInspector.FileSystemMappingImpl.prototype.fileForURI):
(get WebInspector.FileSystemMappingImpl.prototype.uriForPath):

LayoutTests:

  • http/tests/inspector/console-cd-completions.html:
  • http/tests/inspector/console-cd.html:
  • http/tests/inspector/indexeddb/indexeddb-test.js:

(initialize_IndexedDBTest.InspectorTest._installIndexedDBSniffer.consoleMessageOverride):
(initialize_IndexedDBTest.InspectorTest._installIndexedDBSniffer):

  • inspector/network-status-non-http.html:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r141545 r141547  
     12013-02-01  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: Use String.prototype.startsWith instead of String.prototype.indexOf when possible
     4        https://bugs.webkit.org/show_bug.cgi?id=108575
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        * http/tests/inspector/console-cd-completions.html:
     9        * http/tests/inspector/console-cd.html:
     10        * http/tests/inspector/indexeddb/indexeddb-test.js:
     11        (initialize_IndexedDBTest.InspectorTest._installIndexedDBSniffer.consoleMessageOverride):
     12        (initialize_IndexedDBTest.InspectorTest._installIndexedDBSniffer):
     13        * inspector/network-status-non-http.html:
     14
    1152013-01-31  Aurimas Liutikas  <aurimas@chromium.org>
    216
  • trunk/LayoutTests/http/tests/inspector/console-cd-completions.html

    r130119 r141547  
    1111    var option = selector.firstChild;
    1212    while (option) {
    13         if (option.textContent && option.textContent.indexOf("myIFrame") === 0)
     13        if (option.textContent && option.textContent.startsWith("myIFrame"))
    1414            break;
    1515        option = option.nextSibling;
  • trunk/LayoutTests/http/tests/inspector/console-cd.html

    r127412 r141547  
    1212    var option = selector.firstChild;
    1313    while (option) {
    14         if (option.textContent && option.textContent.indexOf("myIFrame") === 0)
     14        if (option.textContent && option.textContent.startsWith("myIFrame"))
    1515            break;
    1616        option = option.nextSibling;
  • trunk/LayoutTests/http/tests/inspector/indexeddb/indexeddb-test.js

    r135365 r141547  
    5454    {
    5555        var text = msg._messageText;
    56         if (text.indexOf(callbackIdPrefix) !== 0) {
     56        if (!text.startsWith(callbackIdPrefix)) {
    5757            InspectorTest.addConsoleSniffer(consoleMessageOverride, false);
    5858            return;
  • trunk/LayoutTests/inspector/network-status-non-http.html

    r115720 r141547  
    2222                var outputStatus = status.stringValue;
    2323                // Truncate the status string on failure, since the description following "(failed)" is platform-dependent.
    24                 if (outputStatus.indexOf("(failed)") == 0)
     24                if (outputStatus.startsWith("(failed)"))
    2525                    outputStatus = "(failed)";
    2626                outputStrings.push(urlFragment + ": " + outputStatus);
  • trunk/Source/WebCore/ChangeLog

    r141545 r141547  
     12013-02-01  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: Use String.prototype.startsWith instead of String.prototype.indexOf when possible
     4        https://bugs.webkit.org/show_bug.cgi?id=108575
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        * inspector/front-end/FileMapping.js:
     9        (WebInspector.FileMapping.prototype._entryMatchesURL):
     10        (WebInspector.FileMapping.prototype.urlForURI):
     11        * inspector/front-end/FileSystemMapping.js:
     12        (get WebInspector.FileSystemMappingImpl.prototype.fileForURI):
     13        (get WebInspector.FileSystemMappingImpl.prototype.uriForPath):
     14
    1152013-01-31  Aurimas Liutikas  <aurimas@chromium.org>
    216
  • trunk/Source/WebCore/inspector/front-end/FileMapping.js

    r140124 r141547  
    5050    _entryMatchesURL: function(entry, url)
    5151    {
    52         return url.indexOf(entry.urlPrefix) === 0;
     52        return url.startsWith(entry.urlPrefix);
    5353    },
    5454   
     
    105105            var entry = this._entries[i];
    106106            var uriPrefix = this._entryURIPrefix(entry);
    107             if (uriPrefix && uri.indexOf(uriPrefix) === 0)
     107            if (uriPrefix && uri.startsWith(uriPrefix))
    108108                return entry.urlPrefix + uri.substring(uriPrefix.length);
    109109        }
  • trunk/Source/WebCore/inspector/front-end/FileSystemMapping.js

    r139978 r141547  
    165165        for (var fileSystemPath in this._mappedNames) {
    166166            var uriPrefix = this._uriPrefixForMappedName(this._mappedNames[fileSystemPath]);
    167             if (uri.indexOf(uriPrefix) === 0)
     167            if (uri.startsWith(uriPrefix))
    168168                return new WebInspector.FileSystemMapping.FileDescriptor(fileSystemPath, "/" + uri.substring(uriPrefix.length));
    169169        }
     
    188188    {
    189189        for (var fileSystemPath in this._mappedNames) {
    190             if (path.indexOf(fileSystemPath) === 0) {
     190            if (path.startsWith(fileSystemPath)) {
    191191                var uriPrefix = this._uriPrefixForMappedName(this._mappedNames[fileSystemPath]);
    192192                var subPath = path.substring(fileSystemPath.length);
Note: See TracChangeset for help on using the changeset viewer.