summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvchigrin@yandex-team.ru <vchigrin@yandex-team.ru@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-15 13:48:51 +0000
committervchigrin@yandex-team.ru <vchigrin@yandex-team.ru@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-15 13:48:51 +0000
commitd9e440ce5e6564d10601fff7407c943c4bdbd487 (patch)
tree5a8fc7f71bd3f9bc74dacefc577cb15f14a60b4f
parent2670ba62d1f3e31630146681dfcf17ff1d99dff9 (diff)
downloadchromium_src-d9e440ce5e6564d10601fff7407c943c4bdbd487.zip
chromium_src-d9e440ce5e6564d10601fff7407c943c4bdbd487.tar.gz
chromium_src-d9e440ce5e6564d10601fff7407c943c4bdbd487.tar.bz2
Fix not completed range requests from NPAPI plugins.
BUG=253250 TEST=Run PluginTest.PluginSingleRangeRequest from content_browsertests. The problem was caused by not resuming resources, associated with range requests, in plugin_stream_url.cc. Review URL: https://chromiumcodereview.appspot.com/18105003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211637 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/plugin_browsertest.cc4
-rw-r--r--content/plugin/webplugin_delegate_stub.cc4
-rw-r--r--content/renderer/webplugin_delegate_proxy.cc6
-rw-r--r--content/test/data/npapi/plugin_range_request.dat1
-rw-r--r--content/test/data/npapi/plugin_range_request.dat.mock-http-headers3
-rw-r--r--content/test/data/npapi/plugin_single_range_request.html28
-rw-r--r--webkit/plugins/npapi/plugin_instance.cc4
-rw-r--r--webkit/plugins/npapi/plugin_stream_url.cc44
-rw-r--r--webkit/plugins/npapi/plugin_stream_url.h12
-rw-r--r--webkit/plugins/npapi/test/plugin_request_read_test.cc111
-rw-r--r--webkit/plugins/npapi/test/plugin_request_read_test.h47
-rw-r--r--webkit/plugins/npapi/test/plugin_test_factory.cc3
-rw-r--r--webkit/plugins/npapi/webplugin.h10
-rw-r--r--webkit/plugins/npapi/webplugin_delegate_impl.cc6
-rw-r--r--webkit/plugins/npapi/webplugin_impl.cc17
-rw-r--r--webkit/plugins/webkit_plugins.gyp2
16 files changed, 278 insertions, 24 deletions
diff --git a/content/browser/plugin_browsertest.cc b/content/browser/plugin_browsertest.cc
index 24c695a..0527cc4 100644
--- a/content/browser/plugin_browsertest.cc
+++ b/content/browser/plugin_browsertest.cc
@@ -340,6 +340,10 @@ IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(PluginThreadAsyncCall)) {
LoadAndWait(GetURL("plugin_thread_async_call.html"));
}
+IN_PROC_BROWSER_TEST_F(PluginTest, PluginSingleRangeRequest) {
+ LoadAndWait(GetURL("plugin_single_range_request.html"));
+}
+
// Test checking the privacy mode is on.
// If this flakes on Linux, use http://crbug.com/104380
IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(PrivateEnabled)) {
diff --git a/content/plugin/webplugin_delegate_stub.cc b/content/plugin/webplugin_delegate_stub.cc
index 4e5a4cf..95f197ae 100644
--- a/content/plugin/webplugin_delegate_stub.cc
+++ b/content/plugin/webplugin_delegate_stub.cc
@@ -243,7 +243,7 @@ void WebPluginDelegateStub::OnDidFinishLoading(int id) {
if (!client)
return;
- client->DidFinishLoading();
+ client->DidFinishLoading(id);
}
void WebPluginDelegateStub::OnDidFail(int id) {
@@ -251,7 +251,7 @@ void WebPluginDelegateStub::OnDidFail(int id) {
if (!client)
return;
- client->DidFail();
+ client->DidFail(id);
}
void WebPluginDelegateStub::OnDidFinishLoadWithReason(
diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc
index 32fdccf..665dfc1 100644
--- a/content/renderer/webplugin_delegate_proxy.cc
+++ b/content/renderer/webplugin_delegate_proxy.cc
@@ -164,15 +164,17 @@ class ResourceClientProxy : public webkit::npapi::WebPluginResourceClient {
data, data_offset));
}
- virtual void DidFinishLoading() OVERRIDE {
+ virtual void DidFinishLoading(unsigned long resource_id) OVERRIDE {
DCHECK(channel_.get() != NULL);
+ DCHECK_EQ(resource_id, resource_id_);
channel_->Send(new PluginMsg_DidFinishLoading(instance_id_, resource_id_));
channel_ = NULL;
base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}
- virtual void DidFail() OVERRIDE {
+ virtual void DidFail(unsigned long resource_id) OVERRIDE {
DCHECK(channel_.get() != NULL);
+ DCHECK_EQ(resource_id, resource_id_);
channel_->Send(new PluginMsg_DidFail(instance_id_, resource_id_));
channel_ = NULL;
base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
diff --git a/content/test/data/npapi/plugin_range_request.dat b/content/test/data/npapi/plugin_range_request.dat
new file mode 100644
index 0000000..ad47100
--- /dev/null
+++ b/content/test/data/npapi/plugin_range_request.dat
@@ -0,0 +1 @@
+0123456789 \ No newline at end of file
diff --git a/content/test/data/npapi/plugin_range_request.dat.mock-http-headers b/content/test/data/npapi/plugin_range_request.dat.mock-http-headers
new file mode 100644
index 0000000..ae6213e
--- /dev/null
+++ b/content/test/data/npapi/plugin_range_request.dat.mock-http-headers
@@ -0,0 +1,3 @@
+HTTP/1.0 206 Partial Content
+Content-Length: 6
+Content-Range: bytes 4-9/10
diff --git a/content/test/data/npapi/plugin_single_range_request.html b/content/test/data/npapi/plugin_single_range_request.html
new file mode 100644
index 0000000..5432495
--- /dev/null
+++ b/content/test/data/npapi/plugin_single_range_request.html
@@ -0,0 +1,28 @@
+<html>
+
+<head>
+<script src="npapi.js"></script>
+</head>
+
+<body>
+<div id="statusPanel" style="border: 1px solid red; width: 100%">
+Test running....
+</div>
+
+<p>
+Plugun Single Range Request test.
+</p>
+<p>
+This test verifies that we correctly serve
+NPN_RequestRead calls with single range.
+</p>
+
+<embed type="application/vnd.npapi-test"
+ url_to_request="http://mock.http/npapi/plugin_range_request.dat"
+ name="plugin_request_read_single_range"
+ id="1"
+ mode="np_embed"
+/>
+
+</body>
+</html>
diff --git a/webkit/plugins/npapi/plugin_instance.cc b/webkit/plugins/npapi/plugin_instance.cc
index d4d74aa..2e4f4ce 100644
--- a/webkit/plugins/npapi/plugin_instance.cc
+++ b/webkit/plugins/npapi/plugin_instance.cc
@@ -418,7 +418,7 @@ void PluginInstance::DidReceiveManualData(const char* buffer, int length) {
void PluginInstance::DidFinishManualLoading() {
DCHECK(load_manually_);
if (plugin_data_stream_.get() != NULL) {
- plugin_data_stream_->DidFinishLoading();
+ plugin_data_stream_->DidFinishLoading(plugin_data_stream_->ResourceId());
plugin_data_stream_->Close(NPRES_DONE);
plugin_data_stream_ = NULL;
}
@@ -427,7 +427,7 @@ void PluginInstance::DidFinishManualLoading() {
void PluginInstance::DidManualLoadFail() {
DCHECK(load_manually_);
if (plugin_data_stream_.get() != NULL) {
- plugin_data_stream_->DidFail();
+ plugin_data_stream_->DidFail(plugin_data_stream_->ResourceId());
plugin_data_stream_ = NULL;
}
}
diff --git a/webkit/plugins/npapi/plugin_stream_url.cc b/webkit/plugins/npapi/plugin_stream_url.cc
index abb09ef..d94f25f 100644
--- a/webkit/plugins/npapi/plugin_stream_url.cc
+++ b/webkit/plugins/npapi/plugin_stream_url.cc
@@ -4,6 +4,8 @@
#include "webkit/plugins/npapi/plugin_stream_url.h"
+#include <algorithm>
+
#include "net/http/http_response_headers.h"
#include "webkit/plugins/npapi/plugin_host.h"
#include "webkit/plugins/npapi/plugin_instance.h"
@@ -45,6 +47,11 @@ void PluginStreamUrl::CancelRequest() {
}
id_ = 0;
}
+ if (instance()->webplugin()) {
+ for (size_t i = 0; i < range_requests_.size(); ++i)
+ instance()->webplugin()->CancelResource(range_requests_[i]);
+ }
+ range_requests_.clear();
}
void PluginStreamUrl::WillSendRequest(const GURL& url, int http_status_code) {
@@ -80,8 +87,7 @@ void PluginStreamUrl::DidReceiveResponse(const std::string& mime_type,
CancelRequest();
instance()->RemoveStream(this);
} else {
- if (id_ > 0)
- instance()->webplugin()->SetDeferResourceLoading(id_, false);
+ SetDeferLoading(false);
}
}
@@ -98,19 +104,32 @@ void PluginStreamUrl::DidReceiveData(const char* buffer, int length,
// The PluginStreamUrl instance could get deleted if the plugin fails to
// accept data in NPP_Write.
if (Write(const_cast<char*>(buffer), length, data_offset) > 0) {
- if (id_ > 0)
- instance()->webplugin()->SetDeferResourceLoading(id_, false);
+ SetDeferLoading(false);
}
}
}
-void PluginStreamUrl::DidFinishLoading() {
+void PluginStreamUrl::DidFinishLoading(unsigned long resource_id) {
if (!seekable()) {
Close(NPRES_DONE);
+ } else {
+ std::vector<unsigned long>::iterator it_resource = std::find(
+ range_requests_.begin(),
+ range_requests_.end(),
+ resource_id);
+ // Resource id must be known to us - either main resource id, or one
+ // of the resources, created for range requests.
+ DCHECK(resource_id == id_ || it_resource != range_requests_.end());
+ // We should notify the plugin about failed/finished requests to ensure
+ // that the number of active resource clients does not continue to grow.
+ if (instance()->webplugin())
+ instance()->webplugin()->CancelResource(resource_id);
+ if (it_resource != range_requests_.end())
+ range_requests_.erase(it_resource);
}
}
-void PluginStreamUrl::DidFail() {
+void PluginStreamUrl::DidFail(unsigned long resource_id) {
Close(NPRES_NETWORK_ERR);
}
@@ -128,5 +147,18 @@ PluginStreamUrl::~PluginStreamUrl() {
}
}
+void PluginStreamUrl::AddRangeRequestResourceId(unsigned long resource_id) {
+ DCHECK_NE(resource_id, 0u);
+ range_requests_.push_back(resource_id);
+}
+
+void PluginStreamUrl::SetDeferLoading(bool value) {
+ if (id_ > 0)
+ instance()->webplugin()->SetDeferResourceLoading(id_, value);
+ for (size_t i = 0; i < range_requests_.size(); ++i)
+ instance()->webplugin()->SetDeferResourceLoading(range_requests_[i],
+ value);
+}
+
} // namespace npapi
} // namespace webkit
diff --git a/webkit/plugins/npapi/plugin_stream_url.h b/webkit/plugins/npapi/plugin_stream_url.h
index b514c05..d6c0548 100644
--- a/webkit/plugins/npapi/plugin_stream_url.h
+++ b/webkit/plugins/npapi/plugin_stream_url.h
@@ -5,6 +5,8 @@
#ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_URL_H_
#define WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_URL_H_
+#include <vector>
+
#include "url/gurl.h"
#include "webkit/plugins/npapi/plugin_stream.h"
#include "webkit/plugins/npapi/webplugin.h"
@@ -45,17 +47,23 @@ class PluginStreamUrl : public PluginStream,
virtual void DidReceiveData(const char* buffer,
int length,
int data_offset) OVERRIDE;
- virtual void DidFinishLoading() OVERRIDE;
- virtual void DidFail() OVERRIDE;
+ virtual void DidFinishLoading(unsigned long resource_id) OVERRIDE;
+ virtual void DidFail(unsigned long resource_id) OVERRIDE;
virtual bool IsMultiByteResponseExpected() OVERRIDE;
virtual int ResourceId() OVERRIDE;
+ virtual void AddRangeRequestResourceId(unsigned long resource_id) OVERRIDE;
protected:
virtual ~PluginStreamUrl();
private:
+ void SetDeferLoading(bool value);
+
GURL url_;
unsigned long id_;
+ // Ids of additional resources requested via range requests issued on
+ // seekable streams.
+ std::vector<unsigned long> range_requests_;
DISALLOW_COPY_AND_ASSIGN(PluginStreamUrl);
};
diff --git a/webkit/plugins/npapi/test/plugin_request_read_test.cc b/webkit/plugins/npapi/test/plugin_request_read_test.cc
new file mode 100644
index 0000000..a6bf677
--- /dev/null
+++ b/webkit/plugins/npapi/test/plugin_request_read_test.cc
@@ -0,0 +1,111 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/plugins/npapi/test/plugin_request_read_test.h"
+
+#include "base/basictypes.h"
+
+namespace NPAPIClient {
+
+PluginRequestReadTest::PluginRequestReadTest(NPP id,
+ NPNetscapeFuncs* host_functions)
+ : PluginTest(id, host_functions),
+ tests_started_(false),
+ read_requested_(false) {
+}
+
+PluginRequestReadTest::~PluginRequestReadTest() {
+}
+
+NPError PluginRequestReadTest::New(uint16 mode, int16 argc, const char* argn[],
+ const char* argv[], NPSavedData* saved) {
+ url_to_request_ = GetArgValue("url_to_request", argc, argn, argv);
+ return PluginTest::New(mode, argc, argn, argv, saved);
+}
+
+NPError PluginRequestReadTest::SetWindow(NPWindow* window) {
+ if (!tests_started_) {
+ tests_started_ = true;
+ NPError result = HostFunctions()->geturl(id(),
+ url_to_request_.c_str(),
+ NULL);
+ if (result != NPERR_NO_ERROR)
+ SetError("Failed request anURL.");
+ }
+ return PluginTest::SetWindow(window);
+}
+
+NPError PluginRequestReadTest::NewStream(NPMIMEType type, NPStream* stream,
+ NPBool seekable, uint16* stream_type) {
+ *stream_type = NP_SEEK;
+ if (!read_requested_) {
+ requested_ranges_.resize(1);
+ requested_ranges_[0].offset = 4;
+ requested_ranges_[0].length = 6;
+ requested_ranges_[0].next = NULL;
+ NPError result = HostFunctions()->requestread(stream,
+ &requested_ranges_[0]);
+ if (result != NPERR_NO_ERROR)
+ SetError("Failed request read from stream.");
+ read_requested_ = true;
+ }
+ return PluginTest::NewStream(type, stream, seekable, stream_type);
+}
+
+NPError PluginRequestReadTest::DestroyStream(NPStream *stream, NPError reason) {
+ if (!requested_ranges_.empty())
+ SetError("Some requested ranges are not received!");
+ SignalTestCompleted();
+ return PluginTest::DestroyStream(stream, reason);
+}
+
+int32 PluginRequestReadTest::WriteReady(NPStream* stream) {
+ int32 result = 0;
+ for (size_t i = 0; i < requested_ranges_.size(); ++i)
+ result += requested_ranges_[i].length;
+ return result;
+}
+
+int32 PluginRequestReadTest::Write(NPStream* stream, int32 offset, int32 len,
+ void* buffer) {
+ std::vector<NPByteRange>::iterator it;
+ // Remove received range (or sub-range) from requested_ranges_, and
+ // verify that we have received proper data.
+
+ for (it = requested_ranges_.begin(); it != requested_ranges_.end(); ++it) {
+ if (it->offset == offset)
+ break;
+ }
+ if (it == requested_ranges_.end()) {
+ // It is Ok for browser to write some data from start of the stream before
+ // we've issued any read requests.
+ return len;
+ }
+ // Shrink range to mark area we have just received.
+ it->offset += len;
+ if (static_cast<int32>(it->length) < len)
+ it->length = 0;
+ else
+ it->length -= len;
+ if (it->length == 0)
+ requested_ranges_.erase(it);
+
+ // Verify that data, which we got, is right.
+ const char* data = static_cast<const char*>(buffer);
+ for (int32 i = 0; i < len; ++i) {
+ int cur_offset = offset + i;
+ char expected = '0' + cur_offset;
+ if (data[i] != expected) {
+ SetError("Content mismatch between data and source!");
+ break;
+ }
+ }
+ if (requested_ranges_.empty())
+ SignalTestCompleted();
+
+ return len;
+}
+
+} // namespace NPAPIClient
+
diff --git a/webkit/plugins/npapi/test/plugin_request_read_test.h b/webkit/plugins/npapi/test/plugin_request_read_test.h
new file mode 100644
index 0000000..de227f5
--- /dev/null
+++ b/webkit/plugins/npapi/test/plugin_request_read_test.h
@@ -0,0 +1,47 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_PLUGINS_NPAPI_TEST_PLUGIN_REQUEST_READ_TEST_H_
+#define WEBKIT_PLUGINS_NPAPI_TEST_PLUGIN_REQUEST_READ_TEST_H_
+
+#include <string>
+#include <vector>
+
+#include "base/compiler_specific.h"
+#include "webkit/plugins/npapi/test/plugin_test.h"
+
+namespace NPAPIClient {
+
+// Tests whether the browser correctly handles single range requests from NPAPI
+// plugins.
+class PluginRequestReadTest : public PluginTest {
+ public:
+ PluginRequestReadTest(NPP id, NPNetscapeFuncs* host_functions);
+ virtual ~PluginRequestReadTest();
+
+ //
+ // NPAPI Functions
+ //
+ virtual NPError New(uint16 mode, int16 argc, const char* argn[],
+ const char* argv[], NPSavedData* saved) OVERRIDE;
+ virtual NPError SetWindow(NPWindow* window) OVERRIDE;
+ virtual NPError NewStream(NPMIMEType type, NPStream* stream,
+ NPBool seekable, uint16* stream_type) OVERRIDE;
+ virtual NPError DestroyStream(NPStream *stream, NPError reason) OVERRIDE;
+ virtual int32 WriteReady(NPStream* stream) OVERRIDE;
+ virtual int32 Write(NPStream* stream, int32 offset, int32 len,
+ void* buffer) OVERRIDE;
+
+ private:
+ // Tracks ranges, which we requested, but for which we did not get response.
+ std::vector<NPByteRange> requested_ranges_;
+ std::string url_to_request_;
+ bool tests_started_;
+ bool read_requested_;
+};
+
+} // namespace NPAPIClient
+
+#endif // WEBKIT_PLUGINS_NPAPI_TEST_PLUGIN_REQUEST_READ_TEST_H_
+
diff --git a/webkit/plugins/npapi/test/plugin_test_factory.cc b/webkit/plugins/npapi/test/plugin_test_factory.cc
index f412f3c..eceb852 100644
--- a/webkit/plugins/npapi/test/plugin_test_factory.cc
+++ b/webkit/plugins/npapi/test/plugin_test_factory.cc
@@ -16,6 +16,7 @@
#include "webkit/plugins/npapi/test/plugin_npobject_lifetime_test.h"
#include "webkit/plugins/npapi/test/plugin_npobject_proxy_test.h"
#include "webkit/plugins/npapi/test/plugin_private_test.h"
+#include "webkit/plugins/npapi/test/plugin_request_read_test.h"
#include "webkit/plugins/npapi/test/plugin_schedule_timer_test.h"
#include "webkit/plugins/npapi/test/plugin_setup_test.h"
#include "webkit/plugins/npapi/test/plugin_thread_async_call_test.h"
@@ -104,6 +105,8 @@ PluginTest* CreatePluginTest(const std::string& test_name,
new_test = new PluginSetupTest(instance, host_functions);
} else if (test_name == "delete_plugin_in_deallocate_test") {
new_test = new DeletePluginInDeallocateTest(instance, host_functions);
+ } else if (test_name == "plugin_request_read_single_range") {
+ new_test = new PluginRequestReadTest(instance, host_functions);
}
return new_test;
diff --git a/webkit/plugins/npapi/webplugin.h b/webkit/plugins/npapi/webplugin.h
index 5674e19..20929d2 100644
--- a/webkit/plugins/npapi/webplugin.h
+++ b/webkit/plugins/npapi/webplugin.h
@@ -180,10 +180,16 @@ class WebPluginResourceClient {
bool request_is_seekable) = 0;
virtual void DidReceiveData(const char* buffer, int length,
int data_offset) = 0;
- virtual void DidFinishLoading() = 0;
- virtual void DidFail() = 0;
+ // The resource ids passed here ensures that data for range requests
+ // is cleared. This applies for seekable streams.
+ virtual void DidFinishLoading(unsigned long resource_id) = 0;
+ virtual void DidFail(unsigned long resource_id) = 0;
virtual bool IsMultiByteResponseExpected() = 0;
virtual int ResourceId() = 0;
+ // Tells this object that it will get responses from multiple resources.
+ // This is necessary since the plugin process uses a single instance of
+ // PluginStreamUrl object for multiple range requests.
+ virtual void AddRangeRequestResourceId(unsigned long resource_id) { }
};
} // namespace npapi
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl.cc b/webkit/plugins/npapi/webplugin_delegate_impl.cc
index 40f3b66..cb6cca4 100644
--- a/webkit/plugins/npapi/webplugin_delegate_impl.cc
+++ b/webkit/plugins/npapi/webplugin_delegate_impl.cc
@@ -299,7 +299,11 @@ WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient(
WebPluginResourceClient* WebPluginDelegateImpl::CreateSeekableResourceClient(
unsigned long resource_id, int range_request_id) {
- return instance()->GetRangeRequest(range_request_id);
+ WebPluginResourceClient* resource_client = instance()->GetRangeRequest(
+ range_request_id);
+ if (resource_client)
+ resource_client->AddRangeRequestResourceId(resource_id);
+ return resource_client;
}
} // namespace npapi
diff --git a/webkit/plugins/npapi/webplugin_impl.cc b/webkit/plugins/npapi/webplugin_impl.cc
index 7d8e441..88b1727 100644
--- a/webkit/plugins/npapi/webplugin_impl.cc
+++ b/webkit/plugins/npapi/webplugin_impl.cc
@@ -772,7 +772,7 @@ void WebPluginImpl::URLRedirectResponse(bool allow, int resource_id) {
} else {
clients_[i].loader->cancel();
if (clients_[i].client)
- clients_[i].client->DidFail();
+ clients_[i].client->DidFail(clients_[i].id);
}
}
break;
@@ -879,7 +879,7 @@ void WebPluginImpl::willSendRequest(WebURLLoader* loader,
webframe_ &&
!webframe_->checkIfRunInsecureContent(request.url())) {
loader->cancel();
- client_info->client->DidFail();
+ client_info->client->DidFail(client_info->id);
return;
}
if (net::HttpResponseHeaders::IsRedirectResponseCode(
@@ -894,7 +894,7 @@ void WebPluginImpl::willSendRequest(WebURLLoader* loader,
if (original_request_url.GetOrigin() != response_url.GetOrigin()) {
loader->setDefersLoading(true);
loader->cancel();
- client_info->client->DidFail();
+ client_info->client->DidFail(client_info->id);
return;
}
}
@@ -923,6 +923,9 @@ void WebPluginImpl::didReceiveResponse(WebURLLoader* loader,
ResponseInfo response_info;
GetResponseInfo(response, &response_info);
+ ClientInfo* client_info = GetClientInfoFromLoader(loader);
+ if (!client_info)
+ return;
bool request_is_seekable = true;
if (client->IsMultiByteResponseExpected()) {
@@ -1052,7 +1055,7 @@ void WebPluginImpl::didFinishLoading(WebURLLoader* loader, double finishTime) {
// The ClientInfo can get deleted in the call to DidFinishLoading below.
// It is not safe to access this structure after that.
client_info->client = NULL;
- resource_client->DidFinishLoading();
+ resource_client->DidFinishLoading(client_info->id);
}
}
@@ -1065,7 +1068,7 @@ void WebPluginImpl::didFail(WebURLLoader* loader,
// The ClientInfo can get deleted in the call to DidFail below.
// It is not safe to access this structure after that.
client_info->client = NULL;
- resource_client->DidFail();
+ resource_client->DidFail(client_info->id);
}
}
@@ -1162,7 +1165,7 @@ void WebPluginImpl::HandleURLRequestInternal(const char* url,
// back to the plugin asynchronously.
if ((routing_status == INVALID_URL) ||
(routing_status == GENERAL_FAILURE)) {
- resource_client->DidFail();
+ resource_client->DidFail(resource_id);
return;
}
@@ -1288,7 +1291,7 @@ void WebPluginImpl::SetDeferResourceLoading(unsigned long resource_id,
WebPluginResourceClient* resource_client = client_info.client;
client_info.loader->cancel();
clients_.erase(client_index++);
- resource_client->DidFail();
+ resource_client->DidFail(resource_id);
}
break;
}
diff --git a/webkit/plugins/webkit_plugins.gyp b/webkit/plugins/webkit_plugins.gyp
index f0097cd..2f47059 100644
--- a/webkit/plugins/webkit_plugins.gyp
+++ b/webkit/plugins/webkit_plugins.gyp
@@ -151,6 +151,8 @@
'npapi/test/plugin_npobject_lifetime_test.h',
'npapi/test/plugin_npobject_proxy_test.cc',
'npapi/test/plugin_npobject_proxy_test.h',
+ 'npapi/test/plugin_request_read_test.h',
+ 'npapi/test/plugin_request_read_test.cc',
'npapi/test/plugin_schedule_timer_test.cc',
'npapi/test/plugin_schedule_timer_test.h',
'npapi/test/plugin_setup_test.cc',