summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-05 21:48:25 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-05 21:48:25 +0000
commit7819eaf904308012c88078ca294018725a37c845 (patch)
treeda6452165fdaa93fdba906b1b148d4505d889260
parent63c971414584ce3f5c54513b4755ec1d94f8fe9f (diff)
downloadchromium_src-7819eaf904308012c88078ca294018725a37c845.zip
chromium_src-7819eaf904308012c88078ca294018725a37c845.tar.gz
chromium_src-7819eaf904308012c88078ca294018725a37c845.tar.bz2
Reverting r6396 the PDF fix to not cancel the manual data stream
load when the plugin calls NPN_RequestRead. I was looking at the wrong stream implementation in Firefox :( Bug=5009 TBR=jam Review URL: http://codereview.chromium.org/13212 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6454 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/glue/plugins/plugin_instance.cc14
-rw-r--r--webkit/glue/plugins/test/plugin_execute_script_delete_test.cc11
-rw-r--r--webkit/glue/webplugin.h3
-rw-r--r--webkit/glue/webplugin_impl.cc4
-rw-r--r--webkit/glue/webplugin_impl.h2
5 files changed, 29 insertions, 5 deletions
diff --git a/webkit/glue/plugins/plugin_instance.cc b/webkit/glue/plugins/plugin_instance.cc
index 5a14a2c..54711b7 100644
--- a/webkit/glue/plugins/plugin_instance.cc
+++ b/webkit/glue/plugins/plugin_instance.cc
@@ -382,11 +382,8 @@ void PluginInstance::DidReceiveManualData(const char* buffer, int length) {
void PluginInstance::DidFinishManualLoading() {
DCHECK(load_manually_);
if (plugin_data_stream_.get() != NULL) {
- // Don't close the stream if there are outstanding seekable requests.
- if (!plugin_data_stream_->seekable()) {
- plugin_data_stream_->DidFinishLoading();
- plugin_data_stream_->Close(NPRES_DONE);
- }
+ plugin_data_stream_->DidFinishLoading();
+ plugin_data_stream_->Close(NPRES_DONE);
plugin_data_stream_ = NULL;
}
}
@@ -472,6 +469,13 @@ void PluginInstance::RequestRead(NPStream* stream, NPByteRange* range_list) {
}
}
+ if (plugin_data_stream_) {
+ if (plugin_data_stream_->stream() == stream) {
+ webplugin_->CancelDocumentLoad();
+ plugin_data_stream_ = NULL;
+ }
+ }
+
// The lifetime of a NPStream instance depends on the PluginStream instance
// which owns it. When a plugin invokes NPN_RequestRead on a seekable stream,
// we don't want to create a new stream when the corresponding response is
diff --git a/webkit/glue/plugins/test/plugin_execute_script_delete_test.cc b/webkit/glue/plugins/test/plugin_execute_script_delete_test.cc
index 3f1d0e1..13be807 100644
--- a/webkit/glue/plugins/test/plugin_execute_script_delete_test.cc
+++ b/webkit/glue/plugins/test/plugin_execute_script_delete_test.cc
@@ -31,6 +31,17 @@ int16 ExecuteScriptDeleteTest::HandleEvent(void* event) {
if (WM_PAINT == np_event->event &&
base::strcasecmp(test_name_.c_str(),
"execute_script_delete_in_paint") == 0) {
+ NPString script_string;
+ script_string.UTF8Characters = "javascript:alert(\"hi\")";
+ script_string.UTF8Length =
+ static_cast<unsigned int>(strlen("javascript:alert(\"hi\")"));
+
+ NPObject *window_obj = NULL;
+ browser->getvalue(id(), NPNVWindowNPObject, &window_obj);
+ NPVariant result_var;
+ NPError result = browser->evaluate(id(), window_obj,
+ &script_string, &result_var);
+
NPUTF8* urlString = "javascript:DeletePluginWithinScript()";
NPUTF8* targetString = NULL;
browser->geturl(id(), urlString, targetString);
diff --git a/webkit/glue/webplugin.h b/webkit/glue/webplugin.h
index af688e6..b704153 100644
--- a/webkit/glue/webplugin.h
+++ b/webkit/glue/webplugin.h
@@ -129,6 +129,9 @@ class WebPlugin {
bool notify, const char* url,
void* notify_data, bool popups_allowed) = 0;
+ // Cancels document load.
+ virtual void CancelDocumentLoad() = 0;
+
// Initiates a HTTP range request.
virtual void InitiateHTTPRangeRequest(const char* url,
const char* range_info,
diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc
index 985fffb..61d2587 100644
--- a/webkit/glue/webplugin_impl.cc
+++ b/webkit/glue/webplugin_impl.cc
@@ -1265,6 +1265,10 @@ bool WebPluginImpl::InitiateHTTPRequest(int resource_id,
return true;
}
+void WebPluginImpl::CancelDocumentLoad() {
+ frame()->loader()->stopLoading(false);
+}
+
void WebPluginImpl::InitiateHTTPRangeRequest(const char* url,
const char* range_info,
HANDLE existing_stream,
diff --git a/webkit/glue/webplugin_impl.h b/webkit/glue/webplugin_impl.h
index dcb2178..3cc60ed 100644
--- a/webkit/glue/webplugin_impl.h
+++ b/webkit/glue/webplugin_impl.h
@@ -270,6 +270,8 @@ class WebPluginImpl : public WebPlugin,
bool notify, const char* url,
void* notify_data, bool popups_allowed);
+ void CancelDocumentLoad();
+
void InitiateHTTPRangeRequest(const char* url, const char* range_info,
HANDLE existing_stream, bool notify_needed,
HANDLE notify_data);