Changeset 57609 in webkit


Ignore:
Timestamp:
Apr 14, 2010 2:49:03 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-04-14 Andrey Kosyakov <caseq@chromium.ru>

Reviewed by Timothy Hatcher.

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

  • inspector/console-resource-errors-expected.txt: Added.
  • inspector/console-resource-errors.html: Added.

2010-04-14 Andrey Kosyakov <caseq@chromium.ru>

Reviewed by Timothy Hatcher.

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: 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
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r57607 r57609  
     12010-04-14  Andrey Kosyakov  <caseq@chromium.ru>
     2
     3        Reviewed by Timothy Hatcher.
     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        * inspector/console-resource-errors-expected.txt: Added.
     10        * inspector/console-resource-errors.html: Added.
     11
    1122010-04-14  Alejandro G. Castro  <alex@igalia.com>
    213
  • trunk/WebCore/ChangeLog

    r57606 r57609  
     12010-04-14  Andrey Kosyakov  <caseq@chromium.ru>
     2
     3        Reviewed by Timothy Hatcher.
     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: 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-14  Sheriff Bot  <webkit.review.bot@gmail.com>
    220
  • trunk/WebCore/inspector/InspectorController.cpp

    r57505 r57609  
    893893void InspectorController::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
    894894{
    895     RefPtr<InspectorResource> resource = getTrackedResource(identifier);
    896     if (!resource)
    897         return;
    898 
    899     resource->updateResponse(response);
    900     resource->markResponseReceivedTime();
    901 
    902     if (resource != m_mainResource && m_frontend)
    903         resource->updateScriptObject(m_frontend.get());
     895    if (RefPtr<InspectorResource> resource = getTrackedResource(identifier)) {
     896        resource->updateResponse(response);
     897        resource->markResponseReceivedTime();
     898
     899        if (resource != m_mainResource && m_frontend)
     900            resource->updateScriptObject(m_frontend.get());
     901    }
     902    if (response.httpStatusCode() >= 400) {
     903        // The ugly code below is due to that String::format() is not utf8-safe at the moment.
     904        String message = String::format("Failed to load resource: the server responded with a status of %u (", response.httpStatusCode()) + response.httpStatusText() + ")";
     905
     906        addMessageToConsole(OtherMessageSource, LogMessageType, ErrorMessageLevel, message, 0, response.url().string());
     907    }
    904908}
    905909
     
    932936}
    933937
    934 void InspectorController::didFailLoading(unsigned long identifier, const ResourceError& /*error*/)
     938void InspectorController::didFailLoading(unsigned long identifier, const ResourceError& error)
    935939{
    936940    if (m_timelineAgent)
    937941        m_timelineAgent->didFinishLoadingResource(identifier, true);
     942
     943    String message = "Failed to load resource";
     944    if (!error.localizedDescription().isEmpty())
     945        message += ": " + error.localizedDescription();
     946    addMessageToConsole(OtherMessageSource, LogMessageType, ErrorMessageLevel, message, 0, error.failingURL());
    938947
    939948    RefPtr<InspectorResource> resource = getTrackedResource(identifier);
  • trunk/WebCore/inspector/front-end/Resource.js

    r55466 r57609  
    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

    r57280 r57609  
    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.