Changeset 58318 in webkit


Ignore:
Timestamp:
Apr 27, 2010 11:47:44 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-04-27 Andrey Kosyakov <caseq@chromium.org>

Reviewed by Yury Semikhatsky.

Log error message to inspector console if a resource fails to load.
Moved console-tests.js to http tests. Added support for sorting
console messages, in case order may vary.
https://bugs.webkit.org/show_bug.cgi?id=37215

  • http/tests/inspector/console-resource-errors-expected.txt: Added.
  • http/tests/inspector/console-resource-errors.html: Added.
  • http/tests/inspector/console-tests.js: Added. (dumpConsoleMessages.callback): (dumpConsoleMessages): (dumpConsoleMessagesWithClasses.callback): (dumpConsoleMessagesWithClasses): (frontend_dumpConsoleMessages):
  • inspector/console-clear.html:
  • inspector/console-dir.html:
  • inspector/console-dirxml.html:
  • inspector/console-format-collections-expected.txt:
  • inspector/console-format-collections.html:
  • inspector/console-format.html:
  • inspector/console-log-before-inspector-open.html:
  • inspector/console-tests.html:
  • inspector/console-tests.js: Removed.

2010-04-27 Andrey Kosyakov <caseq@chromium.org>

Reviewed by Yury Semikhatsky.

Log error message to inspector console if a resource fails to load.
Disable checking of mime-type consistency for failed resources.
https://bugs.webkit.org/show_bug.cgi?id=37215

Test: http/tests/inspector/console-resource-errors.html

  • inspector/InspectorController.cpp: (WebCore::InspectorController::didReceiveResponse): (WebCore::InspectorController::didFailLoading):
  • inspector/front-end/Resource.js: (WebInspector.Resource.prototype._mimeTypeIsConsistentWithType):
  • inspector/front-end/ResourcesPanel.js: (WebInspector.ResourcesPanel.prototype.recreateViewForResourceIfNeeded):
