Changeset 150753 in webkit


Ignore:
Timestamp:
May 27, 2013 6:32:07 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK] Notify WebProcess in WebKitURISchemeRequest when we fail to read the user InputStream
https://bugs.webkit.org/show_bug.cgi?id=114347

Patch by Manuel Rego Casasnovas <Manuel Rego Casasnovas> on 2013-05-27
Reviewed by Carlos Garcia Campos.

While processing a WebKitURISchemeRequest if there is any error reading
the InputStream provided by the user (for example the stream is already
closed) we have to notify the WebProcess that the request has failed.

  • UIProcess/API/gtk/WebKitURISchemeRequest.cpp:

(webkitURISchemeRequestReadCallback): Get the error from
g_input_stream_read_finish() and use it to call
webkit_uri_scheme_request_finish_error() in order to finish the failing
WebKitURISchemeRequest properly.

  • UIProcess/API/gtk/tests/TestWebKitWebContext.cpp:

(testWebContextURIScheme): Modify test to check the new situation using
an already closed InputStream.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r150745 r150753  
     12013-05-27  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [GTK] Notify WebProcess in WebKitURISchemeRequest when we fail to read the user InputStream
     4        https://bugs.webkit.org/show_bug.cgi?id=114347
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        While processing a WebKitURISchemeRequest if there is any error reading
     9        the InputStream provided by the user (for example the stream is already
     10        closed) we have to notify the WebProcess that the request has failed.
     11
     12        * UIProcess/API/gtk/WebKitURISchemeRequest.cpp:
     13        (webkitURISchemeRequestReadCallback): Get the error from
     14        g_input_stream_read_finish() and use it to call
     15        webkit_uri_scheme_request_finish_error() in order to finish the failing
     16        WebKitURISchemeRequest properly.
     17        * UIProcess/API/gtk/tests/TestWebKitWebContext.cpp:
     18        (testWebContextURIScheme): Modify test to check the new situation using
     19        an already closed InputStream.
     20
    1212013-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
    222
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp

    r149642 r150753  
    164164{
    165165    GRefPtr<WebKitURISchemeRequest> request = adoptGRef(schemeRequest);
    166     gssize bytesRead = g_input_stream_read_finish(inputStream, result, 0);
    167     // FIXME: notify the WebProcess that we failed to read from the user stream.
     166    GOwnPtr<GError> error;
     167    gssize bytesRead = g_input_stream_read_finish(inputStream, result, &error.outPtr());
    168168    if (bytesRead == -1) {
    169         webkitWebContextDidFinishURIRequest(request->priv->webContext, request->priv->requestID);
     169        webkit_uri_scheme_request_finish_error(request.get(), error.get());
    170170        return;
    171171    }
  • trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp

    r149642 r150753  
    167167            char* replyHTML = g_strdup_printf(handler.reply.data(), webkit_uri_scheme_request_get_path(request));
    168168            g_memory_input_stream_add_data(G_MEMORY_INPUT_STREAM(inputStream.get()), replyHTML, strlen(replyHTML), g_free);
    169         } else if (!handler.reply.isNull())
     169        } else if (!g_strcmp0(scheme, "closed"))
     170            g_input_stream_close(inputStream.get(), 0, 0);
     171        else if (!handler.reply.isNull())
    170172            g_memory_input_stream_add_data(G_MEMORY_INPUT_STREAM(inputStream.get()), handler.reply.data(), handler.reply.length(), 0);
    171173
     
    223225    g_assert_error(test->m_error.get(), g_quark_from_string(errorDomain), errorCode);
    224226    g_assert_cmpstr(test->m_error->message, ==, errorMessage);
     227
     228    test->registerURISchemeHandler("closed", 0, 0, 0);
     229    test->m_loadEvents.clear();
     230    test->loadURI("closed:input-stream");
     231    test->waitUntilLoadFinished();
     232    g_assert(test->m_loadEvents.contains(LoadTrackingTest::ProvisionalLoadFailed));
     233    g_assert(test->m_loadFailed);
     234    g_assert_error(test->m_error.get(), G_IO_ERROR, G_IO_ERROR_CLOSED);
    225235}
    226236
Note: See TracChangeset for help on using the changeset viewer.