Changeset 71033 in webkit


Ignore:
Timestamp:
Nov 1, 2010 9:51:07 AM (14 years ago)
Author:
Adam Roben
Message:

Cancel main resource loads after we hand them off to the media engine

This is the WebKit2 equivalent of r51104. Clearly this code should be
moved to a cross-platform location someday.

Fixes <http://webkit.org/b/48561> <rdar://problem/8606679> Assertion
failure in DocumentLoader::commitData when loading a media document in
WebKit2

Reviewed by Eric Carlson.

  • WebProcess/WebCoreSupport/WebErrors.h: Added pluginWillHandleLoadError.
  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebFrameLoaderClient::committedLoad): Cancel the main resource load
after handing off the load to the media engine. This code originally
came from -[WebHTMLRepresentation receivedData:withDataSource:].
(WebKit::WebFrameLoaderClient::pluginWillHandleLoadError): Call through to WebErrors.
(WebKit::WebFrameLoaderClient::shouldFallBack): Implemented. We fall
back for all errors except when the load was cancelled or we handed it
off to the media engine or a plugin.

  • WebProcess/WebCoreSupport/mac/WebErrorsMac.mm:

(WebKit::pluginWillHandleLoadError): Implemented.

  • WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp:

(WebKit::pluginWillHandleLoadError): Stubbed out.

  • WebProcess/WebCoreSupport/win/WebErrorsWin.cpp:

(WebKit::pluginWillHandleLoadError): Implemented.

Location:
trunk/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r71029 r71033  
     12010-11-01  Adam Roben  <aroben@apple.com>
     2
     3        Cancel main resource loads after we hand them off to the media engine
     4
     5        This is the WebKit2 equivalent of r51104. Clearly this code should be
     6        moved to a cross-platform location someday.
     7
     8        Fixes <http://webkit.org/b/48561> <rdar://problem/8606679> Assertion
     9        failure in DocumentLoader::commitData when loading a media document in
     10        WebKit2
     11
     12        Reviewed by Eric Carlson.
     13
     14        * WebProcess/WebCoreSupport/WebErrors.h: Added pluginWillHandleLoadError.
     15
     16        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     17        (WebFrameLoaderClient::committedLoad): Cancel the main resource load
     18        after handing off the load to the media engine. This code originally
     19        came from -[WebHTMLRepresentation receivedData:withDataSource:].
     20        (WebKit::WebFrameLoaderClient::pluginWillHandleLoadError): Call through to WebErrors.
     21        (WebKit::WebFrameLoaderClient::shouldFallBack): Implemented. We fall
     22        back for all errors except when the load was cancelled or we handed it
     23        off to the media engine or a plugin.
     24
     25        * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm:
     26        (WebKit::pluginWillHandleLoadError): Implemented.
     27
     28        * WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp:
     29        (WebKit::pluginWillHandleLoadError): Stubbed out.
     30
     31        * WebProcess/WebCoreSupport/win/WebErrorsWin.cpp:
     32        (WebKit::pluginWillHandleLoadError): Implemented.
     33
    1342010-11-01  Andreas Kling  <kling@webkit.org>
    235
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebErrors.h

    r57309 r71033  
    3939WebCore::ResourceError cannotShowMIMETypeError(const WebCore::ResourceResponse&);
    4040WebCore::ResourceError fileDoesNotExistError(const WebCore::ResourceResponse&);
     41WebCore::ResourceError pluginWillHandleLoadError(const WebCore::ResourceResponse&);
    4142
    4243} // namespace WebKit
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r70936 r71033  
    678678        loader->commitData(data, length);
    679679
     680    // If the document is a stand-alone media document, now is the right time to cancel the WebKit load.
     681    // FIXME: This code should be shared across all ports. <http://webkit.org/b/48762>.
     682    if (m_frame->coreFrame()->document()->isMediaDocument())
     683        loader->cancelMainResourceLoad(pluginWillHandleLoadError(loader->response()));
     684
    680685    // Calling commitData did not create the plug-in view.
    681686    if (!m_pluginView)
     
    683688
    684689    if (!m_hasSentResponseToPluginView) {
    685         m_pluginView->manualLoadDidReceiveResponse(m_frame->coreFrame()->loader()->documentLoader()->response());
     690        m_pluginView->manualLoadDidReceiveResponse(loader->response());
    686691        // manualLoadDidReceiveResponse sets up a new stream to the plug-in. on a full-page plug-in, a failure in
    687692        // setting up this stream can cause the main document load to be cancelled, setting m_pluginView
     
    830835}
    831836
    832 ResourceError WebFrameLoaderClient::pluginWillHandleLoadError(const ResourceResponse&)
    833 {
    834     notImplemented();
    835     return ResourceError();
    836 }
    837 
    838 bool WebFrameLoaderClient::shouldFallBack(const ResourceError&)
    839 {
    840     notImplemented();
    841     return false;
     837ResourceError WebFrameLoaderClient::pluginWillHandleLoadError(const ResourceResponse& response)
     838{
     839    return WebKit::pluginWillHandleLoadError(response);
     840}
     841
     842bool WebFrameLoaderClient::shouldFallBack(const ResourceError& error)
     843{
     844    DEFINE_STATIC_LOCAL(const ResourceError, cancelledError, (this->cancelledError(ResourceRequest())));
     845    DEFINE_STATIC_LOCAL(const ResourceError, pluginWillHandleLoadError, (this->pluginWillHandleLoadError(ResourceResponse())));
     846
     847    if (error.errorCode() == cancelledError.errorCode() && error.domain() == cancelledError.domain())
     848        return false;
     849
     850    if (error.errorCode() == pluginWillHandleLoadError.errorCode() && error.domain() == pluginWillHandleLoadError.domain())
     851        return false;
     852
     853    return true;
    842854}
    843855
  • trunk/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm

    r70066 r71033  
    170170}
    171171
     172ResourceError pluginWillHandleLoadError(const ResourceResponse& response)
     173{
     174    return [NSError _webKitErrorWithDomain:WebError::webKitErrorDomain() code:kWKErrorCodePlugInWillHandleLoad URL:response.url()];
     175}
     176
    172177} // namespace WebKit
  • trunk/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp

    r62491 r71033  
    2727#include "WebErrors.h"
    2828
     29#include "NotImplemented.h"
    2930#include <WebCore/ResourceRequest.h>
    3031#include <WebCore/ResourceResponse.h>
     
    8687}
    8788
     89ResourceError pluginWillHandleLoadError(const ResourceResponse&)
     90{
     91    notImplemented();
     92    return ResourceError();
     93}
     94
    8895} // namespace WebKit
  • trunk/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp

    r70597 r71033  
    7373}
    7474
     75ResourceError pluginWillHandleLoadError(const ResourceResponse& response)
     76{
     77    return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodePlugInWillHandleLoad, response.url().string(), String());
     78}
     79
    7580} // namespace WebKit
Note: See TracChangeset for help on using the changeset viewer.