Location:
trunk
Files:
2 added
13 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r58313 r58318  
     12010-04-27  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Log error message to inspector console if a resource fails to load.
     6        Moved console-tests.js to http tests. Added support for sorting
     7        console messages, in case order may vary.
     8        https://bugs.webkit.org/show_bug.cgi?id=37215
     9
     10        * http/tests/inspector/console-resource-errors-expected.txt: Added.
     11        * http/tests/inspector/console-resource-errors.html: Added.
     12        * http/tests/inspector/console-tests.js: Added.
     13        (dumpConsoleMessages.callback):
     14        (dumpConsoleMessages):
     15        (dumpConsoleMessagesWithClasses.callback):
     16        (dumpConsoleMessagesWithClasses):
     17        (frontend_dumpConsoleMessages):
     18        * inspector/console-clear.html:
     19        * inspector/console-dir.html:
     20        * inspector/console-dirxml.html:
     21        * inspector/console-format-collections-expected.txt:
     22        * inspector/console-format-collections.html:
     23        * inspector/console-format.html:
     24        * inspector/console-log-before-inspector-open.html:
     25        * inspector/console-tests.html:
     26        * inspector/console-tests.js: Removed.
     27
    1282010-04-27  Joseph Pecoraro  <joepeck@webkit.org>
    229
  • trunk/LayoutTests/http/tests/inspector/console-tests.js

    • Property svn:executable deleted
    r58317 r58318  
    1212}
    1313
    14 function dumpConsoleMessagesWithClasses() {
     14function dumpConsoleMessagesWithClasses(sortMessages) {
    1515    function callback(result)
    1616    {
     17        var messages = [];
    1718        for (var i = 0; i < result.length; ++i)
    18             output(result[i].text + " " + result[i].clazz);
     19            messages.push(result[i].text + " " + result[i].clazz);
     20        if (sortMessages)
     21            messages.sort();
     22        for (var i = 0; i < messages.length; ++i)
     23            output(messages[i]);
    1924        notifyDone();
    2025    }
  • trunk/LayoutTests/inspector/console-clear.html

    r54659 r58318  
    22<head>
    33<script src="../http/tests/inspector/inspector-test.js"></script>
    4 <script src="console-tests.js"></script>
     4<script src="../http/tests/inspector/console-tests.js"></script>
    55<script>
    66
  • trunk/LayoutTests/inspector/console-dir.html

    r54769 r58318  
    22<head>
    33<script src="../http/tests/inspector/inspector-test.js"></script>
    4 <script src="console-tests.js"></script>
     4<script src="../http/tests/inspector/console-tests.js"></script>
    55<script>
    66
  • trunk/LayoutTests/inspector/console-dirxml.html

    r54659 r58318  
    22<head>
    33<script src="../http/tests/inspector/inspector-test.js"></script>
    4 <script src="console-tests.js"></script>
     4<script src="../http/tests/inspector/console-tests.js"></script>
    55<script>
    66
  • trunk/LayoutTests/inspector/console-format-collections-expected.txt

    r57405 r58318  
    99
    1010console-format-collections.html:15[<select id="sel" name="sel">…</select>]
    11 console-format-collections.html:19[<script src="../http/tests/inspector/inspector-test.js"></script>, <script src="console-tests.js"></script>, <script>…</script>]
     11console-format-collections.html:19[<script src="../http/tests/inspector/inspector-test.js"></script>, <script src="../http/tests/inspector/console-tests.js"></script>, <script>…</script>]
    1212console-format-collections.html:23[<option value="1">one</option>, <option value="2">two</option>]
    13 console-format-collections.html:27[<html>…</html>, <head>…</head>, <script src="../http/tests/inspector/inspector-test.js"></script>, <script src="console-tests.js"></script>, <script>…</script>, <body onload="onload()">…</body>, <p> Tests that console nicely formats HTML Collections and NodeLists. </p>, <div style="display:none">…</div>, <form id="f">…</form>, <select id="sel" name="sel">…</select>, <option value="1">one</option>, <option value="2">two</option>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">, <div id="output"></div>]
     13console-format-collections.html:27[<html>…</html>, <head>…</head>, <script src="../http/tests/inspector/inspector-test.js"></script>, <script src="../http/tests/inspector/console-tests.js"></script>, <script>…</script>, <body onload="onload()">…</body>, <p> Tests that console nicely formats HTML Collections and NodeLists. </p>, <div style="display:none">…</div>, <form id="f">…</form>, <select id="sel" name="sel">…</select>, <option value="1">one</option>, <option value="2">two</option>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">, <div id="output"></div>]
    1414console-format-collections.html:31[<select id="sel" name="sel">…</select>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">]
    1515console-format-collections.html:35[<input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">]
  • trunk/LayoutTests/inspector/console-format-collections.html

    r57405 r58318  
    22<head>
    33<script src="../http/tests/inspector/inspector-test.js"></script>
    4 <script src="console-tests.js"></script>
     4<script src="../http/tests/inspector/console-tests.js"></script>
    55<script>
    66
  • trunk/LayoutTests/inspector/console-format.html

    r54659 r58318  
    22<head>
    33<script src="../http/tests/inspector/inspector-test.js"></script>
    4 <script src="console-tests.js"></script>
     4<script src="../http/tests/inspector/console-tests.js"></script>
    55<script>
    66
  • trunk/LayoutTests/inspector/console-log-before-inspector-open.html

    r54659 r58318  
    22<head>
    33<script src="../http/tests/inspector/inspector-test.js"></script>
    4 <script src="console-tests.js"></script>
     4<script src="../http/tests/inspector/console-tests.js"></script>
    55<script>
    66
  • trunk/LayoutTests/inspector/console-tests.html

    r54659 r58318  
    22<head>
    33<script src="../http/tests/inspector/inspector-test.js"></script>
    4 <script src="console-tests.js"></script>
     4<script src="../http/tests/inspector/console-tests.js"></script>
    55<script>
    66
  • trunk/WebCore/ChangeLog

    r58316 r58318  
     12010-04-27  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Log error message to inspector console if a resource fails to load.
     6        Disable checking of mime-type consistency for failed resources.
     7        https://bugs.webkit.org/show_bug.cgi?id=37215
     8
     9        Test: http/tests/inspector/console-resource-errors.html
     10
     11        * inspector/InspectorController.cpp:
     12        (WebCore::InspectorController::didReceiveResponse):
     13        (WebCore::InspectorController::didFailLoading):
     14        * inspector/front-end/Resource.js:
     15        (WebInspector.Resource.prototype._mimeTypeIsConsistentWithType):
     16        * inspector/front-end/ResourcesPanel.js:
     17        (WebInspector.ResourcesPanel.prototype.recreateViewForResourceIfNeeded):
     18
    1192010-04-27  Vitaly Repeshko  <vitalyr@chromium.org>
    220
  • trunk/WebCore/inspector/InspectorController.cpp

    r58162 r58318  
    895895void InspectorController::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
    896896{
    897     RefPtr<InspectorResource> resource = getTrackedResource(identifier);
    898     if (!resource)
    899         return;
    900 
    901     resource->updateResponse(response);
    902     resource->markResponseReceivedTime();
    903 
    904     if (resource != m_mainResource && m_frontend)
    905         resource->updateScriptObject(m_frontend.get());
     897    if (RefPtr<InspectorResource> resource = getTrackedResource(identifier)) {
     898        resource->updateResponse(response);
     899        resource->markResponseReceivedTime();
     900
     901        if (resource != m_mainResource && m_frontend)
     902            resource->updateScriptObject(m_frontend.get());
     903    }
     904    if (response.httpStatusCode() >= 400) {
     905        // The ugly code below is due to that String::format() is not utf8-safe at the moment.
     906        String message = String::format("Failed to load resource: the server responded with a status of %u (", response.httpStatusCode()) + response.httpStatusText() + ")";
     907
     908        addMessageToConsole(OtherMessageSource, LogMessageType, ErrorMessageLevel, message, 0, response.url().string());
     909    }
    906910}
    907911
     
    934938}
    935939
    936 void InspectorController::didFailLoading(unsigned long identifier, const ResourceError& /*error*/)
     940void InspectorController::didFailLoading(unsigned long identifier, const ResourceError& error)
    937941{
    938942    if (m_timelineAgent)
    939943        m_timelineAgent->didFinishLoadingResource(identifier, true);
     944
     945    String message = "Failed to load resource";
     946    if (!error.localizedDescription().isEmpty())
     947        message += ": " + error.localizedDescription();
     948    addMessageToConsole(OtherMessageSource, LogMessageType, ErrorMessageLevel, message, 0, error.failingURL());
    940949
    941950    RefPtr<InspectorResource> resource = getTrackedResource(identifier);
  • trunk/WebCore/inspector/front-end/Resource.js

    r57616 r58318  
    537537    _mimeTypeIsConsistentWithType: function()
    538538    {
     539        // If status is an error, content is likely to be of an inconsistent type,
     540        // as it's going to be an error message. We do not want to emit a warning
     541        // for this, though, as this will already be reported as resource loading failure.
     542        if (this.statusCode >= 400)
     543            return true;
     544
    539545        if (typeof this.type === "undefined"
    540546         || this.type === WebInspector.Resource.Type.Other
  • trunk/WebCore/inspector/front-end/ResourcesPanel.js

    r57616 r58318  
    444444            return;
    445445
    446         resource.warnings = 0;
    447         resource.errors = 0;
    448 
    449446        if (!this.currentQuery && resource._itemsTreeElement)
    450447            resource._itemsTreeElement.updateErrorsAndWarnings();
Note: See TracChangeset for help on using the changeset viewer.