summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/common/plugin_messages_internal.h21
-rw-r--r--chrome/plugin/webplugin_delegate_stub.cc6
-rw-r--r--chrome/plugin/webplugin_delegate_stub.h3
-rw-r--r--chrome/plugin/webplugin_proxy.cc4
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc6
-rw-r--r--chrome/test/data/reliability/known_crashes.txt12
-rw-r--r--webkit/glue/plugins/plugin_instance.cc4
-rw-r--r--webkit/glue/plugins/plugin_stream_url.cc5
-rw-r--r--webkit/glue/plugins/plugin_stream_url.h3
-rw-r--r--webkit/glue/plugins/test/plugin_get_javascript_url_test.cc83
-rw-r--r--webkit/glue/plugins/test/plugin_get_javascript_url_test.h10
-rw-r--r--webkit/glue/webplugin.h3
-rw-r--r--webkit/glue/webplugin_impl.cc8
13 files changed, 40 insertions, 128 deletions
diff --git a/chrome/common/plugin_messages_internal.h b/chrome/common/plugin_messages_internal.h
index 5138d5a..18152d9 100644
--- a/chrome/common/plugin_messages_internal.h
+++ b/chrome/common/plugin_messages_internal.h
@@ -183,19 +183,20 @@ IPC_BEGIN_MESSAGES(Plugin)
int /* id */,
GURL /* url */)
- IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveResponse,
- PluginMsg_DidReceiveResponseParams)
+ IPC_SYNC_MESSAGE_ROUTED1_1(PluginMsg_DidReceiveResponse,
+ PluginMsg_DidReceiveResponseParams,
+ bool /* cancel */)
- IPC_MESSAGE_ROUTED3(PluginMsg_DidReceiveData,
- int /* id */,
- std::vector<char> /* buffer */,
- int /* data_offset */)
+ IPC_SYNC_MESSAGE_ROUTED3_0(PluginMsg_DidReceiveData,
+ int /* id */,
+ std::vector<char> /* buffer */,
+ int /* data_offset */)
- IPC_MESSAGE_ROUTED1(PluginMsg_DidFinishLoading,
- int /* id */)
+ IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_DidFinishLoading,
+ int /* id */)
- IPC_MESSAGE_ROUTED1(PluginMsg_DidFail,
- int /* id */)
+ IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_DidFail,
+ int /* id */)
IPC_MESSAGE_ROUTED5(PluginMsg_SendJavaScriptStream,
std::string /* url */,
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc
index c42815a..277ff91 100644
--- a/chrome/plugin/webplugin_delegate_stub.cc
+++ b/chrome/plugin/webplugin_delegate_stub.cc
@@ -175,7 +175,8 @@ void WebPluginDelegateStub::OnWillSendRequest(int id, const GURL& url) {
}
void WebPluginDelegateStub::OnDidReceiveResponse(
- const PluginMsg_DidReceiveResponseParams& params) {
+ const PluginMsg_DidReceiveResponseParams& params, bool* cancel) {
+ *cancel = false;
WebPluginResourceClient* client = webplugin_->GetResourceClient(params.id);
if (!client)
return;
@@ -184,7 +185,8 @@ void WebPluginDelegateStub::OnDidReceiveResponse(
params.headers,
params.expected_length,
params.last_modified,
- params.request_is_seekable);
+ params.request_is_seekable,
+ cancel);
}
void WebPluginDelegateStub::OnDidReceiveData(int id,
diff --git a/chrome/plugin/webplugin_delegate_stub.h b/chrome/plugin/webplugin_delegate_stub.h
index 519a648..2def46c 100644
--- a/chrome/plugin/webplugin_delegate_stub.h
+++ b/chrome/plugin/webplugin_delegate_stub.h
@@ -52,7 +52,8 @@ class WebPluginDelegateStub : public IPC::Channel::Listener,
void OnInit(const PluginMsg_Init_Params& params, bool* result);
void OnWillSendRequest(int id, const GURL& url);
- void OnDidReceiveResponse(const PluginMsg_DidReceiveResponseParams& params);
+ void OnDidReceiveResponse(const PluginMsg_DidReceiveResponseParams& params,
+ bool* cancel);
void OnDidReceiveData(int id, const std::vector<char>& buffer,
int data_offset);
void OnDidFinishLoading(int id);
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index 5483956..fc061ce 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -287,10 +287,8 @@ WebPluginProxy* WebPluginProxy::FromCPBrowsingContext(
WebPluginResourceClient* WebPluginProxy::GetResourceClient(int id) {
ResourceClientMap::iterator iterator = resource_clients_.find(id);
- // The IPC messages which deal with streams are now asynchronous. It is
- // now possible to receive stream messages from the renderer for streams
- // which may have been cancelled by the plugin.
if (iterator == resource_clients_.end()) {
+ NOTREACHED();
return NULL;
}
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index f5e97b9..3d05a4b 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -100,7 +100,8 @@ class ResourceClientProxy : public WebPluginResourceClient {
const std::string& headers,
uint32 expected_length,
uint32 last_modified,
- bool request_is_seekable) {
+ bool request_is_seekable,
+ bool* cancel) {
DCHECK(channel_ != NULL);
PluginMsg_DidReceiveResponseParams params;
params.id = resource_id_;
@@ -112,7 +113,8 @@ class ResourceClientProxy : public WebPluginResourceClient {
// Grab a reference on the underlying channel so it does not get
// deleted from under us.
scoped_refptr<PluginChannelHost> channel_ref(channel_);
- channel_->Send(new PluginMsg_DidReceiveResponse(instance_id_, params));
+ channel_->Send(new PluginMsg_DidReceiveResponse(instance_id_, params,
+ cancel));
}
void DidReceiveData(const char* buffer, int length, int data_offset) {
diff --git a/chrome/test/data/reliability/known_crashes.txt b/chrome/test/data/reliability/known_crashes.txt
index 712e4d8..ca469b9 100644
--- a/chrome/test/data/reliability/known_crashes.txt
+++ b/chrome/test/data/reliability/known_crashes.txt
@@ -83,15 +83,3 @@ SUBSTRING : windowdragresponsetask::run___messageloop::runtask___messageloop::do
# 17569
SUBSTRING : masksuperblitter::~masksuperblitter
-# 18056
-PREFIX : webplugindelegatestub::onmessagereceived___webplugindelegateimpl::nativewndproc___base::messagepumpforui::dorunloop
-
-# 18058
-SUBSTRING : webplugindelegateimpl::flashwindowlesswndproc___npapi::plugininstance::npp_write___npapi::pluginstream::trywritetoplugin
-
-# 18059
-SUBSTRING : base::subtle::refcountedthreadsafebase::release___npn_invalidaterect___webplugindelegateimpl::flashwindowlesswndproc___npapi::plugininstance::npp_write
-
-# 18083
-PREFIX : webplugindelegateimpl::nativewndproc___npapi::plugininstance::npp_setwindow___webplugindelegateimpl::nativewndproc
-
diff --git a/webkit/glue/plugins/plugin_instance.cc b/webkit/glue/plugins/plugin_instance.cc
index 79b5b4f..d980e10 100644
--- a/webkit/glue/plugins/plugin_instance.cc
+++ b/webkit/glue/plugins/plugin_instance.cc
@@ -373,10 +373,12 @@ void PluginInstance::DidReceiveManualResponse(const std::string& url,
response_url = instance_url_.spec();
}
+ bool cancel = false;
+
plugin_data_stream_ = CreateStream(-1, url, mime_type, false, NULL);
plugin_data_stream_->DidReceiveResponse(mime_type, headers, expected_length,
- last_modified, true);
+ last_modified, true, &cancel);
}
void PluginInstance::DidReceiveManualData(const char* buffer, int length) {
diff --git a/webkit/glue/plugins/plugin_stream_url.cc b/webkit/glue/plugins/plugin_stream_url.cc
index 53d1019..b050411 100644
--- a/webkit/glue/plugins/plugin_stream_url.cc
+++ b/webkit/glue/plugins/plugin_stream_url.cc
@@ -44,15 +44,16 @@ void PluginStreamUrl::DidReceiveResponse(const std::string& mime_type,
const std::string& headers,
uint32 expected_length,
uint32 last_modified,
- bool request_is_seekable) {
+ bool request_is_seekable,
+ bool* cancel) {
bool opened = Open(mime_type,
headers,
expected_length,
last_modified,
request_is_seekable);
if (!opened) {
- CancelRequest();
instance()->RemoveStream(this);
+ *cancel = true;
}
}
diff --git a/webkit/glue/plugins/plugin_stream_url.h b/webkit/glue/plugins/plugin_stream_url.h
index 1f5fe57..db5d4a5 100644
--- a/webkit/glue/plugins/plugin_stream_url.h
+++ b/webkit/glue/plugins/plugin_stream_url.h
@@ -48,7 +48,8 @@ class PluginStreamUrl : public PluginStream,
const std::string& headers,
uint32 expected_length,
uint32 last_modified,
- bool request_is_seekable);
+ bool request_is_seekable,
+ bool* cancel);
void DidReceiveData(const char* buffer, int length, int data_offset);
void DidFinishLoading();
void DidFail();
diff --git a/webkit/glue/plugins/test/plugin_get_javascript_url_test.cc b/webkit/glue/plugins/test/plugin_get_javascript_url_test.cc
index ebdd745..74d01f1 100644
--- a/webkit/glue/plugins/test/plugin_get_javascript_url_test.cc
+++ b/webkit/glue/plugins/test/plugin_get_javascript_url_test.cc
@@ -17,19 +17,11 @@
// The maximum chunk size of stream data.
#define STREAM_CHUNK 197
-const int kNPNEvaluateTimerID = 100;
-const int kNPNEvaluateTimerElapse = 50;
-
-
namespace NPAPIClient {
ExecuteGetJavascriptUrlTest::ExecuteGetJavascriptUrlTest(NPP id, NPNetscapeFuncs *host_functions)
: PluginTest(id, host_functions),
- test_started_(false),
-#ifdef OS_WIN
- window_(NULL),
-#endif
- npn_evaluate_context_(false) {
+ test_started_(false) {
}
NPError ExecuteGetJavascriptUrlTest::SetWindow(NPWindow* pNPWindow) {
@@ -38,64 +30,15 @@ NPError ExecuteGetJavascriptUrlTest::SetWindow(NPWindow* pNPWindow) {
HostFunctions()->geturlnotify(id(), url.c_str(), "_top",
reinterpret_cast<void*>(SELF_URL_STREAM_ID));
test_started_ = true;
-
-#ifdef OS_WIN
- HWND window_handle = reinterpret_cast<HWND>(pNPWindow->window);
- if (!::GetProp(window_handle, L"Plugin_Instance")) {
- ::SetProp(window_handle, L"Plugin_Instance", this);
- // We attempt to retreive the NPObject for the plugin instance identified
- // by the NPObjectLifetimeTestInstance2 class as it may not have been
- // instantiated yet.
- SetTimer(window_handle, kNPNEvaluateTimerID, kNPNEvaluateTimerElapse,
- TimerProc);
- }
- window_ = window_handle;
-#endif
}
-
return NPERR_NO_ERROR;
}
-#ifdef OS_WIN
-void CALLBACK ExecuteGetJavascriptUrlTest::TimerProc(
- HWND window, UINT message, UINT timer_id, unsigned long elapsed_time) {
- ExecuteGetJavascriptUrlTest* this_instance =
- reinterpret_cast<ExecuteGetJavascriptUrlTest*>
- (::GetProp(window, L"Plugin_Instance"));
-
- NPObject *window_obj = NULL;
- this_instance->HostFunctions()->getvalue(this_instance->id(),
- NPNVWindowNPObject,
- &window_obj);
- if (!window_obj) {
- this_instance->SetError("Failed to get NPObject for plugin instance2");
- this_instance->SignalTestCompleted();
- return;
- }
-
- std::string script = "javascript:window.location";
- NPString script_string;
- script_string.UTF8Characters = script.c_str();
- script_string.UTF8Length = static_cast<unsigned int>(script.length());
- NPVariant result_var;
-
- this_instance->npn_evaluate_context_ = true;
- NPError result = this_instance->HostFunctions()->evaluate(
- this_instance->id(), window_obj, &script_string, &result_var);
- this_instance->npn_evaluate_context_ = false;
-}
-#endif
-
NPError ExecuteGetJavascriptUrlTest::NewStream(NPMIMEType type, NPStream* stream,
NPBool seekable, uint16* stype) {
if (stream == NULL)
SetError("NewStream got null stream");
- if (npn_evaluate_context_) {
- SetError("NewStream received in context of NPN_Evaluate");
- return NPERR_NO_ERROR;
- }
-
COMPILE_ASSERT(sizeof(unsigned long) <= sizeof(stream->notifyData),
cast_validity_check);
unsigned long stream_id = reinterpret_cast<unsigned long>(stream->notifyData);
@@ -110,10 +53,6 @@ NPError ExecuteGetJavascriptUrlTest::NewStream(NPMIMEType type, NPStream* stream
}
int32 ExecuteGetJavascriptUrlTest::WriteReady(NPStream *stream) {
- if (npn_evaluate_context_) {
- SetError("WriteReady received in context of NPN_Evaluate");
- return NPERR_NO_ERROR;
- }
return STREAM_CHUNK;
}
@@ -124,11 +63,6 @@ int32 ExecuteGetJavascriptUrlTest::Write(NPStream *stream, int32 offset, int32 l
if (len < 0 || len > STREAM_CHUNK)
SetError("Write got bogus stream chunk size");
- if (npn_evaluate_context_) {
- SetError("Write received in context of NPN_Evaluate");
- return len;
- }
-
COMPILE_ASSERT(sizeof(unsigned long) <= sizeof(stream->notifyData),
cast_validity_check);
unsigned long stream_id = reinterpret_cast<unsigned long>(stream->notifyData);
@@ -149,15 +83,6 @@ NPError ExecuteGetJavascriptUrlTest::DestroyStream(NPStream *stream, NPError rea
if (stream == NULL)
SetError("NewStream got null stream");
-#ifdef OS_WIN
- KillTimer(window_, kNPNEvaluateTimerID);
-#endif
-
- if (npn_evaluate_context_) {
- SetError("DestroyStream received in context of NPN_Evaluate");
- return NPERR_NO_ERROR;
- }
-
COMPILE_ASSERT(sizeof(unsigned long) <= sizeof(stream->notifyData),
cast_validity_check);
unsigned long stream_id = reinterpret_cast<unsigned long>(stream->notifyData);
@@ -175,12 +100,6 @@ NPError ExecuteGetJavascriptUrlTest::DestroyStream(NPStream *stream, NPError rea
void ExecuteGetJavascriptUrlTest::URLNotify(const char* url, NPReason reason, void* data) {
COMPILE_ASSERT(sizeof(unsigned long) <= sizeof(data),
cast_validity_check);
-
- if (npn_evaluate_context_) {
- SetError("URLNotify received in context of NPN_Evaluate");
- return;
- }
-
unsigned long stream_id = reinterpret_cast<unsigned long>(data);
switch (stream_id) {
case SELF_URL_STREAM_ID:
diff --git a/webkit/glue/plugins/test/plugin_get_javascript_url_test.h b/webkit/glue/plugins/test/plugin_get_javascript_url_test.h
index 5c2540d..cff6775 100644
--- a/webkit/glue/plugins/test/plugin_get_javascript_url_test.h
+++ b/webkit/glue/plugins/test/plugin_get_javascript_url_test.h
@@ -28,18 +28,8 @@ class ExecuteGetJavascriptUrlTest : public PluginTest {
virtual void URLNotify(const char* url, NPReason reason, void* data);
private:
-#if defined(OS_WIN)
- static void CALLBACK TimerProc(HWND window, UINT message, UINT timer_id,
- unsigned long elapsed_time);
-#endif
bool test_started_;
- // This flag is set to true in the context of the NPN_Evaluate call.
- bool npn_evaluate_context_;
std::string self_url_;
-
-#if defined(OS_WIN)
- HWND window_;
-#endif
};
} // namespace NPAPIClient
diff --git a/webkit/glue/webplugin.h b/webkit/glue/webplugin.h
index 70952d0..07d2470 100644
--- a/webkit/glue/webplugin.h
+++ b/webkit/glue/webplugin.h
@@ -146,7 +146,8 @@ class WebPluginResourceClient {
const std::string& headers,
uint32 expected_length,
uint32 last_modified,
- bool request_is_seekable) = 0;
+ bool request_is_seekable,
+ bool* cancel) = 0;
virtual void DidReceiveData(const char* buffer, int length,
int data_offset) = 0;
virtual void DidFinishLoading() = 0;
diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc
index 1761b23..826bfb9 100644
--- a/webkit/glue/webplugin_impl.cc
+++ b/webkit/glue/webplugin_impl.cc
@@ -999,7 +999,13 @@ void WebPluginImpl::didReceiveResponse(WebURLLoader* loader,
base::SysWideToNativeMB(http_response_info.mime_type),
base::SysWideToNativeMB(GetAllHeaders(resource_response)),
http_response_info.expected_length,
- http_response_info.last_modified, request_is_seekable);
+ http_response_info.last_modified, request_is_seekable, &cancel);
+
+ if (cancel) {
+ loader->cancel();
+ RemoveClient(loader);
+ return;
+ }
// Bug http://b/issue?id=925559. The flash plugin would not handle the HTTP
// error codes in the stream header and as a result, was unaware of the