diff options
author | japhet <japhet@chromium.org> | 2015-12-03 20:01:36 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-04 04:02:25 +0000 |
commit | 15bd8a880b4999e376a2cecf53fcea2e7e1838d7 (patch) | |
tree | 3510ed661142a118f148eb52316930d748ac52a0 | |
parent | f8e3e14fe97bef28bf641f2b2b53352480bc28eb (diff) | |
download | chromium_src-15bd8a880b4999e376a2cecf53fcea2e7e1838d7.zip chromium_src-15bd8a880b4999e376a2cecf53fcea2e7e1838d7.tar.gz chromium_src-15bd8a880b4999e376a2cecf53fcea2e7e1838d7.tar.bz2 |
Remove PluginLoadObserver and related logic, it was only used for NPAPI.
This really, truly kills NPN_GetURL, NPN_GetURLNotify, NPN_PostURL, NPN_PostURLNotify, and NPN_URLRedirectResponse.
BUG=493212
Review URL: https://codereview.chromium.org/1426923007
Cr-Commit-Position: refs/heads/master@{#363119}
91 files changed, 42 insertions, 4419 deletions
diff --git a/components/plugins/renderer/webview_plugin.h b/components/plugins/renderer/webview_plugin.h index 75d079c..74b4b1b 100644 --- a/components/plugins/renderer/webview_plugin.h +++ b/components/plugins/renderer/webview_plugin.h @@ -110,13 +110,6 @@ class WebViewPlugin : public blink::WebPlugin, void didFinishLoading() override; void didFailLoading(const blink::WebURLError& error) override; - // Called in response to WebPluginContainer::loadFrameRequest - void didFinishLoadingFrameRequest(const blink::WebURL& url, - void* notifyData) override {} - void didFailLoadingFrameRequest(const blink::WebURL& url, - void* notify_data, - const blink::WebURLError& error) override {} - // WebViewClient methods: bool acceptsLoadDrops() override; diff --git a/components/test_runner/test_plugin.h b/components/test_runner/test_plugin.h index 129dc2a..6c52dfe 100644 --- a/components/test_runner/test_plugin.h +++ b/components/test_runner/test_plugin.h @@ -85,11 +85,6 @@ class TestPlugin : public blink::WebPlugin, public cc::TextureLayerClient { void didReceiveData(const char* data, int data_length) override {} void didFinishLoading() override {} void didFailLoading(const blink::WebURLError& error) override {} - void didFinishLoadingFrameRequest(const blink::WebURL& url, - void* notify_data) override {} - void didFailLoadingFrameRequest(const blink::WebURL& url, - void* notify_data, - const blink::WebURLError& error) override {} bool isPlaceholder() override; // cc::TextureLayerClient methods: diff --git a/content/child/BUILD.gn b/content/child/BUILD.gn index 3ebac31..5a70f60 100644 --- a/content/child/BUILD.gn +++ b/content/child/BUILD.gn @@ -72,15 +72,6 @@ source_set("child") { "npapi/plugin_instance.h", "npapi/plugin_lib.cc", "npapi/plugin_lib.h", - "npapi/plugin_stream.cc", - "npapi/plugin_stream.h", - "npapi/plugin_stream_posix.cc", - "npapi/plugin_stream_url.cc", - "npapi/plugin_stream_url.h", - "npapi/plugin_string_stream.cc", - "npapi/plugin_string_stream.h", - "npapi/plugin_url_fetcher.cc", - "npapi/plugin_url_fetcher.h", "npapi/webplugin.h", "npapi/webplugin_delegate.h", "npapi/webplugin_delegate_impl.cc", @@ -98,7 +89,6 @@ source_set("child") { ] } else if (is_win) { sources -= [ - "npapi/plugin_stream_win.cc", "npapi/webplugin_delegate_impl_win.cc", "npapi/webplugin_ime_win.cc", "npapi/webplugin_ime_win.h", diff --git a/content/child/npapi/plugin_host.cc b/content/child/npapi/plugin_host.cc index ea7d0a0..4f3006e 100644 --- a/content/child/npapi/plugin_host.cc +++ b/content/child/npapi/plugin_host.cc @@ -16,7 +16,6 @@ #include "build/build_config.h" #include "content/child/npapi/plugin_instance.h" #include "content/child/npapi/plugin_lib.h" -#include "content/child/npapi/plugin_stream_url.h" #include "content/child/npapi/webplugin_delegate.h" #include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" @@ -339,174 +338,28 @@ void NPN_ReloadPlugins(NPBool reload_pages) { // Requests a range of bytes for a seekable stream. NPError NPN_RequestRead(NPStream* stream, NPByteRange* range_list) { - if (!stream || !range_list) - return NPERR_GENERIC_ERROR; - - scoped_refptr<PluginInstance> plugin( - reinterpret_cast<PluginInstance*>(stream->ndata)); - if (!plugin.get()) - return NPERR_GENERIC_ERROR; - - plugin->RequestRead(stream, range_list); - return NPERR_NO_ERROR; -} - -// Generic form of GetURL for common code between GetURL and GetURLNotify. -static NPError GetURLNotify(NPP id, - const char* url, - const char* target, - bool notify, - void* notify_data) { - if (!url) - return NPERR_INVALID_URL; - - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (!plugin.get()) { - return NPERR_GENERIC_ERROR; - } - - plugin->RequestURL(url, "GET", target, NULL, 0, notify, notify_data); - return NPERR_NO_ERROR; + return NPERR_GENERIC_ERROR; } -// Requests creation of a new stream with the contents of the -// specified URL; gets notification of the result. NPError NPN_GetURLNotify(NPP id, const char* url, const char* target, void* notify_data) { - // This is identical to NPN_GetURL, but after finishing, the - // browser will call NPP_URLNotify to inform the plugin that - // it has completed. - - // According to the NPAPI documentation, if target == _self - // or a parent to _self, the browser should return NPERR_INVALID_PARAM, - // because it can't notify the plugin once deleted. This is - // absolutely false; firefox doesn't do this, and Flash relies on - // being able to use this. - - // Also according to the NPAPI documentation, we should return - // NPERR_INVALID_URL if the url requested is not valid. However, - // this would require that we synchronously start fetching the - // URL. That just isn't practical. As such, there really is - // no way to return this error. From looking at the Firefox - // implementation, it doesn't look like Firefox does this either. - - return GetURLNotify(id, url, target, true, notify_data); + return NPERR_GENERIC_ERROR; } NPError NPN_GetURL(NPP id, const char* url, const char* target) { - // Notes: - // Request from the Plugin to fetch content either for the plugin - // or to be placed into a browser window. - // - // If target == null, the browser fetches content and streams to plugin. - // otherwise, the browser loads content into an existing browser frame. - // If the target is the window/frame containing the plugin, the plugin - // may be destroyed. - // If the target is _blank, a mailto: or news: url open content in a new - // browser window - // If the target is _self, no other instance of the plugin is created. The - // plugin continues to operate in its own window - - return GetURLNotify(id, url, target, false, 0); -} - -// Generic form of PostURL for common code between PostURL and PostURLNotify. -static NPError PostURLNotify(NPP id, - const char* url, - const char* target, - uint32_t len, - const char* buf, - NPBool file, - bool notify, - void* notify_data) { - if (!url) - return NPERR_INVALID_URL; - - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (!plugin.get()) { - NOTREACHED(); - return NPERR_GENERIC_ERROR; - } - - std::string post_file_contents; - - if (file) { - // Post data to be uploaded from a file. This can be handled in two - // ways. - // 1. Read entire file and send the contents as if it was a post data - // specified in the argument - // 2. Send just the file details and read them in the browser at the - // time of sending the request. - // Approach 2 is more efficient but complicated. Approach 1 has a major - // drawback of sending potentially large data over two IPC hops. In a way - // 'large data over IPC' problem exists as it is in case of plugin giving - // the data directly instead of in a file. - // Currently we are going with the approach 1 to get the feature working. - // We can optimize this later with approach 2. - - // TODO(joshia): Design a scheme to send a file descriptor instead of - // entire file contents across. - - // Security alert: - // --------------- - // Here we are blindly uploading whatever file requested by a plugin. - // This is risky as someone could exploit a plugin to send private - // data in arbitrary locations. - // A malicious (non-sandboxed) plugin has unfeterred access to OS - // resources and can do this anyway without using browser's HTTP stack. - // FWIW, Firefox and Safari don't perform any security checks. - - if (!buf) - return NPERR_FILE_NOT_FOUND; - - std::string file_path_ascii(buf); - base::FilePath file_path; - static const char kFileUrlPrefix[] = "file:"; - if (base::StartsWith(file_path_ascii, kFileUrlPrefix, - base::CompareCase::INSENSITIVE_ASCII)) { - GURL file_url(file_path_ascii); - DCHECK(file_url.SchemeIsFile()); - net::FileURLToFilePath(file_url, &file_path); - } else { - file_path = base::FilePath::FromUTF8Unsafe(file_path_ascii); - } - - base::File::Info post_file_info; - if (!base::GetFileInfo(file_path, &post_file_info) || - post_file_info.is_directory) - return NPERR_FILE_NOT_FOUND; - - if (!base::ReadFileToString(file_path, &post_file_contents)) - return NPERR_FILE_NOT_FOUND; - - buf = post_file_contents.c_str(); - len = post_file_contents.size(); - } - - // The post data sent by a plugin contains both headers - // and post data. Example: - // Content-type: text/html - // Content-length: 200 - // - // <200 bytes of content here> - // - // Unfortunately, our stream needs these broken apart, - // so we need to parse the data and set headers and data - // separately. - plugin->RequestURL(url, "POST", target, buf, len, notify, notify_data); - return NPERR_NO_ERROR; + return NPERR_GENERIC_ERROR; } NPError NPN_PostURLNotify(NPP id, - const char* url, - const char* target, - uint32_t len, - const char* buf, - NPBool file, - void* notify_data) { - return PostURLNotify(id, url, target, len, buf, file, true, notify_data); + const char* url, + const char* target, + uint32_t len, + const char* buf, + NPBool file, + void* notify_data) { + return NPERR_GENERIC_ERROR; } NPError NPN_PostURL(NPP id, @@ -515,28 +368,7 @@ NPError NPN_PostURL(NPP id, uint32_t len, const char* buf, NPBool file) { - // POSTs data to an URL, either from a temp file or a buffer. - // If file is true, buf contains a temp file (which host will delete after - // completing), and len contains the length of the filename. - // If file is false, buf contains the data to send, and len contains the - // length of the buffer - // - // If target is null, - // server response is returned to the plugin - // If target is _current, _self, or _top, - // server response is written to the plugin window and plugin is unloaded. - // If target is _new or _blank, - // server response is written to a new browser window - // If target is an existing frame, - // server response goes to that frame. - // - // For protocols other than FTP - // file uploads must be line-end converted from \r\n to \n - // - // Note: you cannot specify headers (even a blank line) in a memory buffer, - // use NPN_PostURLNotify - - return PostURLNotify(id, url, target, len, buf, file, false, 0); + return NPERR_GENERIC_ERROR; } NPError NPN_NewStream(NPP id, @@ -1098,10 +930,6 @@ NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) { } void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { - scoped_refptr<PluginInstance> plugin(FindInstance(instance)); - if (plugin.get()) { - plugin->URLRedirectResponse(!!allow, notify_data); - } } } // extern "C" diff --git a/content/child/npapi/plugin_instance.cc b/content/child/npapi/plugin_instance.cc index c6c15441..4684fd7 100644 --- a/content/child/npapi/plugin_instance.cc +++ b/content/child/npapi/plugin_instance.cc @@ -15,8 +15,6 @@ #include "build/build_config.h" #include "content/child/npapi/plugin_host.h" #include "content/child/npapi/plugin_lib.h" -#include "content/child/npapi/plugin_stream_url.h" -#include "content/child/npapi/plugin_string_stream.h" #include "content/child/npapi/webplugin.h" #include "content/child/npapi/webplugin_delegate.h" #include "content/child/npapi/webplugin_resource_client.h" @@ -40,7 +38,6 @@ PluginInstance::PluginInstance(PluginLib* plugin, const std::string& mime_type) transparent_(true), webplugin_(0), mime_type_(mime_type), - get_notify_data_(0), use_mozilla_user_agent_(false), #if defined (OS_MACOSX) #ifdef NP_NO_QUICKDRAW @@ -57,11 +54,7 @@ PluginInstance::PluginInstance(PluginLib* plugin, const std::string& mime_type) #endif task_runner_(base::ThreadTaskRunnerHandle::Get()), load_manually_(false), - in_close_streams_(false), - next_timer_id_(1), - next_notify_id_(0), - next_range_request_id_(0), - handles_url_redirects_(false) { + next_timer_id_(1) { npp_ = new NPP_t(); npp_->ndata = 0; npp_->pdata = 0; @@ -73,8 +66,6 @@ PluginInstance::PluginInstance(PluginLib* plugin, const std::string& mime_type) } PluginInstance::~PluginInstance() { - CloseStreams(); - if (npp_ != 0) { delete npp_; npp_ = 0; @@ -84,73 +75,6 @@ PluginInstance::~PluginInstance() { plugin_->CloseInstance(); } -PluginStreamUrl* PluginInstance::CreateStream(unsigned long resource_id, - const GURL& url, - const std::string& mime_type, - int notify_id) { - - bool notify; - void* notify_data; - GetNotifyData(notify_id, ¬ify, ¬ify_data); - PluginStreamUrl* stream = new PluginStreamUrl( - resource_id, url, this, notify, notify_data); - - AddStream(stream); - return stream; -} - -void PluginInstance::AddStream(PluginStream* stream) { - open_streams_.push_back(make_scoped_refptr(stream)); -} - -void PluginInstance::RemoveStream(PluginStream* stream) { - if (in_close_streams_) - return; - - std::vector<scoped_refptr<PluginStream> >::iterator stream_index; - for (stream_index = open_streams_.begin(); - stream_index != open_streams_.end(); ++stream_index) { - if (stream_index->get() == stream) { - open_streams_.erase(stream_index); - break; - } - } -} - -bool PluginInstance::IsValidStream(const NPStream* stream) { - std::vector<scoped_refptr<PluginStream> >::iterator stream_index; - for (stream_index = open_streams_.begin(); - stream_index != open_streams_.end(); ++stream_index) { - if ((*stream_index)->stream() == stream) - return true; - } - - return false; -} - -void PluginInstance::CloseStreams() { - in_close_streams_ = true; - for (unsigned int index = 0; index < open_streams_.size(); ++index) { - // Close all streams on the way down. - open_streams_[index]->Close(NPRES_USER_BREAK); - } - open_streams_.clear(); - in_close_streams_ = false; -} - -WebPluginResourceClient* PluginInstance::GetRangeRequest( - int id) { - PendingRangeRequestMap::iterator iter = pending_range_requests_.find(id); - if (iter == pending_range_requests_.end()) { - NOTREACHED(); - return NULL; - } - - WebPluginResourceClient* rv = iter->second->AsResourceClient(); - pending_range_requests_.erase(iter); - return rv; -} - bool PluginInstance::Start(const GURL& url, char** const param_names, char** const param_values, @@ -162,12 +86,6 @@ bool PluginInstance::Start(const GURL& url, NPError err = NPP_New(mode, param_count, const_cast<char **>(param_names), const_cast<char **>(param_values)); - - if (err == NPERR_NO_ERROR) { - handles_url_redirects_ = - ((npp_functions_->version >= NPVERS_HAS_URL_REDIRECT_HANDLING) && - (npp_functions_->urlredirectnotify)); - } return err == NPERR_NO_ERROR; } @@ -192,21 +110,6 @@ bool PluginInstance::GetFormValue(base::string16* value) { return true; } -// WebPluginLoadDelegate methods -void PluginInstance::DidFinishLoadWithReason(const GURL& url, - NPReason reason, - int notify_id) { - bool notify; - void* notify_data; - GetNotifyData(notify_id, ¬ify, ¬ify_data); - if (!notify) { - NOTREACHED(); - return; - } - - NPP_URLNotify(url.spec().c_str(), reason, notify_data); -} - unsigned PluginInstance::GetBackingTextureId() { // By default the plugin instance is not backed by an OpenGL texture. return 0; @@ -280,7 +183,7 @@ NPError PluginInstance::NPP_DestroyStream(NPStream* stream, NPReason reason) { DCHECK(npp_functions_ != 0); DCHECK(npp_functions_->destroystream != 0); - if (stream == NULL || !IsValidStream(stream) || (stream->ndata == NULL)) + if (stream == NULL || (stream->ndata == NULL)) return NPERR_INVALID_INSTANCE_ERROR; if (npp_functions_->destroystream != 0) { @@ -326,16 +229,6 @@ void PluginInstance::NPP_StreamAsFile(NPStream* stream, const char* fname) { files_created_.push_back(file_name); } -void PluginInstance::NPP_URLNotify(const char* url, - NPReason reason, - void* notifyData) { - DCHECK(npp_functions_ != 0); - DCHECK(npp_functions_->urlnotify != 0); - if (npp_functions_->urlnotify != 0) { - npp_functions_->urlnotify(npp_, url, reason, notifyData); - } -} - NPError PluginInstance::NPP_GetValue(NPPVariable variable, void* value) { DCHECK(npp_functions_ != 0); // getvalue is NULL for Shockwave @@ -371,71 +264,6 @@ bool PluginInstance::NPP_Print(NPPrint* platform_print) { return false; } -void PluginInstance::NPP_URLRedirectNotify(const char* url, int32_t status, - void* notify_data) { - DCHECK(npp_functions_ != 0); - if (npp_functions_->urlredirectnotify != 0) { - npp_functions_->urlredirectnotify(npp_, url, status, notify_data); - } -} - -void PluginInstance::SendJavaScriptStream(const GURL& url, - const std::string& result, - bool success, - int notify_id) { - bool notify; - void* notify_data; - GetNotifyData(notify_id, ¬ify, ¬ify_data); - - if (success) { - PluginStringStream *stream = - new PluginStringStream(this, url, notify, notify_data); - AddStream(stream); - stream->SendToPlugin(result, "text/html"); - } else { - // NOTE: Sending an empty stream here will crash MacroMedia - // Flash 9. Just send the URL Notify. - if (notify) - NPP_URLNotify(url.spec().c_str(), NPRES_DONE, notify_data); - } -} - -void PluginInstance::DidReceiveManualResponse(const GURL& url, - const std::string& mime_type, - const std::string& headers, - uint32 expected_length, - uint32 last_modified) { - DCHECK(load_manually_); - - plugin_data_stream_ = - CreateStream(static_cast<unsigned long>(-1), url, mime_type, 0); - plugin_data_stream_->DidReceiveResponse(mime_type, headers, expected_length, - last_modified, true); -} - -void PluginInstance::DidReceiveManualData(const char* buffer, int length) { - DCHECK(load_manually_); - if (plugin_data_stream_.get() != NULL) { - plugin_data_stream_->DidReceiveData(buffer, length, 0); - } -} - -void PluginInstance::DidFinishManualLoading() { - DCHECK(load_manually_); - if (plugin_data_stream_.get() != NULL) { - plugin_data_stream_->DidFinishLoading(plugin_data_stream_->ResourceId()); - plugin_data_stream_->Close(NPRES_DONE); - plugin_data_stream_ = NULL; - } -} - -void PluginInstance::DidManualLoadFail() { - DCHECK(load_manually_); - if (plugin_data_stream_.get() != NULL) { - plugin_data_stream_->DidFail(plugin_data_stream_->ResourceId()); - plugin_data_stream_ = NULL; - } -} void PluginInstance::PluginThreadAsyncCall(void (*func)(void*), void* user_data) { @@ -526,76 +354,6 @@ void PluginInstance::PopPopupsEnabledState() { popups_enabled_stack_.pop(); } -void PluginInstance::RequestRead(NPStream* stream, NPByteRange* range_list) { - std::string range_info = "bytes="; - - while (range_list) { - range_info += base::IntToString(range_list->offset); - range_info.push_back('-'); - range_info += - base::UintToString(range_list->offset + range_list->length - 1); - range_list = range_list->next; - if (range_list) - range_info.push_back(','); - } - - if (plugin_data_stream_.get()) { - 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 - // received. We send over a cookie which represents the PluginStream - // instance which is sent back from the renderer when the response is - // received. - std::vector<scoped_refptr<PluginStream> >::iterator stream_index; - for (stream_index = open_streams_.begin(); - stream_index != open_streams_.end(); ++stream_index) { - PluginStream* plugin_stream = stream_index->get(); - if (plugin_stream->stream() == stream) { - // A stream becomes seekable the first time NPN_RequestRead - // is called on it. - plugin_stream->set_seekable(true); - - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisableDirectNPAPIRequests)) { - pending_range_requests_[++next_range_request_id_] = plugin_stream; - webplugin_->InitiateHTTPRangeRequest( - stream->url, range_info.c_str(), next_range_request_id_); - return; - } else { - PluginStreamUrl* plugin_stream_url = - static_cast<PluginStreamUrl*>(plugin_stream); - plugin_stream_url->FetchRange(range_info); - return; - } - } - } - NOTREACHED(); -} - -void PluginInstance::RequestURL(const char* url, - const char* method, - const char* target, - const char* buf, - unsigned int len, - bool notify, - void* notify_data) { - int notify_id = 0; - if (notify) { - notify_id = ++next_notify_id_; - pending_requests_[notify_id] = notify_data; - } - - webplugin_->HandleURLRequest( - url, method, target, buf, len, notify_id, popups_allowed(), - notify ? handles_url_redirects_ : false); -} - bool PluginInstance::ConvertPoint(double source_x, double source_y, NPCoordinateSpace source_space, double* dest_x, double* dest_y, @@ -666,33 +424,4 @@ bool PluginInstance::ConvertPoint(double source_x, double source_y, #endif } -void PluginInstance::GetNotifyData(int notify_id, - bool* notify, - void** notify_data) { - PendingRequestMap::iterator iter = pending_requests_.find(notify_id); - if (iter != pending_requests_.end()) { - *notify = true; - *notify_data = iter->second; - pending_requests_.erase(iter); - } else { - *notify = false; - *notify_data = NULL; - } -} - -void PluginInstance::URLRedirectResponse(bool allow, void* notify_data) { - // The notify_data passed in allows us to identify the matching stream. - std::vector<scoped_refptr<PluginStream> >::iterator stream_index; - for (stream_index = open_streams_.begin(); - stream_index != open_streams_.end(); ++stream_index) { - PluginStream* plugin_stream = stream_index->get(); - if (plugin_stream->notify_data() == notify_data) { - PluginStreamUrl* plugin_stream_url = - static_cast<PluginStreamUrl*>(plugin_stream); - plugin_stream_url->URLRedirectResponse(allow); - break; - } - } -} - } // namespace content diff --git a/content/child/npapi/plugin_instance.h b/content/child/npapi/plugin_instance.h index 9558930..bf5a5fe 100644 --- a/content/child/npapi/plugin_instance.h +++ b/content/child/npapi/plugin_instance.h @@ -31,8 +31,6 @@ namespace content { class PluginLib; class PluginHost; -class PluginStream; -class PluginStreamUrl; class WebPlugin; class WebPluginResourceClient; @@ -121,30 +119,6 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { } #endif - // Creates a stream for sending an URL. If notify_id is non-zero, it will - // send a notification to the plugin when the stream is complete; otherwise it - // will not. Set object_url to true if the load is for the object tag's url, - // or false if it's for a url that the plugin fetched through - // NPN_GetUrl[Notify]. - PluginStreamUrl* CreateStream(unsigned long resource_id, - const GURL& url, - const std::string& mime_type, - int notify_id); - - // For each instance, we track all streams. When the - // instance closes, all remaining streams are also - // closed. All streams associated with this instance - // should call AddStream so that they can be cleaned - // up when the instance shuts down. - void AddStream(PluginStream* stream); - - // This is called when a stream is closed. We remove the stream from the - // list, which releases the reference maintained to the stream. - void RemoveStream(PluginStream* stream); - - // Closes all open streams on this instance. - void CloseStreams(); - // Returns the WebPluginResourceClient object for a stream that has become // seekable. WebPluginResourceClient* GetRangeRequest(int id); @@ -155,10 +129,6 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { // Returns the form value of this instance. bool GetFormValue(base::string16* value); - // WebViewDelegate methods that we implement. This is for handling - // callbacks during getURLNotify. - void DidFinishLoadWithReason(const GURL& url, NPReason reason, int notify_id); - // If true, send the Mozilla user agent instead of Chrome's to the plugin. bool use_mozilla_user_agent() { return use_mozilla_user_agent_; } void set_use_mozilla_user_agent() { use_mozilla_user_agent_ = true; } @@ -205,17 +175,7 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { void SendJavaScriptStream(const GURL& url, const std::string& result, - bool success, - int notify_id); - - void DidReceiveManualResponse(const GURL& url, - const std::string& mime_type, - const std::string& headers, - uint32 expected_length, - uint32 last_modified); - void DidReceiveManualData(const char* buffer, int length); - void DidFinishManualLoading(); - void DidManualLoadFail(); + bool success); void PushPopupsEnabledState(bool enabled); void PopPopupsEnabledState(); @@ -224,25 +184,6 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { return popups_enabled_stack_.empty() ? false : popups_enabled_stack_.top(); } - // Initiates byte range reads for plugins. - void RequestRead(NPStream* stream, NPByteRange* range_list); - - // Handles GetURL/GetURLNotify/PostURL/PostURLNotify requests initiated - // by plugins. - void RequestURL(const char* url, - const char* method, - const char* target, - const char* buf, - unsigned int len, - bool notify, - void* notify_data); - - // Handles NPN_URLRedirectResponse calls issued by plugins in response to - // HTTP URL redirect notifications. - void URLRedirectResponse(bool allow, void* notify_data); - - bool handles_url_redirects() const { return handles_url_redirects_; } - private: friend class base::RefCountedThreadSafe<PluginInstance>; @@ -261,8 +202,6 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { void OnPluginThreadAsyncCall(void (*func)(void *), void* userData); void OnTimerCall(void (*func)(NPP id, uint32 timer_id), NPP id, uint32 timer_id); - bool IsValidStream(const NPStream* stream); - void GetNotifyData(int notify_id, bool* notify, void** notify_data); // This is a hack to get the real player plugin to work with chrome // The real player plugin dll(nppl3260) when loaded by firefox is loaded via @@ -289,14 +228,11 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { NPP npp_; scoped_refptr<PluginHost> host_; NPPluginFuncs* npp_functions_; - std::vector<scoped_refptr<PluginStream> > open_streams_; gfx::PluginWindowHandle window_handle_; bool windowless_; bool transparent_; WebPlugin* webplugin_; std::string mime_type_; - GURL get_url_; - intptr_t get_notify_data_; bool use_mozilla_user_agent_; #if defined(OS_MACOSX) NPDrawingModel drawing_model_; @@ -306,7 +242,6 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { NPCocoaEvent* currently_handled_event_; // weak #endif scoped_refptr<base::SingleThreadTaskRunner> task_runner_; - scoped_refptr<PluginStreamUrl> plugin_data_stream_; // This flag if true indicates that the plugin data would be passed from // webkit. if false indicates that the plugin should download the data. @@ -316,9 +251,6 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { // NPN_GetURL/NPN_GetURLNotify calls. std::stack<bool> popups_enabled_stack_; - // True if in CloseStreams(). - bool in_close_streams_; - // List of files created for the current plugin instance. File names are // added to the list every time the NPP_StreamAsFile function is called. std::vector<base::FilePath> files_created_; @@ -334,21 +266,6 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { typedef std::map<uint32, TimerInfo> TimerMap; TimerMap timers_; - // Tracks pending GET/POST requests so that the plugin-given data doesn't - // cross process boundaries to an untrusted process. - typedef std::map<int, void*> PendingRequestMap; - PendingRequestMap pending_requests_; - int next_notify_id_; - - // Used to track pending range requests so that when WebPlugin replies to us - // we can match the reply to the stream. - typedef std::map<int, scoped_refptr<PluginStream> > PendingRangeRequestMap; - PendingRangeRequestMap pending_range_requests_; - int next_range_request_id_; - // The plugin handles the NPAPI URL redirect notification API. - // See here https://wiki.mozilla.org/NPAPI:HTTPRedirectHandling - bool handles_url_redirects_; - DISALLOW_COPY_AND_ASSIGN(PluginInstance); }; diff --git a/content/child/npapi/plugin_stream.cc b/content/child/npapi/plugin_stream.cc deleted file mode 100644 index 282f69b..0000000 --- a/content/child/npapi/plugin_stream.cc +++ /dev/null @@ -1,282 +0,0 @@ -// Copyright (c) 2012 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. - -// TODO : Support NP_ASFILEONLY mode -// TODO : Support NP_SEEK mode -// TODO : Support SEEKABLE=true in NewStream - -#include "content/child/npapi/plugin_stream.h" - -#include <algorithm> - -#include "base/bind.h" -#include "base/location.h" -#include "base/single_thread_task_runner.h" -#include "base/strings/string_util.h" -#include "base/strings/utf_string_conversions.h" -#include "base/thread_task_runner_handle.h" -#include "content/child/npapi/plugin_instance.h" -#include "net/base/mime_util.h" -#include "url/gurl.h" - -namespace content { - -PluginStream::PluginStream( - PluginInstance* instance, - const char* url, - bool need_notify, - void* notify_data) - : instance_(instance), - notify_needed_(need_notify), - notify_data_(notify_data), - close_on_write_data_(false), - requested_plugin_mode_(NP_NORMAL), - opened_(false), - data_offset_(0), - seekable_stream_(false) { - memset(&stream_, 0, sizeof(stream_)); - stream_.url = base::strdup(url); - ResetTempFileHandle(); - ResetTempFileName(); -} - -PluginStream::~PluginStream() { - // always close our temporary files. - CloseTempFile(); - free(const_cast<char*>(stream_.url)); -} - -bool PluginStream::Open(const std::string& mime_type, - const std::string& headers, - uint32 length, - uint32 last_modified, - bool request_is_seekable) { - headers_ = headers; - NPP id = instance_->npp(); - stream_.end = length; - stream_.lastmodified = last_modified; - stream_.pdata = 0; - stream_.ndata = id->ndata; - stream_.notifyData = notify_data_; - if (!headers_.empty()) - stream_.headers = headers_.c_str(); - - bool seekable_stream = false; - if (request_is_seekable) { - std::string headers_lc = base::ToLowerASCII(headers); - if (headers_lc.find("accept-ranges: bytes") != std::string::npos) { - seekable_stream = true; - } - } - - const char* char_mime_type = "application/x-unknown-content-type"; - std::string temp_mime_type; - if (!mime_type.empty()) { - char_mime_type = mime_type.c_str(); - } else { - GURL gurl(stream_.url); - - base::FilePath path = base::FilePath::FromUTF8Unsafe(gurl.path()); - if (net::GetMimeTypeFromFile(path, &temp_mime_type)) - char_mime_type = temp_mime_type.c_str(); - } - - // Silverlight expects a valid mime type - DCHECK_NE(0U, strlen(char_mime_type)); - NPError err = instance_->NPP_NewStream((NPMIMEType)char_mime_type, - &stream_, seekable_stream, - &requested_plugin_mode_); - if (err != NPERR_NO_ERROR) { - Notify(err); - return false; - } - - opened_ = true; - - if (requested_plugin_mode_ == NP_SEEK) { - seekable_stream_ = true; - } - // If the plugin has requested certain modes, then we need a copy - // of this file on disk. Open it and save it as we go. - if (RequestedPluginModeIsAsFile()) { - if (OpenTempFile() == false) { - return false; - } - } - - mime_type_ = char_mime_type; - return true; -} - -int PluginStream::Write(const char* buffer, const int length, - int data_offset) { - // There may be two streams to write to - the plugin and the file. - // It is unclear what to do if we cannot write to both. The rules of - // this function are that the plugin must consume at least as many - // bytes as returned by the WriteReady call. So, we will attempt to - // write that many to both streams. If we can't write that many bytes - // to each stream, we'll return failure. - - DCHECK(opened_); - if (WriteToFile(buffer, length) && - WriteToPlugin(buffer, length, data_offset)) { - return length; - } - - return -1; -} - -bool PluginStream::WriteToFile(const char* buf, size_t length) { - // For ASFILEONLY, ASFILE, and SEEK modes, we need to write - // to the disk - if (TempFileIsValid() && RequestedPluginModeIsAsFile()) { - size_t totalBytesWritten = 0, bytes; - do { - bytes = WriteBytes(buf, length); - totalBytesWritten += bytes; - } while (bytes > 0U && totalBytesWritten < length); - - if (totalBytesWritten != length) { - return false; - } - } - - return true; -} - -bool PluginStream::WriteToPlugin(const char* buf, const int length, - const int data_offset) { - // For NORMAL and ASFILE modes, we send the data to the plugin now - if (requested_plugin_mode_ != NP_NORMAL && - requested_plugin_mode_ != NP_ASFILE && - requested_plugin_mode_ != NP_SEEK) { - return true; - } - - int written = TryWriteToPlugin(buf, length, data_offset); - if (written == -1) - return false; - - if (written < length) { - // Buffer the remaining data. - size_t remaining = length - written; - size_t previous_size = delivery_data_.size(); - delivery_data_.resize(previous_size + remaining); - data_offset_ = data_offset; - memcpy(&delivery_data_[previous_size], buf + written, remaining); - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(&PluginStream::OnDelayDelivery, this)); - } - - return true; -} - -void PluginStream::OnDelayDelivery() { - // It is possible that the plugin stream may have closed before the task - // was hit. - if (!opened_) - return; - - int size = static_cast<int>(delivery_data_.size()); - int written = TryWriteToPlugin(&delivery_data_.front(), size, data_offset_); - if (written > 0) { - // Remove the data that we already wrote. - delivery_data_.erase(delivery_data_.begin(), - delivery_data_.begin() + written); - } -} - -int PluginStream::TryWriteToPlugin(const char* buf, const int length, - const int data_offset) { - int byte_offset = 0; - - if (data_offset > 0) - data_offset_ = data_offset; - - while (byte_offset < length) { - int bytes_remaining = length - byte_offset; - int bytes_to_write = instance_->NPP_WriteReady(&stream_); - if (bytes_to_write > bytes_remaining) - bytes_to_write = bytes_remaining; - - if (bytes_to_write == 0) - return byte_offset; - - int bytes_consumed = instance_->NPP_Write( - &stream_, data_offset_, bytes_to_write, - const_cast<char*>(buf + byte_offset)); - if (bytes_consumed < 0) { - // The plugin failed, which means that we need to close the stream. - Close(NPRES_NETWORK_ERR); - return -1; - } - if (bytes_consumed == 0) { - // The plugin couldn't take all of the data now. - return byte_offset; - } - - // The plugin might report more that we gave it. - bytes_consumed = std::min(bytes_consumed, bytes_to_write); - - data_offset_ += bytes_consumed; - byte_offset += bytes_consumed; - } - - if (close_on_write_data_) - Close(NPRES_DONE); - - return length; -} - -bool PluginStream::Close(NPReason reason) { - if (opened_ == true) { - opened_ = false; - - if (delivery_data_.size()) { - if (reason == NPRES_DONE) { - // There is more data to be streamed, don't destroy the stream now. - close_on_write_data_ = true; - return true; - } else { - // Stop any pending data from being streamed - delivery_data_.resize(0); - } - } - - // If we have a temp file, be sure to close it. - // Also, allow the plugin to access it now. - if (TempFileIsValid()) { - CloseTempFile(); - if (reason == NPRES_DONE) - WriteAsFile(); - } - - if (stream_.ndata != NULL) { - // Stream hasn't been closed yet. - NPError err = instance_->NPP_DestroyStream(&stream_, reason); - DCHECK(err == NPERR_NO_ERROR); - } - } - - Notify(reason); - return true; -} - -WebPluginResourceClient* PluginStream::AsResourceClient() { - return NULL; -} - -void PluginStream::Notify(NPReason reason) { - if (notify_needed_) { - instance_->NPP_URLNotify(stream_.url, reason, notify_data_); - notify_needed_ = false; - } -} - -bool PluginStream::RequestedPluginModeIsAsFile() const { - return (requested_plugin_mode_ == NP_ASFILE || - requested_plugin_mode_ == NP_ASFILEONLY); -} - -} // namespace content diff --git a/content/child/npapi/plugin_stream.h b/content/child/npapi/plugin_stream.h deleted file mode 100644 index 644e16c..0000000 --- a/content/child/npapi/plugin_stream.h +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) 2012 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 CONTENT_CHILD_NPAPI_PLUGIN_STREAM_H_ -#define CONTENT_CHILD_NPAPI_PLUGIN_STREAM_H_ - -#include <string> -#include <vector> - -#include "base/files/file_path.h" -#include "base/memory/ref_counted.h" -#include "build/build_config.h" -#include "third_party/npapi/bindings/npapi.h" - -namespace content { - -class PluginInstance; -class WebPluginResourceClient; - -// Base class for a NPAPI stream. Tracks basic elements -// of a stream for NPAPI notifications and stream position. -class PluginStream : public base::RefCounted<PluginStream> { - public: - // Create a new PluginStream object. If needNotify is true, then the - // plugin will be notified when the stream has been fully sent. - PluginStream(PluginInstance* instance, - const char* url, - bool need_notify, - void* notify_data); - - // Opens the stream to the Plugin. - // If the mime-type is not specified, we'll try to find one based on the - // mime-types table and the extension (if any) in the URL. - // If the size of the stream is known, use length to set the size. If - // not known, set length to 0. - // The request_is_seekable parameter indicates whether byte range requests - // can be issued on the stream. - bool Open(const std::string &mime_type, - const std::string &headers, - uint32 length, - uint32 last_modified, - bool request_is_seekable); - - // Writes to the stream. - int Write(const char* buf, const int len, int data_offset); - - // Write the result as a file. - void WriteAsFile(); - - // Notify the plugin that a stream is complete. - void Notify(NPReason reason); - - // Close the stream. - virtual bool Close(NPReason reason); - - virtual WebPluginResourceClient* AsResourceClient(); - - // Cancels any HTTP requests initiated by the stream. - virtual void CancelRequest() {} - - NPStream* stream() { return &stream_; } - - PluginInstance* instance() { return instance_.get(); } - - // setter/getter for the seekable attribute on the stream. - bool seekable() const { return seekable_stream_; } - - void set_seekable(bool seekable) { seekable_stream_ = seekable; } - - // getters for reading the notification related attributes on the stream. - bool notify_needed() const { return notify_needed_; } - - void* notify_data() const { return notify_data_; } - - protected: - friend class base::RefCounted<PluginStream>; - - virtual ~PluginStream(); - - // Check if the stream is open. - bool open() { return opened_; } - - private: - // Per platform method to reset the temporary file handle. - void ResetTempFileHandle(); - - // Per platform method to reset the temporary file name. - void ResetTempFileName(); - - // Open a temporary file for this stream. - // If successful, will set temp_file_name_, temp_file_handle_, and - // return true. - bool OpenTempFile(); - - // Closes the temporary file if it is open. - void CloseTempFile(); - - // Sends the data to the file. Called From WriteToFile. - size_t WriteBytes(const char* buf, size_t length); - - // Sends the data to the file if it's open. - bool WriteToFile(const char* buf, size_t length); - - // Sends the data to the plugin. If it's not ready, handles buffering it - // and retrying later. - bool WriteToPlugin(const char* buf, const int length, const int data_offset); - - // Send the data to the plugin, returning how many bytes it accepted, or -1 - // if an error occurred. - int TryWriteToPlugin(const char* buf, const int length, - const int data_offset); - - // The callback which calls TryWriteToPlugin. - void OnDelayDelivery(); - - // Returns true if the temp file is valid and open for writing. - bool TempFileIsValid() const; - - // Returns true if |requested_plugin_mode_| is NP_ASFILE or NP_ASFILEONLY. - bool RequestedPluginModeIsAsFile() const; - - private: - NPStream stream_; - std::string headers_; - scoped_refptr<PluginInstance> instance_; - bool notify_needed_; - void* notify_data_; - bool close_on_write_data_; - uint16 requested_plugin_mode_; - bool opened_; -#if defined(OS_WIN) - char temp_file_name_[MAX_PATH]; - HANDLE temp_file_handle_; -#elif defined(OS_POSIX) - FILE* temp_file_; - base::FilePath temp_file_path_; -#endif - std::vector<char> delivery_data_; - int data_offset_; - bool seekable_stream_; - std::string mime_type_; - DISALLOW_COPY_AND_ASSIGN(PluginStream); -}; - -} // namespace content - -#endif // CONTENT_CHILD_NPAPI_PLUGIN_STREAM_H_ diff --git a/content/child/npapi/plugin_stream_posix.cc b/content/child/npapi/plugin_stream_posix.cc deleted file mode 100644 index ed9687c..0000000 --- a/content/child/npapi/plugin_stream_posix.cc +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2012 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 "content/child/npapi/plugin_stream.h" - -#include <string.h> - -#include "base/files/file_path.h" -#include "base/files/file_util.h" -#include "base/logging.h" -#include "content/child/npapi/plugin_instance.h" - -namespace content { - -void PluginStream::ResetTempFileHandle() { - temp_file_ = NULL; -} - -void PluginStream::ResetTempFileName() { - temp_file_path_ = base::FilePath(); -} - -void PluginStream::WriteAsFile() { - if (RequestedPluginModeIsAsFile()) - instance_->NPP_StreamAsFile(&stream_, temp_file_path_.value().c_str()); -} - -size_t PluginStream::WriteBytes(const char* buf, size_t length) { - return fwrite(buf, sizeof(char), length, temp_file_); -} - -bool PluginStream::OpenTempFile() { - DCHECK_EQ(static_cast<FILE*>(NULL), temp_file_); - - if (base::CreateTemporaryFile(&temp_file_path_)) - temp_file_ = base::OpenFile(temp_file_path_, "a"); - - if (!temp_file_) { - base::DeleteFile(temp_file_path_, false); - ResetTempFileName(); - return false; - } - return true; -} - -void PluginStream::CloseTempFile() { - if (!TempFileIsValid()) - return; - - base::CloseFile(temp_file_); - ResetTempFileHandle(); -} - -bool PluginStream::TempFileIsValid() const { - return temp_file_ != NULL; -} - -} // namespace content diff --git a/content/child/npapi/plugin_stream_url.cc b/content/child/npapi/plugin_stream_url.cc deleted file mode 100644 index 84490d7..0000000 --- a/content/child/npapi/plugin_stream_url.cc +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) 2012 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 "content/child/npapi/plugin_stream_url.h" - -#include <algorithm> - -#include "base/stl_util.h" -#include "base/strings/string_util.h" -#include "content/child/npapi/plugin_host.h" -#include "content/child/npapi/plugin_instance.h" -#include "content/child/npapi/plugin_lib.h" -#include "content/child/npapi/plugin_url_fetcher.h" -#include "content/child/npapi/webplugin.h" -#include "net/http/http_response_headers.h" - -namespace content { - -PluginStreamUrl::PluginStreamUrl( - unsigned long resource_id, - const GURL &url, - PluginInstance *instance, - bool notify_needed, - void *notify_data) - : PluginStream(instance, url.spec().c_str(), notify_needed, notify_data), - url_(url), - id_(resource_id) { -} - -void PluginStreamUrl::SetPluginURLFetcher(PluginURLFetcher* fetcher) { - plugin_url_fetcher_.reset(fetcher); -} - -void PluginStreamUrl::URLRedirectResponse(bool allow) { - if (plugin_url_fetcher_.get()) { - plugin_url_fetcher_->URLRedirectResponse(allow); - } else { - instance()->webplugin()->URLRedirectResponse(allow, id_); - } - - if (allow) - UpdateUrl(pending_redirect_url_.c_str()); -} - -void PluginStreamUrl::FetchRange(const std::string& range) { - PluginURLFetcher* range_fetcher = new PluginURLFetcher( - this, url_, plugin_url_fetcher_->first_party_for_cookies(), "GET", NULL, - 0, plugin_url_fetcher_->referrer(), range, false, false, - plugin_url_fetcher_->origin_pid(), - plugin_url_fetcher_->render_frame_id(), - plugin_url_fetcher_->render_view_id(), id_, - plugin_url_fetcher_->copy_stream_data()); - range_request_fetchers_.push_back(range_fetcher); -} - -bool PluginStreamUrl::Close(NPReason reason) { - // Protect the stream against it being destroyed or the whole plugin instance - // being destroyed within the destroy stream handler. - scoped_refptr<PluginStream> protect(this); - CancelRequest(); - bool result = PluginStream::Close(reason); - instance()->RemoveStream(this); - return result; -} - -WebPluginResourceClient* PluginStreamUrl::AsResourceClient() { - return static_cast<WebPluginResourceClient*>(this); -} - -void PluginStreamUrl::CancelRequest() { - if (id_ > 0) { - if (plugin_url_fetcher_.get()) { - plugin_url_fetcher_->Cancel(); - } else { - if (instance()->webplugin()) { - instance()->webplugin()->CancelResource(id_); - } - } - id_ = 0; - } - if (instance()->webplugin()) { - for (size_t i = 0; i < range_requests_.size(); ++i) - instance()->webplugin()->CancelResource(range_requests_[i]); - } - - range_requests_.clear(); - - STLDeleteElements(&range_request_fetchers_); -} - -void PluginStreamUrl::WillSendRequest(const GURL& url, int http_status_code) { - if (notify_needed()) { - // If the plugin participates in HTTP url redirect handling then notify it. - if (net::HttpResponseHeaders::IsRedirectResponseCode(http_status_code) && - instance()->handles_url_redirects()) { - pending_redirect_url_ = url.spec(); - instance()->NPP_URLRedirectNotify(url.spec().c_str(), http_status_code, - notify_data()); - return; - } - } - url_ = url; - UpdateUrl(url.spec().c_str()); -} - -void PluginStreamUrl::DidReceiveResponse(const std::string& mime_type, - const std::string& headers, - uint32 expected_length, - uint32 last_modified, - bool request_is_seekable) { - // Protect the stream against it being destroyed or the whole plugin instance - // being destroyed within the new stream handler. - scoped_refptr<PluginStream> protect(this); - - bool opened = Open(mime_type, - headers, - expected_length, - last_modified, - request_is_seekable); - if (!opened) { - CancelRequest(); - instance()->RemoveStream(this); - } else { - SetDeferLoading(false); - } -} - -void PluginStreamUrl::DidReceiveData(const char* buffer, int length, - int data_offset) { - if (!open()) - return; - - // Protect the stream against it being destroyed or the whole plugin instance - // being destroyed within the write handlers - scoped_refptr<PluginStream> protect(this); - - if (length > 0) { - // 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) { - SetDeferLoading(false); - } - } -} - -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(unsigned long resource_id) { - Close(NPRES_NETWORK_ERR); -} - -bool PluginStreamUrl::IsMultiByteResponseExpected() { - return seekable(); -} - -int PluginStreamUrl::ResourceId() { - return id_; -} - -PluginStreamUrl::~PluginStreamUrl() { - if (!plugin_url_fetcher_.get() && instance() && instance()->webplugin()) { - instance()->webplugin()->ResourceClientDeleted(AsResourceClient()); - } - - STLDeleteElements(&range_request_fetchers_); -} - -void PluginStreamUrl::AddRangeRequestResourceId(unsigned long resource_id) { - DCHECK_NE(resource_id, 0u); - range_requests_.push_back(resource_id); -} - -void PluginStreamUrl::SetDeferLoading(bool value) { - // If we determined that the request had failed via the HTTP headers in the - // response then we send out a failure notification to the plugin process, as - // certain plugins don't handle HTTP failure codes correctly. - if (plugin_url_fetcher_.get()) { - if (!value && plugin_url_fetcher_->pending_failure_notification()) { - // This object may be deleted now. - DidFail(id_); - } - return; - } - 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); -} - -void PluginStreamUrl::UpdateUrl(const char* url) { - DCHECK(!open()); - free(const_cast<char*>(stream()->url)); - stream()->url = base::strdup(url); - pending_redirect_url_.clear(); -} - -} // namespace content diff --git a/content/child/npapi/plugin_stream_url.h b/content/child/npapi/plugin_stream_url.h deleted file mode 100644 index dea2fe4..0000000 --- a/content/child/npapi/plugin_stream_url.h +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2012 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 CONTENT_CHILD_NPAPI_PLUGIN_STREAM_URL_H_ -#define CONTENT_CHILD_NPAPI_PLUGIN_STREAM_URL_H_ - -#include <vector> - -#include "base/memory/scoped_ptr.h" -#include "content/child/npapi/plugin_stream.h" -#include "content/child/npapi/webplugin_resource_client.h" -#include "url/gurl.h" - -namespace content { -class PluginInstance; -class PluginURLFetcher; - -// A NPAPI Stream based on a URL. -class PluginStreamUrl : public PluginStream, - public WebPluginResourceClient { - public: - // Create a new stream for sending to the plugin by fetching - // a URL. If notifyNeeded is set, then the plugin will be notified - // when the stream has been fully sent to the plugin. Initialize - // must be called before the object is used. - PluginStreamUrl(unsigned long resource_id, - const GURL &url, - PluginInstance *instance, - bool notify_needed, - void *notify_data); - - void SetPluginURLFetcher(PluginURLFetcher* fetcher); - - void URLRedirectResponse(bool allow); - - void FetchRange(const std::string& range); - - // Stop sending the stream to the client. - // Overrides the base Close so we can cancel our fetching the URL if - // it is still loading. - bool Close(NPReason reason) override; - WebPluginResourceClient* AsResourceClient() override; - void CancelRequest() override; - - // WebPluginResourceClient methods - void WillSendRequest(const GURL& url, int http_status_code) override; - void DidReceiveResponse(const std::string& mime_type, - const std::string& headers, - uint32 expected_length, - uint32 last_modified, - bool request_is_seekable) override; - void DidReceiveData(const char* buffer, int length, int data_offset) override; - void DidFinishLoading(unsigned long resource_id) override; - void DidFail(unsigned long resource_id) override; - bool IsMultiByteResponseExpected() override; - int ResourceId() override; - void AddRangeRequestResourceId(unsigned long resource_id) override; - - protected: - ~PluginStreamUrl() override; - - private: - void SetDeferLoading(bool value); - - // In case of a redirect, this can be called to update the url. But it must - // be called before Open(). - void UpdateUrl(const char* url); - - GURL url_; - unsigned long id_; - - // Ids of additional resources requested via range requests issued on - // seekable streams. - // This is used when we're loading resources through the renderer, i.e. not - // using plugin_url_fetcher_. - std::vector<unsigned long> range_requests_; - // This is used when we're using plugin_url_fetcher_. - std::vector<PluginURLFetcher*> range_request_fetchers_; - - // If the plugin participates in HTTP URL redirect handling then this member - // holds the url being redirected to while we wait for the plugin to make a - // decision on whether to allow or deny the redirect. - std::string pending_redirect_url_; - - scoped_ptr<PluginURLFetcher> plugin_url_fetcher_; - - DISALLOW_COPY_AND_ASSIGN(PluginStreamUrl); -}; - -} // namespace content - -#endif // CONTENT_CHILD_NPAPI_PLUGIN_STREAM_URL_H_ diff --git a/content/child/npapi/plugin_stream_win.cc b/content/child/npapi/plugin_stream_win.cc deleted file mode 100644 index af55f2f..0000000 --- a/content/child/npapi/plugin_stream_win.cc +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2012 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 "content/child/npapi/plugin_stream.h" - -#include "base/logging.h" -#include "content/child/npapi/plugin_instance.h" - -namespace content { - -void PluginStream::ResetTempFileHandle() { - temp_file_handle_ = INVALID_HANDLE_VALUE; -} - -void PluginStream::ResetTempFileName() { - temp_file_name_[0] = '\0'; -} - -void PluginStream::WriteAsFile() { - if (RequestedPluginModeIsAsFile()) - instance_->NPP_StreamAsFile(&stream_, temp_file_name_); -} - -size_t PluginStream::WriteBytes(const char *buf, size_t length) { - DWORD bytes; - - if (!WriteFile(temp_file_handle_, buf, length, &bytes, 0)) - return 0U; - - return static_cast<size_t>(bytes); -} - -bool PluginStream::OpenTempFile() { - DCHECK_EQ(INVALID_HANDLE_VALUE, temp_file_handle_); - - // The reason for using all the Ascii versions of these filesystem - // calls is that the filename which we pass back to the plugin - // via NPAPI is an ascii filename. Otherwise, we'd use wide-chars. - // - // TODO: - // This is a bug in NPAPI itself, and it needs to be fixed. - // The case which will fail is if a user has a multibyte name, - // but has the system locale set to english. GetTempPathA will - // return junk in this case, causing us to be unable to open the - // file. - - char temp_directory[MAX_PATH]; - if (GetTempPathA(MAX_PATH, temp_directory) == 0) - return false; - if (GetTempFileNameA(temp_directory, "npstream", 0, temp_file_name_) == 0) - return false; - temp_file_handle_ = CreateFileA(temp_file_name_, - FILE_ALL_ACCESS, - FILE_SHARE_READ, - 0, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - 0); - if (temp_file_handle_ == INVALID_HANDLE_VALUE) { - ResetTempFileName(); - return false; - } - return true; -} - -void PluginStream::CloseTempFile() { - if (!TempFileIsValid()) - return; - - CloseHandle(temp_file_handle_); - ResetTempFileHandle(); -} - -bool PluginStream::TempFileIsValid() const { - return temp_file_handle_ != INVALID_HANDLE_VALUE; -} - -} // namespace content diff --git a/content/child/npapi/plugin_string_stream.cc b/content/child/npapi/plugin_string_stream.cc deleted file mode 100644 index 15f38ad..0000000 --- a/content/child/npapi/plugin_string_stream.cc +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2010 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 "content/child/npapi/plugin_string_stream.h" - -#include "url/gurl.h" - -namespace content { - -PluginStringStream::PluginStringStream( - PluginInstance* instance, - const GURL& url, - bool notify_needed, - void* notify_data) - : PluginStream(instance, url.spec().c_str(), notify_needed, notify_data) { -} - -PluginStringStream::~PluginStringStream() { -} - -void PluginStringStream::SendToPlugin(const std::string &data, - const std::string &mime_type) { - // Protect the stream against it being destroyed or the whole plugin instance - // being destroyed within the plugin stream callbacks. - scoped_refptr<PluginStringStream> protect(this); - - int length = static_cast<int>(data.length()); - if (Open(mime_type, std::string(), length, 0, false)) { - // TODO - check if it was not fully sent, and figure out a backup plan. - int written = Write(data.c_str(), length, 0); - NPReason reason = written == length ? NPRES_DONE : NPRES_NETWORK_ERR; - Close(reason); - } -} - -} // namespace content diff --git a/content/child/npapi/plugin_string_stream.h b/content/child/npapi/plugin_string_stream.h deleted file mode 100644 index 73dac44..0000000 --- a/content/child/npapi/plugin_string_stream.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2006-2008 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 CONTENT_CHILD_NPAPI_PLUGIN_STRING_STREAM_H_ -#define CONTENT_CHILD_NPAPI_PLUGIN_STRING_STREAM_H_ - -#include "content/child/npapi/plugin_stream.h" - -class GURL; - -namespace content { - -class PluginInstance; - -// An NPAPI stream from a string. -class PluginStringStream : public PluginStream { - public: - // Create a new stream for sending to the plugin. - // If notify_needed, will notify the plugin after the data has - // all been sent. - PluginStringStream(PluginInstance* instance, - const GURL& url, - bool notify_needed, - void* notify_data); - - // Initiates the sending of data to the plugin. - void SendToPlugin(const std::string& data, - const std::string& mime_type); - - private: - ~PluginStringStream() override; - - DISALLOW_COPY_AND_ASSIGN(PluginStringStream); -}; - - -} // namespace content - -#endif // CONTENT_CHILD_NPAPI_PLUGIN_STRING_STREAM_H_ diff --git a/content/child/npapi/plugin_url_fetcher.cc b/content/child/npapi/plugin_url_fetcher.cc deleted file mode 100644 index a307f68..0000000 --- a/content/child/npapi/plugin_url_fetcher.cc +++ /dev/null @@ -1,406 +0,0 @@ -// Copyright (c) 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 "content/child/npapi/plugin_url_fetcher.h" - -#include "base/memory/scoped_ptr.h" -#include "content/child/child_thread_impl.h" -#include "content/child/multipart_response_delegate.h" -#include "content/child/npapi/plugin_host.h" -#include "content/child/npapi/plugin_instance.h" -#include "content/child/npapi/plugin_stream_url.h" -#include "content/child/npapi/webplugin.h" -#include "content/child/npapi/webplugin_resource_client.h" -#include "content/child/plugin_messages.h" -#include "content/child/request_extra_data.h" -#include "content/child/request_info.h" -#include "content/child/resource_dispatcher.h" -#include "content/child/web_url_loader_impl.h" -#include "content/common/resource_request_body.h" -#include "content/common/service_worker/service_worker_types.h" -#include "content/public/common/resource_response_info.h" -#include "net/base/load_flags.h" -#include "net/base/net_errors.h" -#include "net/http/http_response_headers.h" -#include "net/url_request/redirect_info.h" -#include "third_party/WebKit/public/platform/WebURLLoaderClient.h" -#include "third_party/WebKit/public/platform/WebURLResponse.h" - -namespace content { -namespace { - -// This class handles individual multipart responses. It is instantiated when -// we receive HTTP status code 206 in the HTTP response. This indicates -// that the response could have multiple parts each separated by a boundary -// specified in the response header. -// TODO(jam): this is similar to MultiPartResponseClient in webplugin_impl.cc, -// we should remove that other class once we switch to loading from the plugin -// process by default. -class MultiPartResponseClient : public blink::WebURLLoaderClient { - public: - explicit MultiPartResponseClient(PluginStreamUrl* plugin_stream) - : byte_range_lower_bound_(0), plugin_stream_(plugin_stream) {} - - // blink::WebURLLoaderClient implementation: - void didReceiveResponse(blink::WebURLLoader* loader, - const blink::WebURLResponse& response) override { - int64 byte_range_upper_bound, instance_size; - if (!MultipartResponseDelegate::ReadContentRanges(response, - &byte_range_lower_bound_, - &byte_range_upper_bound, - &instance_size)) { - NOTREACHED(); - } - } - void didReceiveData(blink::WebURLLoader* loader, - const char* data, - int data_length, - int encoded_data_length) override { - // TODO(ananta) - // We should defer further loads on multipart resources on the same lines - // as regular resources requested by plugins to prevent reentrancy. - int64 data_offset = byte_range_lower_bound_; - byte_range_lower_bound_ += data_length; - plugin_stream_->DidReceiveData(data, data_length, data_offset); - // DANGER: this instance may be deleted at this point. - } - - private: - // The lower bound of the byte range. - int64 byte_range_lower_bound_; - // The handler for the data. - PluginStreamUrl* plugin_stream_; -}; - -} // namespace - -PluginURLFetcher::PluginURLFetcher(PluginStreamUrl* plugin_stream, - const GURL& url, - const GURL& first_party_for_cookies, - const std::string& method, - const char* buf, - unsigned int len, - const Referrer& referrer, - const std::string& range, - bool notify_redirects, - bool is_plugin_src_load, - int origin_pid, - int render_frame_id, - int render_view_id, - unsigned long resource_id, - bool copy_stream_data) - : plugin_stream_(plugin_stream), - url_(url), - first_party_for_cookies_(first_party_for_cookies), - referrer_(referrer), - notify_redirects_(notify_redirects), - is_plugin_src_load_(is_plugin_src_load), - origin_pid_(origin_pid), - render_frame_id_(render_frame_id), - render_view_id_(render_view_id), - resource_id_(resource_id), - copy_stream_data_(copy_stream_data), - data_offset_(0), - pending_failure_notification_(false), - request_id_(-1), - weak_factory_(this) { - RequestInfo request_info; - request_info.method = method; - request_info.url = url; - request_info.first_party_for_cookies = first_party_for_cookies; - request_info.referrer = referrer; - request_info.load_flags = net::LOAD_NORMAL; - request_info.requestor_pid = origin_pid; - request_info.request_type = RESOURCE_TYPE_OBJECT; - request_info.routing_id = render_view_id; - // ServiceWorker is disabled for NPAPI. - request_info.skip_service_worker = true; - - RequestExtraData extra_data; - extra_data.set_render_frame_id(render_frame_id); - extra_data.set_is_main_frame(false); - request_info.extra_data = &extra_data; - - std::vector<char> body; - if (method == "POST") { - bool content_type_found = false; - std::vector<std::string> names; - std::vector<std::string> values; - PluginHost::SetPostData(buf, len, &names, &values, &body); - for (size_t i = 0; i < names.size(); ++i) { - if (!request_info.headers.empty()) - request_info.headers += "\r\n"; - request_info.headers += names[i] + ": " + values[i]; - if (base::LowerCaseEqualsASCII(names[i], "content-type")) - content_type_found = true; - } - - if (!content_type_found) { - if (!request_info.headers.empty()) - request_info.headers += "\r\n"; - request_info.headers += "Content-Type: application/x-www-form-urlencoded"; - } - } else { - if (!range.empty()) - request_info.headers = std::string("Range: ") + range; - } - - scoped_refptr<ResourceRequestBody> request_body = new ResourceRequestBody; - if (!body.empty()) - request_body->AppendBytes(&body[0], body.size()); - - request_id_ = ChildThreadImpl::current()->resource_dispatcher()->StartAsync( - request_info, request_body.get(), this); - - // TODO(jam): range requests -} - -PluginURLFetcher::~PluginURLFetcher() { - if (request_id_ >= 0) { - ChildThreadImpl::current()->resource_dispatcher()->RemovePendingRequest( - request_id_); - } -} - -void PluginURLFetcher::Cancel() { - ChildThreadImpl::current()->resource_dispatcher()->Cancel(request_id_); - - // Due to races and nested event loops, PluginURLFetcher may still receive - // events from the bridge before being destroyed. Do not forward additional - // events back to the plugin, via either |plugin_stream_| or - // |multipart_delegate_| which has its own pointer via - // MultiPartResponseClient. - if (multipart_delegate_) - multipart_delegate_->Cancel(); - plugin_stream_ = NULL; -} - -void PluginURLFetcher::URLRedirectResponse(bool allow) { - if (!plugin_stream_) - return; - - if (allow) { - ChildThreadImpl::current()->resource_dispatcher()->SetDefersLoading( - request_id_, false); - } else { - ChildThreadImpl::current()->resource_dispatcher()->Cancel(request_id_); - plugin_stream_->DidFail(resource_id_); // That will delete |this|. - } -} - -void PluginURLFetcher::OnUploadProgress(uint64 position, uint64 size) { -} - -bool PluginURLFetcher::OnReceivedRedirect( - const net::RedirectInfo& redirect_info, - const ResourceResponseInfo& info) { - if (!plugin_stream_) - return false; - - // TODO(jam): THIS LOGIC IS COPIED FROM WebPluginImpl::willSendRequest until - // kDirectNPAPIRequests is the default and we can remove the old path there. - - // Currently this check is just to catch an https -> http redirect when - // loading the main plugin src URL. Longer term, we could investigate - // firing mixed diplay or scripting issues for subresource loads - // initiated by plugins. - if (is_plugin_src_load_ && - !plugin_stream_->instance()->webplugin()->CheckIfRunInsecureContent( - redirect_info.new_url)) { - plugin_stream_->DidFail(resource_id_); // That will delete |this|. - return false; - } - - GURL old_url = url_; - url_ = redirect_info.new_url; - first_party_for_cookies_ = redirect_info.new_first_party_for_cookies; - - // If the plugin does not participate in url redirect notifications then just - // block cross origin 307 POST redirects. - if (!notify_redirects_) { - if (redirect_info.status_code == 307 && - redirect_info.new_method == "POST" && - old_url.GetOrigin() != url_.GetOrigin()) { - plugin_stream_->DidFail(resource_id_); // That will delete |this|. - return false; - } - } else { - // Pause the request while we ask the plugin what to do about the redirect. - ChildThreadImpl::current()->resource_dispatcher()->SetDefersLoading( - request_id_, true); - plugin_stream_->WillSendRequest(url_, redirect_info.status_code); - } - - return true; -} - -void PluginURLFetcher::OnReceivedResponse(const ResourceResponseInfo& info) { - if (!plugin_stream_) - return; - - // TODO(jam): THIS LOGIC IS COPIED FROM WebPluginImpl::didReceiveResponse - // GetAllHeaders, and GetResponseInfo until kDirectNPAPIRequests is the - // default and we can remove the old path there. - - bool request_is_seekable = true; - DCHECK(!multipart_delegate_.get()); - if (plugin_stream_->seekable()) { - int response_code = info.headers->response_code(); - if (response_code == 206) { - blink::WebURLResponse response; - response.initialize(); - WebURLLoaderImpl::PopulateURLResponse(url_, info, &response, - false /* report_security_info */); - - std::string multipart_boundary; - if (MultipartResponseDelegate::ReadMultipartBoundary( - response, &multipart_boundary)) { - plugin_stream_->instance()->webplugin()->DidStartLoading(); - - MultiPartResponseClient* multi_part_response_client = - new MultiPartResponseClient(plugin_stream_); - - multipart_delegate_.reset(new MultipartResponseDelegate( - multi_part_response_client, NULL, response, multipart_boundary)); - - // Multiple ranges requested, data will be delivered by - // MultipartResponseDelegate. - data_offset_ = 0; - return; - } - - int64 upper_bound = 0, instance_size = 0; - // Single range requested - go through original processing for - // non-multipart requests, but update data offset. - MultipartResponseDelegate::ReadContentRanges( - response, &data_offset_, &upper_bound, &instance_size); - } else if (response_code == 200) { - // TODO: should we handle this case? We used to but it's not clear that we - // still need to. This was bug 5403, fixed in r7139. - } - } - - // If the length comes in as -1, then it indicates that it was not - // read off the HTTP headers. We replicate Safari webkit behavior here, - // which is to set it to 0. - int expected_length = std::max(static_cast<int>(info.content_length), 0); - - base::Time temp; - uint32 last_modified = 0; - std::string headers; - if (info.headers.get()) { // NULL for data: urls. - if (info.headers->GetLastModifiedValue(&temp)) - last_modified = static_cast<uint32>(temp.ToDoubleT()); - - // TODO(darin): Shouldn't we also report HTTP version numbers? - int response_code = info.headers->response_code(); - headers = base::StringPrintf("HTTP %d ", response_code); - headers += info.headers->GetStatusText(); - headers += "\n"; - - void* iter = NULL; - std::string name, value; - while (info.headers->EnumerateHeaderLines(&iter, &name, &value)) { - // TODO(darin): Should we really exclude headers with an empty value? - if (!name.empty() && !value.empty()) - headers += name + ": " + value + "\n"; - } - - // 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 fate - // of the HTTP requests issued via NPN_GetURLNotify. Webkit and FF destroy - // the stream and invoke the NPP_DestroyStream function on the plugin if the - // HTTPrequest fails. - if ((url_.SchemeIs(url::kHttpScheme) || url_.SchemeIs(url::kHttpsScheme)) && - (response_code < 100 || response_code >= 400)) { - pending_failure_notification_ = true; - } - } - - plugin_stream_->DidReceiveResponse(info.mime_type, - headers, - expected_length, - last_modified, - request_is_seekable); -} - -void PluginURLFetcher::OnDownloadedData(int len, - int encoded_data_length) { -} - -void PluginURLFetcher::OnReceivedData(scoped_ptr<ReceivedData> data) { - const char* payload = data->payload(); - int data_length = data->length(); - int encoded_data_length = data->encoded_length(); - if (!plugin_stream_) - return; - - if (multipart_delegate_) { - multipart_delegate_->OnReceivedData(payload, data_length, - encoded_data_length); - } else { - int64 offset = data_offset_; - data_offset_ += data_length; - - if (copy_stream_data_) { - // QuickTime writes to this memory, and since we got it from - // ResourceDispatcher it's not mapped for write access in this process. - // http://crbug.com/308466. - scoped_ptr<char[]> data_copy(new char[data_length]); - memcpy(data_copy.get(), payload, data_length); - plugin_stream_->DidReceiveData(data_copy.get(), data_length, offset); - } else { - plugin_stream_->DidReceiveData(payload, data_length, offset); - } - // DANGER: this instance may be deleted at this point. - } -} - -void PluginURLFetcher::OnCompletedRequest( - int error_code, - bool was_ignored_by_handler, - bool stale_copy_in_cache, - const std::string& security_info, - const base::TimeTicks& completion_time, - int64 total_transfer_size) { - if (!plugin_stream_) - return; - - if (multipart_delegate_) { - multipart_delegate_->OnCompletedRequest(); - multipart_delegate_.reset(); - } - - if (error_code == net::OK) { - plugin_stream_->DidFinishLoading(resource_id_); - } else { - plugin_stream_->DidFail(resource_id_); - } -} - -void PluginURLFetcher::OnReceivedCompletedResponse( - const content::ResourceResponseInfo& info, - scoped_ptr<ReceivedData> data, - int error_code, - bool was_ignored_by_handler, - bool stale_copy_in_cache, - const std::string& security_info, - const base::TimeTicks& completion_time, - int64 total_transfer_size) { - // |this| can be deleted on each callback. |weak_this| is placed here to - // detect the deletion. - base::WeakPtr<PluginURLFetcher> weak_this = weak_factory_.GetWeakPtr(); - OnReceivedResponse(info); - - if (!weak_this) - return; - if (data) - OnReceivedData(data.Pass()); - - if (!weak_this) - return; - OnCompletedRequest(error_code, was_ignored_by_handler, stale_copy_in_cache, - security_info, completion_time, total_transfer_size); -} -} // namespace content diff --git a/content/child/npapi/plugin_url_fetcher.h b/content/child/npapi/plugin_url_fetcher.h deleted file mode 100644 index 8b0f09a..0000000 --- a/content/child/npapi/plugin_url_fetcher.h +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 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 CONTENT_CHILD_NPAPI_PLUGIN_URL_FETCHER_H_ -#define CONTENT_CHILD_NPAPI_PLUGIN_URL_FETCHER_H_ - -#include <string> - -#include "base/memory/scoped_ptr.h" -#include "base/memory/weak_ptr.h" -#include "content/public/child/request_peer.h" -#include "content/public/common/referrer.h" -#include "url/gurl.h" - -namespace content { -class MultipartResponseDelegate; -class PluginStreamUrl; - -// Fetches URLS for a plugin using ResourceDispatcher. -class PluginURLFetcher : public RequestPeer { - public: - PluginURLFetcher(PluginStreamUrl* plugin_stream, - const GURL& url, - const GURL& first_party_for_cookies, - const std::string& method, - const char* buf, - unsigned int len, - const Referrer& referrer, - const std::string& range, - bool notify_redirects, - bool is_plugin_src_load, - int origin_pid, - int render_frame_id, - int render_view_id, - unsigned long resource_id, - bool copy_stream_data); - ~PluginURLFetcher() override; - - // Cancels the current request. - void Cancel(); - - // Called with the plugin's reply to NPP_URLRedirectNotify. - void URLRedirectResponse(bool allow); - - GURL first_party_for_cookies() { return first_party_for_cookies_; } - Referrer referrer() { return referrer_; } - int origin_pid() { return origin_pid_; } - int render_frame_id() { return render_frame_id_; } - int render_view_id() { return render_view_id_; } - bool copy_stream_data() { return copy_stream_data_; } - bool pending_failure_notification() { return pending_failure_notification_; } - - private: - // RequestPeer implementation: - void OnUploadProgress(uint64 position, uint64 size) override; - bool OnReceivedRedirect(const net::RedirectInfo& redirect_info, - const ResourceResponseInfo& info) override; - void OnReceivedResponse(const ResourceResponseInfo& info) override; - void OnDownloadedData(int len, int encoded_data_length) override; - void OnReceivedData(scoped_ptr<ReceivedData> data) override; - void OnCompletedRequest(int error_code, - bool was_ignored_by_handler, - bool stale_copy_in_cache, - const std::string& security_info, - const base::TimeTicks& completion_time, - int64 total_transfer_size) override; - void OnReceivedCompletedResponse(const ResourceResponseInfo& info, - scoped_ptr<ReceivedData> data, - int error_code, - bool was_ignored_by_handler, - bool stale_copy_in_cache, - const std::string& security_info, - const base::TimeTicks& completion_time, - int64 total_transfer_size) override; - - // |plugin_stream_| becomes NULL after Cancel() to ensure no further calls - // |reach it. - PluginStreamUrl* plugin_stream_; - GURL url_; - GURL first_party_for_cookies_; - Referrer referrer_; - bool notify_redirects_; - bool is_plugin_src_load_; - int origin_pid_; - int render_frame_id_; - int render_view_id_; - unsigned long resource_id_; - bool copy_stream_data_; - int64 data_offset_; - bool pending_failure_notification_; - int request_id_; - - scoped_ptr<MultipartResponseDelegate> multipart_delegate_; - base::WeakPtrFactory<PluginURLFetcher> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(PluginURLFetcher); -}; - -} // namespace content - -#endif // CONTENT_CHILD_NPAPI_PLUGIN_URL_FETCHER_H_ diff --git a/content/child/npapi/webplugin.h b/content/child/npapi/webplugin.h index c1281f1..13466ea 100644 --- a/content/child/npapi/webplugin.h +++ b/content/child/npapi/webplugin.h @@ -70,26 +70,9 @@ class WebPlugin { virtual std::string GetCookies(const GURL& url, const GURL& first_party_for_cookies) = 0; - // Handles GetURL/GetURLNotify/PostURL/PostURLNotify requests initiated - // by plugins. If the plugin wants notification of the result, notify_id will - // be non-zero. - virtual void HandleURLRequest(const char* url, - const char* method, - const char* target, - const char* buf, - unsigned int len, - int notify_id, - bool popups_allowed, - bool notify_redirects) = 0; - // Cancels document load. virtual void CancelDocumentLoad() = 0; - // Initiates a HTTP range request for an existing stream. - virtual void InitiateHTTPRangeRequest(const char* url, - const char* range_info, - int range_request_id) = 0; - virtual void DidStartLoading() = 0; virtual void DidStopLoading() = 0; diff --git a/content/child/npapi/webplugin_delegate.h b/content/child/npapi/webplugin_delegate.h index 8f13c8d..c18eb76 100644 --- a/content/child/npapi/webplugin_delegate.h +++ b/content/child/npapi/webplugin_delegate.h @@ -87,65 +87,8 @@ class WebPluginDelegate { // Returns false if the value is not available. virtual bool GetFormValue(base::string16* value) = 0; - // Receives notification about a resource load that the plugin initiated - // for a frame. - virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason, - int notify_id) = 0; - // Returns the process id of the process that is running the plugin. virtual int GetProcessId() = 0; - - // The result, UTF-8 encoded, of the script execution is returned via this - // function. - virtual void SendJavaScriptStream(const GURL& url, - const std::string& result, - bool success, - int notify_id) = 0; - - // Receives notification about data being available. - virtual void DidReceiveManualResponse(const GURL& url, - const std::string& mime_type, - const std::string& headers, - uint32 expected_length, - uint32 last_modified) = 0; - - // Receives the data. - virtual void DidReceiveManualData(const char* buffer, int length) = 0; - - // Indicates end of data load. - virtual void DidFinishManualLoading() = 0; - - // Indicates a failure in data receipt. - virtual void DidManualLoadFail() = 0; - - // Creates a WebPluginResourceClient instance and returns the same. - virtual WebPluginResourceClient* CreateResourceClient( - unsigned long resource_id, - const GURL& url, - int notify_id) = 0; - - // Creates a WebPluginResourceClient instance for an existing stream that is - // has become seekable. - virtual WebPluginResourceClient* CreateSeekableResourceClient( - unsigned long resource_id, int range_request_id) = 0; - - // Tell the plugin that the given URL should be fetched. This is a result of - // loading the plugin data or the plugin calling HandleURLRequest which didn't - // end up being routed to another frame or being a javscript:// URL. - virtual void FetchURL(unsigned long resource_id, - int notify_id, - const GURL& url, - const GURL& first_party_for_cookies, - const std::string& method, - const char* buf, - unsigned int len, - const Referrer& referrer, - bool notify_redirects, - bool is_plugin_src_load, - int origin_pid, - int render_frame_id, - int render_view_id) = 0; - }; } // namespace content diff --git a/content/child/npapi/webplugin_delegate_impl.cc b/content/child/npapi/webplugin_delegate_impl.cc index 18149c3..8323bc8 100644 --- a/content/child/npapi/webplugin_delegate_impl.cc +++ b/content/child/npapi/webplugin_delegate_impl.cc @@ -14,8 +14,6 @@ #include "base/strings/utf_string_conversions.h" #include "content/child/npapi/plugin_instance.h" #include "content/child/npapi/plugin_lib.h" -#include "content/child/npapi/plugin_stream_url.h" -#include "content/child/npapi/plugin_url_fetcher.h" #include "third_party/WebKit/public/web/WebInputEvent.h" using blink::WebCursorInfo; @@ -102,12 +100,6 @@ bool WebPluginDelegateImpl::Initialize( void WebPluginDelegateImpl::DestroyInstance() { if (instance_.get() && (instance_->npp()->ndata != NULL)) { - // Shutdown all streams before destroying so that - // no streams are left "in progress". Need to do - // this before calling set_web_plugin(NULL) because the - // instance uses the helper to do the download. - instance_->CloseStreams(); - window_.window = NULL; if (creation_succeeded_ && !(quirks_ & PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY)) { @@ -193,56 +185,11 @@ bool WebPluginDelegateImpl::GetFormValue(base::string16* value) { return instance_->GetFormValue(value); } -void WebPluginDelegateImpl::DidFinishLoadWithReason(const GURL& url, - NPReason reason, - int notify_id) { - if (quirks_ & PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS && - reason == NPRES_NETWORK_ERR) { - // Flash needs this or otherwise it unloads the launching swf object. - reason = NPRES_DONE; - } - - instance()->DidFinishLoadWithReason(url, reason, notify_id); -} - int WebPluginDelegateImpl::GetProcessId() { // We are in process, so the plugin pid is this current process pid. return base::GetCurrentProcId(); } -void WebPluginDelegateImpl::SendJavaScriptStream(const GURL& url, - const std::string& result, - bool success, - int notify_id) { - instance()->SendJavaScriptStream(url, result, success, notify_id); -} - -void WebPluginDelegateImpl::DidReceiveManualResponse( - const GURL& url, const std::string& mime_type, - const std::string& headers, uint32 expected_length, uint32 last_modified) { - if (!windowless_) { - // Calling NPP_WriteReady before NPP_SetWindow causes movies to not load in - // Flash. See http://b/issue?id=892174. - DCHECK(windowed_did_set_window_); - } - - instance()->DidReceiveManualResponse(url, mime_type, headers, - expected_length, last_modified); -} - -void WebPluginDelegateImpl::DidReceiveManualData(const char* buffer, - int length) { - instance()->DidReceiveManualData(buffer, length); -} - -void WebPluginDelegateImpl::DidFinishManualLoading() { - instance()->DidFinishManualLoading(); -} - -void WebPluginDelegateImpl::DidManualLoadFail() { - instance()->DidManualLoadFail(); -} - base::FilePath WebPluginDelegateImpl::GetPluginPath() { return instance()->plugin_lib()->plugin_info().path; } @@ -289,44 +236,4 @@ bool WebPluginDelegateImpl::IsUserGesture(const WebInputEvent& event) { } } -WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient( - unsigned long resource_id, const GURL& url, int notify_id) { - return instance()->CreateStream( - resource_id, url, std::string(), notify_id); -} - -WebPluginResourceClient* WebPluginDelegateImpl::CreateSeekableResourceClient( - unsigned long resource_id, int range_request_id) { - WebPluginResourceClient* resource_client = instance()->GetRangeRequest( - range_request_id); - if (resource_client) - resource_client->AddRangeRequestResourceId(resource_id); - return resource_client; -} - -void WebPluginDelegateImpl::FetchURL(unsigned long resource_id, - int notify_id, - const GURL& url, - const GURL& first_party_for_cookies, - const std::string& method, - const char* buf, - unsigned int len, - const Referrer& referrer, - bool notify_redirects, - bool is_plugin_src_load, - int origin_pid, - int render_frame_id, - int render_view_id) { - // TODO(jam): once we switch over to resource loading always happening in this - // code path, remove WebPluginResourceClient abstraction. - PluginStreamUrl* plugin_stream = instance()->CreateStream( - resource_id, url, std::string(), notify_id); - - bool copy_stream_data = !!(quirks_ & PLUGIN_QUIRK_COPY_STREAM_DATA); - plugin_stream->SetPluginURLFetcher(new PluginURLFetcher( - plugin_stream, url, first_party_for_cookies, method, buf, len, - referrer, std::string(), notify_redirects, is_plugin_src_load, origin_pid, - render_frame_id, render_view_id, resource_id, copy_stream_data)); -} - } // namespace content diff --git a/content/child/npapi/webplugin_delegate_impl.h b/content/child/npapi/webplugin_delegate_impl.h index 72f559a9..9d75082 100644 --- a/content/child/npapi/webplugin_delegate_impl.h +++ b/content/child/npapi/webplugin_delegate_impl.h @@ -92,41 +92,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate { NPObject* GetPluginScriptableObject() override; NPP GetPluginNPP() override; bool GetFormValue(base::string16* value) override; - void DidFinishLoadWithReason(const GURL& url, - NPReason reason, - int notify_id) override; int GetProcessId() override; - void SendJavaScriptStream(const GURL& url, - const std::string& result, - bool success, - int notify_id) override; - void DidReceiveManualResponse(const GURL& url, - const std::string& mime_type, - const std::string& headers, - uint32 expected_length, - uint32 last_modified) override; - void DidReceiveManualData(const char* buffer, int length) override; - void DidFinishManualLoading() override; - void DidManualLoadFail() override; - WebPluginResourceClient* CreateResourceClient(unsigned long resource_id, - const GURL& url, - int notify_id) override; - WebPluginResourceClient* CreateSeekableResourceClient( - unsigned long resource_id, - int range_request_id) override; - void FetchURL(unsigned long resource_id, - int notify_id, - const GURL& url, - const GURL& first_party_for_cookies, - const std::string& method, - const char* buf, - unsigned int len, - const Referrer& referrer, - bool notify_redirects, - bool is_plugin_src_load, - int origin_pid, - int render_frame_id, - int render_view_id) override; // End of WebPluginDelegate implementation. gfx::PluginWindowHandle windowed_handle() const { return windowed_handle_; } diff --git a/content/child/npapi/webplugin_delegate_impl_win.cc b/content/child/npapi/webplugin_delegate_impl_win.cc index d64af01..8dd3687 100644 --- a/content/child/npapi/webplugin_delegate_impl_win.cc +++ b/content/child/npapi/webplugin_delegate_impl_win.cc @@ -23,7 +23,6 @@ #include "base/win/windows_version.h" #include "content/child/npapi/plugin_instance.h" #include "content/child/npapi/plugin_lib.h" -#include "content/child/npapi/plugin_stream_url.h" #include "content/child/npapi/webplugin.h" #include "content/child/npapi/webplugin_ime_win.h" #include "content/common/cursors/webcursor.h" diff --git a/content/child/npapi/webplugin_resource_client.h b/content/child/npapi/webplugin_resource_client.h index fc39264..9604f60 100644 --- a/content/child/npapi/webplugin_resource_client.h +++ b/content/child/npapi/webplugin_resource_client.h @@ -32,7 +32,6 @@ class WebPluginResourceClient { // 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 diff --git a/content/child/plugin_messages.h b/content/child/plugin_messages.h index 25d4545..f742338 100644 --- a/content/child/plugin_messages.h +++ b/content/child/plugin_messages.h @@ -34,16 +34,6 @@ IPC_STRUCT_BEGIN(PluginMsg_Init_Params) IPC_STRUCT_MEMBER(int, host_render_view_routing_id) IPC_STRUCT_END() -IPC_STRUCT_BEGIN(PluginHostMsg_URLRequest_Params) - IPC_STRUCT_MEMBER(std::string, url) - IPC_STRUCT_MEMBER(std::string, method) - IPC_STRUCT_MEMBER(std::string, target) - IPC_STRUCT_MEMBER(std::vector<char>, buffer) - IPC_STRUCT_MEMBER(int, notify_id) - IPC_STRUCT_MEMBER(bool, popups_allowed) - IPC_STRUCT_MEMBER(bool, notify_redirects) -IPC_STRUCT_END() - IPC_STRUCT_BEGIN(PluginMsg_DidReceiveResponseParams) IPC_STRUCT_MEMBER(unsigned long, id) IPC_STRUCT_MEMBER(std::string, mime_type) @@ -55,7 +45,6 @@ IPC_STRUCT_END() IPC_STRUCT_BEGIN(PluginMsg_FetchURL_Params) IPC_STRUCT_MEMBER(unsigned long, resource_id) - IPC_STRUCT_MEMBER(int, notify_id) IPC_STRUCT_MEMBER(GURL, url) IPC_STRUCT_MEMBER(GURL, first_party_for_cookies) IPC_STRUCT_MEMBER(std::string, method) @@ -116,11 +105,6 @@ IPC_SYNC_MESSAGE_ROUTED0_2(PluginMsg_GetFormValue, base::string16 /* value */, bool /* success */) -IPC_MESSAGE_ROUTED3(PluginMsg_DidFinishLoadWithReason, - GURL /* url */, - int /* reason */, - int /* notify_id */) - // Updates the plugin location. IPC_MESSAGE_ROUTED1(PluginMsg_UpdateGeometry, PluginMsg_UpdateGeometry_Param) @@ -159,44 +143,12 @@ IPC_MESSAGE_ROUTED1(PluginMsg_DidFinishLoading, IPC_MESSAGE_ROUTED1(PluginMsg_DidFail, unsigned long /* id */) -IPC_MESSAGE_ROUTED4(PluginMsg_SendJavaScriptStream, - GURL /* url */, - std::string /* result */, - bool /* success */, - int /* notify_id */) - -IPC_MESSAGE_ROUTED2(PluginMsg_DidReceiveManualResponse, - GURL /* url */, - PluginMsg_DidReceiveResponseParams) - -IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveManualData, - std::vector<char> /* buffer */) - -IPC_MESSAGE_ROUTED0(PluginMsg_DidFinishManualLoading) - -IPC_MESSAGE_ROUTED0(PluginMsg_DidManualLoadFail) - -IPC_MESSAGE_ROUTED3(PluginMsg_HandleURLRequestReply, - unsigned long /* resource_id */, - GURL /* url */, - int /* notify_id */) - -IPC_MESSAGE_ROUTED2(PluginMsg_HTTPRangeRequestReply, - unsigned long /* resource_id */, - int /* range_request_id */) - IPC_MESSAGE_CONTROL1(PluginMsg_SignalModalDialogEvent, int /* render_view_id */) IPC_MESSAGE_CONTROL1(PluginMsg_ResetModalDialogEvent, int /* render_view_id */) -IPC_MESSAGE_ROUTED1(PluginMsg_FetchURL, - PluginMsg_FetchURL_Params) - -IPC_MESSAGE_CONTROL1(PluginHostMsg_DidAbortLoading, - int /* render_view_id */) - #if defined(OS_WIN) IPC_MESSAGE_ROUTED4(PluginMsg_ImeCompositionUpdated, base::string16 /* text */, @@ -237,9 +189,6 @@ IPC_MESSAGE_ROUTED1(PluginMsg_ImeCompositionCompleted, IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindow, gfx::PluginWindowHandle /* window */) -IPC_MESSAGE_ROUTED1(PluginHostMsg_URLRequest, - PluginHostMsg_URLRequest_Params) - IPC_MESSAGE_ROUTED1(PluginHostMsg_CancelResource, int /* id */) @@ -271,11 +220,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_GetCookies, IPC_MESSAGE_ROUTED0(PluginHostMsg_CancelDocumentLoad) -IPC_MESSAGE_ROUTED3(PluginHostMsg_InitiateHTTPRangeRequest, - std::string /* url */, - std::string /* range_info */, - int /* range_request_id */) - IPC_MESSAGE_ROUTED0(PluginHostMsg_DidStartLoading) IPC_MESSAGE_ROUTED0(PluginHostMsg_DidStopLoading) diff --git a/content/content_child.gypi b/content/content_child.gypi index f74ecae..792e2fe 100644 --- a/content/content_child.gypi +++ b/content/content_child.gypi @@ -153,16 +153,6 @@ 'child/npapi/plugin_instance_mac.mm', 'child/npapi/plugin_lib.cc', 'child/npapi/plugin_lib.h', - 'child/npapi/plugin_stream.cc', - 'child/npapi/plugin_stream.h', - 'child/npapi/plugin_stream_posix.cc', - 'child/npapi/plugin_stream_url.cc', - 'child/npapi/plugin_stream_url.h', - 'child/npapi/plugin_stream_win.cc', - 'child/npapi/plugin_string_stream.cc', - 'child/npapi/plugin_string_stream.h', - 'child/npapi/plugin_url_fetcher.cc', - 'child/npapi/plugin_url_fetcher.h', 'child/npapi/plugin_web_event_converter_mac.h', 'child/npapi/plugin_web_event_converter_mac.mm', 'child/npapi/webplugin.h', diff --git a/content/content_shell.gypi b/content/content_shell.gypi index 9462cc4..5b81135 100644 --- a/content/content_shell.gypi +++ b/content/content_shell.gypi @@ -573,12 +573,8 @@ 'shell/tools/plugin/PluginTest.cpp', 'shell/tools/plugin/PluginTest.h', 'shell/tools/plugin/TestObject.cpp', - 'shell/tools/plugin/Tests/DocumentOpenInDestroyStream.cpp', 'shell/tools/plugin/Tests/EvaluateJSAfterRemovingPluginElement.cpp', 'shell/tools/plugin/Tests/FormValue.cpp', - 'shell/tools/plugin/Tests/GetURLNotifyWithURLThatFailsToLoad.cpp', - 'shell/tools/plugin/Tests/GetURLWithJavaScriptURL.cpp', - 'shell/tools/plugin/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp', 'shell/tools/plugin/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp', 'shell/tools/plugin/Tests/LeakWindowScriptableObject.cpp', 'shell/tools/plugin/Tests/LogNPPSetWindow.cpp', diff --git a/content/plugin/plugin_channel.cc b/content/plugin/plugin_channel.cc index 219f2f1..852d71a 100644 --- a/content/plugin/plugin_channel.cc +++ b/content/plugin/plugin_channel.cc @@ -253,7 +253,6 @@ bool PluginChannel::OnControlMessageReceived(const IPC::Message& msg) { OnDestroyInstance) IPC_MESSAGE_HANDLER(PluginMsg_GenerateRouteID, OnGenerateRouteID) IPC_MESSAGE_HANDLER(PluginProcessMsg_ClearSiteData, OnClearSiteData) - IPC_MESSAGE_HANDLER(PluginHostMsg_DidAbortLoading, OnDidAbortLoading) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() DCHECK(handled); @@ -327,13 +326,4 @@ void PluginChannel::OnClearSiteData(const std::string& site, Send(new PluginProcessHostMsg_ClearSiteDataResult(success)); } -void PluginChannel::OnDidAbortLoading(int render_view_id) { - for (size_t i = 0; i < plugin_stubs_.size(); ++i) { - if (plugin_stubs_[i]->webplugin()->host_render_view_routing_id() == - render_view_id) { - plugin_stubs_[i]->delegate()->instance()->CloseStreams(); - } - } -} - } // namespace content diff --git a/content/plugin/webplugin_delegate_stub.cc b/content/plugin/webplugin_delegate_stub.cc index b7fdf0b..ba53302 100644 --- a/content/plugin/webplugin_delegate_stub.cc +++ b/content/plugin/webplugin_delegate_stub.cc @@ -98,8 +98,6 @@ bool WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveData, OnDidReceiveData) IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoading, OnDidFinishLoading) IPC_MESSAGE_HANDLER(PluginMsg_DidFail, OnDidFail) - IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoadWithReason, - OnDidFinishLoadWithReason) IPC_MESSAGE_HANDLER(PluginMsg_SetFocus, OnSetFocus) IPC_MESSAGE_HANDLER(PluginMsg_HandleInputEvent, OnHandleInputEvent) IPC_MESSAGE_HANDLER(PluginMsg_Paint, OnPaint) @@ -109,8 +107,6 @@ bool WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(PluginMsg_GetFormValue, OnGetFormValue) IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometry, OnUpdateGeometry) IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometrySync, OnUpdateGeometry) - IPC_MESSAGE_HANDLER(PluginMsg_SendJavaScriptStream, - OnSendJavaScriptStream) IPC_MESSAGE_HANDLER(PluginMsg_SetContentAreaFocus, OnSetContentAreaFocus) #if defined(OS_WIN) && !defined(USE_AURA) IPC_MESSAGE_HANDLER(PluginMsg_ImeCompositionUpdated, @@ -126,17 +122,6 @@ bool WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(PluginMsg_ImeCompositionCompleted, OnImeCompositionCompleted) #endif - IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualResponse, - OnDidReceiveManualResponse) - IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualData, OnDidReceiveManualData) - IPC_MESSAGE_HANDLER(PluginMsg_DidFinishManualLoading, - OnDidFinishManualLoading) - IPC_MESSAGE_HANDLER(PluginMsg_DidManualLoadFail, OnDidManualLoadFail) - IPC_MESSAGE_HANDLER(PluginMsg_HandleURLRequestReply, - OnHandleURLRequestReply) - IPC_MESSAGE_HANDLER(PluginMsg_HTTPRangeRequestReply, - OnHTTPRangeRequestReply) - IPC_MESSAGE_HANDLER(PluginMsg_FetchURL, OnFetchURL) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -246,11 +231,6 @@ void WebPluginDelegateStub::OnDidFail(int id) { client->DidFail(id); } -void WebPluginDelegateStub::OnDidFinishLoadWithReason( - const GURL& url, int reason, int notify_id) { - delegate_->DidFinishLoadWithReason(url, reason, notify_id); -} - void WebPluginDelegateStub::OnSetFocus(bool focused) { delegate_->SetFocus(focused); #if defined(OS_WIN) && !defined(USE_AURA) @@ -312,13 +292,6 @@ void WebPluginDelegateStub::OnGetFormValue(base::string16* value, *success = delegate_->GetFormValue(value); } -void WebPluginDelegateStub::OnSendJavaScriptStream(const GURL& url, - const std::string& result, - bool success, - int notify_id) { - delegate_->SendJavaScriptStream(url, result, success, notify_id); -} - void WebPluginDelegateStub::OnSetContentAreaFocus(bool has_focus) { if (delegate_) delegate_->SetContentAreaHasFocus(has_focus); @@ -376,61 +349,4 @@ void WebPluginDelegateStub::OnImeCompositionCompleted( } #endif // OS_MACOSX -void WebPluginDelegateStub::OnDidReceiveManualResponse( - const GURL& url, - const PluginMsg_DidReceiveResponseParams& params) { - delegate_->DidReceiveManualResponse(url, params.mime_type, params.headers, - params.expected_length, - params.last_modified); -} - -void WebPluginDelegateStub::OnDidReceiveManualData( - const std::vector<char>& buffer) { - delegate_->DidReceiveManualData(&buffer.front(), - static_cast<int>(buffer.size())); -} - -void WebPluginDelegateStub::OnDidFinishManualLoading() { - delegate_->DidFinishManualLoading(); -} - -void WebPluginDelegateStub::OnDidManualLoadFail() { - delegate_->DidManualLoadFail(); -} - -void WebPluginDelegateStub::OnHandleURLRequestReply( - unsigned long resource_id, const GURL& url, int notify_id) { - WebPluginResourceClient* resource_client = - delegate_->CreateResourceClient(resource_id, url, notify_id); - webplugin_->OnResourceCreated(resource_id, resource_client); -} - -void WebPluginDelegateStub::OnHTTPRangeRequestReply( - unsigned long resource_id, int range_request_id) { - WebPluginResourceClient* resource_client = - delegate_->CreateSeekableResourceClient(resource_id, range_request_id); - webplugin_->OnResourceCreated(resource_id, resource_client); -} - -void WebPluginDelegateStub::OnFetchURL( - const PluginMsg_FetchURL_Params& params) { - const char* data = NULL; - if (params.post_data.size()) - data = ¶ms.post_data[0]; - - delegate_->FetchURL(params.resource_id, - params.notify_id, - params.url, - params.first_party_for_cookies, - params.method, - data, - static_cast<unsigned int>(params.post_data.size()), - Referrer(params.referrer, params.referrer_policy), - params.notify_redirect, - params.is_plugin_src_load, - channel_->renderer_id(), - params.render_frame_id, - webplugin_->host_render_view_routing_id()); -} - } // namespace content diff --git a/content/plugin/webplugin_delegate_stub.h b/content/plugin/webplugin_delegate_stub.h index 63964e1..e150661 100644 --- a/content/plugin/webplugin_delegate_stub.h +++ b/content/plugin/webplugin_delegate_stub.h @@ -67,7 +67,6 @@ class WebPluginDelegateStub : public IPC::Listener, int data_offset); void OnDidFinishLoading(int id); void OnDidFail(int id); - void OnDidFinishLoadWithReason(const GURL& url, int reason, int notify_id); void OnSetFocus(bool focused); void OnHandleInputEvent(const blink::WebInputEvent* event, bool* handled, WebCursor* cursor); @@ -75,10 +74,6 @@ class WebPluginDelegateStub : public IPC::Listener, void OnDidPaint(); void OnUpdateGeometry(const PluginMsg_UpdateGeometry_Param& param); void OnGetPluginScriptableObject(int* route_id); - void OnSendJavaScriptStream(const GURL& url, - const std::string& result, - bool success, - int notify_id); void OnGetFormValue(base::string16* value, bool* success); void OnSetContentAreaFocus(bool has_focus); @@ -99,18 +94,6 @@ class WebPluginDelegateStub : public IPC::Listener, void OnImeCompositionCompleted(const base::string16& text); #endif - void OnDidReceiveManualResponse( - const GURL& url, - const PluginMsg_DidReceiveResponseParams& params); - void OnDidReceiveManualData(const std::vector<char>& buffer); - void OnDidFinishManualLoading(); - void OnDidManualLoadFail(); - void OnHandleURLRequestReply(unsigned long resource_id, - const GURL& url, - int notify_id); - void OnHTTPRangeRequestReply(unsigned long resource_id, int range_request_id); - void OnFetchURL(const PluginMsg_FetchURL_Params& params); - std::string mime_type_; int instance_id_; diff --git a/content/plugin/webplugin_proxy.cc b/content/plugin/webplugin_proxy.cc index 5bd3d67..13447907 100644 --- a/content/plugin/webplugin_proxy.cc +++ b/content/plugin/webplugin_proxy.cc @@ -269,46 +269,6 @@ void WebPluginProxy::OnResourceCreated(int resource_id, resource_clients_[resource_id] = client; } -void WebPluginProxy::HandleURLRequest(const char* url, - const char* method, - const char* target, - const char* buf, - unsigned int len, - int notify_id, - bool popups_allowed, - bool notify_redirects) { - if (!target && base::EqualsCaseInsensitiveASCII(method, "GET")) { - // Please refer to https://bugzilla.mozilla.org/show_bug.cgi?id=366082 - // for more details on this. - if (delegate_->GetQuirks() & - WebPluginDelegateImpl::PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS) { - GURL request_url(url); - if (!request_url.SchemeIs(url::kHttpScheme) && - !request_url.SchemeIs(url::kHttpsScheme) && - !request_url.SchemeIs(url::kFtpScheme)) { - return; - } - } - } - - PluginHostMsg_URLRequest_Params params; - params.url = url; - params.method = method; - if (target) - params.target = std::string(target); - - if (len) { - params.buffer.resize(len); - memcpy(¶ms.buffer.front(), buf, len); - } - - params.notify_id = notify_id; - params.popups_allowed = popups_allowed; - params.notify_redirects = notify_redirects; - - Send(new PluginHostMsg_URLRequest(route_id_, params)); -} - void WebPluginProxy::Paint(const gfx::Rect& rect) { #if defined(OS_MACOSX) if (!windowless_context()) @@ -500,12 +460,6 @@ void WebPluginProxy::CancelDocumentLoad() { Send(new PluginHostMsg_CancelDocumentLoad(route_id_)); } -void WebPluginProxy::InitiateHTTPRangeRequest( - const char* url, const char* range_info, int range_request_id) { - Send(new PluginHostMsg_InitiateHTTPRangeRequest( - route_id_, url, range_info, range_request_id)); -} - void WebPluginProxy::DidStartLoading() { Send(new PluginHostMsg_DidStartLoading(route_id_)); } diff --git a/content/plugin/webplugin_proxy.h b/content/plugin/webplugin_proxy.h index 7e54434..cc000cd 100644 --- a/content/plugin/webplugin_proxy.h +++ b/content/plugin/webplugin_proxy.h @@ -66,23 +66,12 @@ class WebPluginProxy : public WebPlugin, const std::string& cookie) override; std::string GetCookies(const GURL& url, const GURL& first_party_for_cookies) override; - void HandleURLRequest(const char* url, - const char* method, - const char* target, - const char* buf, - unsigned int len, - int notify_id, - bool popups_allowed, - bool notify_redirects) override; void UpdateGeometry(const gfx::Rect& window_rect, const gfx::Rect& clip_rect, const TransportDIB::Handle& windowless_buffer0, const TransportDIB::Handle& windowless_buffer1, int windowless_buffer_index); void CancelDocumentLoad() override; - void InitiateHTTPRangeRequest(const char* url, - const char* range_info, - int range_request_id) override; void DidStartLoading() override; void DidStopLoading() override; void SetDeferResourceLoading(unsigned long resource_id, bool defer) override; diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc index 7dc2756..0af3aa4 100644 --- a/content/renderer/browser_plugin/browser_plugin.cc +++ b/content/renderer/browser_plugin/browser_plugin.cc @@ -561,16 +561,6 @@ void BrowserPlugin::didFinishLoading() { void BrowserPlugin::didFailLoading(const blink::WebURLError& error) { } -void BrowserPlugin::didFinishLoadingFrameRequest(const blink::WebURL& url, - void* notify_data) { -} - -void BrowserPlugin::didFailLoadingFrameRequest( - const blink::WebURL& url, - void* notify_data, - const blink::WebURLError& error) { -} - bool BrowserPlugin::executeEditCommand(const blink::WebString& name) { BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ExecuteEditCommand( browser_plugin_instance_id_, diff --git a/content/renderer/browser_plugin/browser_plugin.h b/content/renderer/browser_plugin/browser_plugin.h index 70a61ee..5069e87 100644 --- a/content/renderer/browser_plugin/browser_plugin.h +++ b/content/renderer/browser_plugin/browser_plugin.h @@ -109,11 +109,6 @@ class CONTENT_EXPORT BrowserPlugin : void didReceiveData(const char* data, int data_length) override; void didFinishLoading() override; void didFailLoading(const blink::WebURLError& error) override; - void didFinishLoadingFrameRequest(const blink::WebURL& url, - void* notify_data) override; - void didFailLoadingFrameRequest(const blink::WebURL& url, - void* notify_data, - const blink::WebURLError& error) override; bool executeEditCommand(const blink::WebString& name) override; bool executeEditCommand(const blink::WebString& name, const blink::WebString& value) override; diff --git a/content/renderer/npapi/webplugin_delegate_proxy.cc b/content/renderer/npapi/webplugin_delegate_proxy.cc index 054fa47..a77e844 100644 --- a/content/renderer/npapi/webplugin_delegate_proxy.cc +++ b/content/renderer/npapi/webplugin_delegate_proxy.cc @@ -96,26 +96,11 @@ ScopedLogLevel::~ScopedLogLevel() { class ResourceClientProxy : public WebPluginResourceClient { public: ResourceClientProxy(PluginChannelHost* channel, int instance_id) - : channel_(channel), instance_id_(instance_id), resource_id_(0), - multibyte_response_expected_(false) { + : channel_(channel), instance_id_(instance_id), resource_id_(0) { } ~ResourceClientProxy() override {} - void Initialize(unsigned long resource_id, const GURL& url, int notify_id) { - resource_id_ = resource_id; - channel_->Send(new PluginMsg_HandleURLRequestReply( - instance_id_, resource_id, url, notify_id)); - } - - void InitializeForSeekableStream(unsigned long resource_id, - int range_request_id) { - resource_id_ = resource_id; - multibyte_response_expected_ = true; - channel_->Send(new PluginMsg_HTTPRangeRequestReply( - instance_id_, resource_id, range_request_id)); - } - // PluginResourceClient implementation: void WillSendRequest(const GURL& url, int http_status_code) override { DCHECK(channel_.get() != NULL); @@ -173,19 +158,12 @@ class ResourceClientProxy : public WebPluginResourceClient { base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); } - bool IsMultiByteResponseExpected() override { - return multibyte_response_expected_; - } - int ResourceId() override { return resource_id_; } private: scoped_refptr<PluginChannelHost> channel_; int instance_id_; unsigned long resource_id_; - // Set to true if the response expected is a multibyte response. - // For e.g. response for a HTTP byte range request. - bool multibyte_response_expected_; }; } // namespace @@ -386,44 +364,6 @@ bool WebPluginDelegateProxy::Send(IPC::Message* msg) { return channel_host_->Send(msg); } -void WebPluginDelegateProxy::SendJavaScriptStream(const GURL& url, - const std::string& result, - bool success, - int notify_id) { - Send(new PluginMsg_SendJavaScriptStream( - instance_id_, url, result, success, notify_id)); -} - -void WebPluginDelegateProxy::DidReceiveManualResponse( - const GURL& url, const std::string& mime_type, - const std::string& headers, uint32 expected_length, - uint32 last_modified) { - PluginMsg_DidReceiveResponseParams params; - params.id = 0; - params.mime_type = mime_type; - params.headers = headers; - params.expected_length = expected_length; - params.last_modified = last_modified; - Send(new PluginMsg_DidReceiveManualResponse(instance_id_, url, params)); -} - -void WebPluginDelegateProxy::DidReceiveManualData(const char* buffer, - int length) { - DCHECK_GT(length, 0); - std::vector<char> data; - data.resize(static_cast<size_t>(length)); - memcpy(&data.front(), buffer, length); - Send(new PluginMsg_DidReceiveManualData(instance_id_, data)); -} - -void WebPluginDelegateProxy::DidFinishManualLoading() { - Send(new PluginMsg_DidFinishManualLoading(instance_id_)); -} - -void WebPluginDelegateProxy::DidManualLoadFail() { - Send(new PluginMsg_DidManualLoadFail(instance_id_)); -} - bool WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { GetContentClient()->SetActiveURL(page_url_); @@ -438,10 +378,7 @@ bool WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(PluginHostMsg_ResolveProxy, OnResolveProxy) IPC_MESSAGE_HANDLER(PluginHostMsg_SetCookie, OnSetCookie) IPC_MESSAGE_HANDLER(PluginHostMsg_GetCookies, OnGetCookies) - IPC_MESSAGE_HANDLER(PluginHostMsg_URLRequest, OnHandleURLRequest) IPC_MESSAGE_HANDLER(PluginHostMsg_CancelDocumentLoad, OnCancelDocumentLoad) - IPC_MESSAGE_HANDLER(PluginHostMsg_InitiateHTTPRangeRequest, - OnInitiateHTTPRangeRequest) IPC_MESSAGE_HANDLER(PluginHostMsg_DidStartLoading, OnDidStartLoading) IPC_MESSAGE_HANDLER(PluginHostMsg_DidStopLoading, OnDidStopLoading) IPC_MESSAGE_HANDLER(PluginHostMsg_DeferResourceLoading, @@ -742,12 +679,6 @@ bool WebPluginDelegateProxy::GetFormValue(base::string16* value) { return success; } -void WebPluginDelegateProxy::DidFinishLoadWithReason( - const GURL& url, NPReason reason, int notify_id) { - Send(new PluginMsg_DidFinishLoadWithReason( - instance_id_, url, reason, notify_id)); -} - void WebPluginDelegateProxy::SetFocus(bool focused) { Send(new PluginMsg_SetFocus(instance_id_, focused)); #if defined(OS_WIN) @@ -1066,75 +997,6 @@ void WebPluginDelegateProxy::UpdateFrontBuffer( transport_store_painted_.Union(rect); } -void WebPluginDelegateProxy::OnHandleURLRequest( - const PluginHostMsg_URLRequest_Params& params) { - const char* data = NULL; - if (params.buffer.size()) - data = ¶ms.buffer[0]; - - const char* target = NULL; - if (params.target.length()) - target = params.target.c_str(); - - plugin_->HandleURLRequest( - params.url.c_str(), params.method.c_str(), target, data, - static_cast<unsigned int>(params.buffer.size()), params.notify_id, - params.popups_allowed, params.notify_redirects); -} - -WebPluginResourceClient* WebPluginDelegateProxy::CreateResourceClient( - unsigned long resource_id, const GURL& url, int notify_id) { - if (!channel_host_.get()) - return NULL; - - ResourceClientProxy* proxy = - new ResourceClientProxy(channel_host_.get(), instance_id_); - proxy->Initialize(resource_id, url, notify_id); - return proxy; -} - -WebPluginResourceClient* WebPluginDelegateProxy::CreateSeekableResourceClient( - unsigned long resource_id, int range_request_id) { - if (!channel_host_.get()) - return NULL; - - ResourceClientProxy* proxy = - new ResourceClientProxy(channel_host_.get(), instance_id_); - proxy->InitializeForSeekableStream(resource_id, range_request_id); - return proxy; -} - -void WebPluginDelegateProxy::FetchURL(unsigned long resource_id, - int notify_id, - const GURL& url, - const GURL& first_party_for_cookies, - const std::string& method, - const char* buf, - unsigned int len, - const Referrer& referrer, - bool notify_redirects, - bool is_plugin_src_load, - int origin_pid, - int render_frame_id, - int render_view_id) { - PluginMsg_FetchURL_Params params; - params.resource_id = resource_id; - params.notify_id = notify_id; - params.url = url; - params.first_party_for_cookies = first_party_for_cookies; - params.method = method; - if (len) { - params.post_data.resize(len); - memcpy(¶ms.post_data.front(), buf, len); - } - params.referrer = referrer.url; - params.referrer_policy = referrer.policy; - params.notify_redirect = notify_redirects; - params.is_plugin_src_load = is_plugin_src_load; - params.render_frame_id = render_frame_id; - Send(new PluginMsg_FetchURL(instance_id_, params)); -} - #if defined(OS_MACOSX) void WebPluginDelegateProxy::OnFocusChanged(bool focused) { if (render_view_) @@ -1155,14 +1017,6 @@ void WebPluginDelegateProxy::OnCancelDocumentLoad() { plugin_->CancelDocumentLoad(); } -void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest( - const std::string& url, - const std::string& range_info, - int range_request_id) { - plugin_->InitiateHTTPRangeRequest( - url.c_str(), range_info.c_str(), range_request_id); -} - void WebPluginDelegateProxy::OnDidStartLoading() { plugin_->DidStartLoading(); } diff --git a/content/renderer/npapi/webplugin_delegate_proxy.h b/content/renderer/npapi/webplugin_delegate_proxy.h index 64eab9d..ad9a66b 100644 --- a/content/renderer/npapi/webplugin_delegate_proxy.h +++ b/content/renderer/npapi/webplugin_delegate_proxy.h @@ -67,9 +67,6 @@ class WebPluginDelegateProxy NPObject* GetPluginScriptableObject() override; struct _NPP* GetPluginNPP() override; bool GetFormValue(base::string16* value) override; - void DidFinishLoadWithReason(const GURL& url, - NPReason reason, - int notify_id) override; void SetFocus(bool focused) override; bool HandleInputEvent(const blink::WebInputEvent& event, WebCursor::CursorInfo* cursor) override; @@ -111,39 +108,6 @@ class WebPluginDelegateProxy // IPC::Sender implementation: bool Send(IPC::Message* msg) override; - void SendJavaScriptStream(const GURL& url, - const std::string& result, - bool success, - int notify_id) override; - - void DidReceiveManualResponse(const GURL& url, - const std::string& mime_type, - const std::string& headers, - uint32 expected_length, - uint32 last_modified) override; - void DidReceiveManualData(const char* buffer, int length) override; - void DidFinishManualLoading() override; - void DidManualLoadFail() override; - WebPluginResourceClient* CreateResourceClient(unsigned long resource_id, - const GURL& url, - int notify_id) override; - WebPluginResourceClient* CreateSeekableResourceClient( - unsigned long resource_id, - int range_request_id) override; - void FetchURL(unsigned long resource_id, - int notify_id, - const GURL& url, - const GURL& first_party_for_cookies, - const std::string& method, - const char* buf, - unsigned int len, - const Referrer& referrer, - bool notify_redirects, - bool is_plugin_src_load, - int origin_pid, - int render_frame_id, - int render_view_id) override; - gfx::PluginWindowHandle GetPluginWindowHandle(); protected: diff --git a/content/renderer/npapi/webplugin_impl.cc b/content/renderer/npapi/webplugin_impl.cc index 91ffa93..1c9c798 100644 --- a/content/renderer/npapi/webplugin_impl.cc +++ b/content/renderer/npapi/webplugin_impl.cc @@ -362,23 +362,6 @@ void WebPluginImpl::updateGeometry(const WebRect& window_rect, delegate_->UpdateGeometry(new_geometry.window_rect, new_geometry.clip_rect); } - // Initiate a download on the plugin url. This should be done for the - // first update geometry sequence. We need to ensure that the plugin - // receives the geometry update before it starts receiving data. - if (first_geometry_update_) { - // An empty url corresponds to an EMBED tag with no src attribute. - if (!load_manually_ && plugin_url_.is_valid()) { - // The Flash plugin hangs for a while if it receives data before - // receiving valid plugin geometry. By valid geometry we mean the - // geometry received by a call to setFrameRect in the Webkit - // layout code path. To workaround this issue we download the - // plugin source url on a timer. - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(&WebPluginImpl::OnDownloadPluginSrcUrl, - weak_factory_.GetWeakPtr())); - } - } - #if defined(OS_WIN) // Don't cache the geometry during the first geometry update. The first // geometry update sequence is received when Widget::setParent is called. @@ -439,58 +422,6 @@ WebInputEventResult WebPluginImpl::handleInputEvent( : WebInputEventResult::NotHandled; } -void WebPluginImpl::didReceiveResponse(const WebURLResponse& response) { - ignore_response_error_ = false; - - ResponseInfo response_info; - GetResponseInfo(response, &response_info); - - delegate_->DidReceiveManualResponse( - response_info.url, - response_info.mime_type, - GetAllHeaders(response), - response_info.expected_length, - response_info.last_modified); -} - -void WebPluginImpl::didReceiveData(const char* data, int data_length) { - delegate_->DidReceiveManualData(data, data_length); -} - -void WebPluginImpl::didFinishLoading() { - delegate_->DidFinishManualLoading(); -} - -void WebPluginImpl::didFailLoading(const WebURLError& error) { - if (!ignore_response_error_) - delegate_->DidManualLoadFail(); -} - -void WebPluginImpl::didFinishLoadingFrameRequest( - const WebURL& url, void* notify_data) { - if (delegate_) { - // We're converting a void* into an arbitrary int id. Though - // these types are the same size on all the platforms we support, - // the compiler may complain as though they are different, so to - // make the casting gods happy go through an intptr_t (the union - // of void* and int) rather than converting straight across. - delegate_->DidFinishLoadWithReason( - url, NPRES_DONE, reinterpret_cast<intptr_t>(notify_data)); - } -} - -void WebPluginImpl::didFailLoadingFrameRequest( - const WebURL& url, void* notify_data, const WebURLError& error) { - if (!delegate_) - return; - - NPReason reason = - error.reason == net::ERR_ABORTED ? NPRES_USER_BREAK : NPRES_NETWORK_ERR; - // See comment in didFinishLoadingFrameRequest about the cast here. - delegate_->DidFinishLoadWithReason( - url, reason, reinterpret_cast<intptr_t>(notify_data)); -} - bool WebPluginImpl::isPlaceholder() { return false; } @@ -564,8 +495,7 @@ WebPluginImpl::WebPluginImpl( file_path_(file_path), mime_type_(base::ToLowerASCII(base::UTF16ToASCII( base::StringPiece16(params.mimeType)))), - loader_client_(this), - weak_factory_(this) { + loader_client_(this) { DCHECK_EQ(params.attributeNames.size(), params.attributeValues.size()); for (size_t i = 0; i < params.attributeNames.size(); ++i) { @@ -700,7 +630,6 @@ WebPluginImpl::RoutingStatus WebPluginImpl::RouteToFrame( const char* target, const char* buf, unsigned int len, - int notify_id, ReferrerValue referrer_flag) { // If there is no target, there is nothing to do if (!target) @@ -764,8 +693,7 @@ WebPluginImpl::RoutingStatus WebPluginImpl::RouteToFrame( } } - container_->loadFrameRequest( - request, target_str, notify_id != 0, reinterpret_cast<void*>(notify_id)); + container_->loadFrameRequest(request, target_str); return ROUTED; } @@ -903,12 +831,6 @@ void WebPluginImpl::InvalidateRect(const gfx::Rect& rect) { container_->invalidateRect(rect); } -void WebPluginImpl::OnDownloadPluginSrcUrl() { - HandleURLRequestInternal( - plugin_url_.spec().c_str(), "GET", NULL, NULL, 0, 0, false, DOCUMENT_URL, - false, true); -} - WebPluginResourceClient* WebPluginImpl::GetClientFromLoader( WebURLLoader* loader) { ClientInfo* client_info = GetClientInfoFromLoader(loader); @@ -981,8 +903,6 @@ void WebPluginImpl::didReceiveResponse(WebURLLoader* loader, const WebURLResponse& response) { // TODO(jam): THIS LOGIC IS COPIED IN PluginURLFetcher::OnReceivedResponse // until kDirectNPAPIRequests is the default and we can remove this old path. - static const int kHttpPartialResponseStatusCode = 206; - static const int kHttpResponseSuccessStatusCode = 200; WebPluginResourceClient* client = GetClientFromLoader(loader); if (!client) @@ -994,64 +914,6 @@ void WebPluginImpl::didReceiveResponse(WebURLLoader* loader, if (!client_info) return; - bool request_is_seekable = true; - if (client->IsMultiByteResponseExpected()) { - if (response.httpStatusCode() == kHttpPartialResponseStatusCode) { - ClientInfo* client_info = GetClientInfoFromLoader(loader); - if (!client_info) - return; - if (HandleHttpMultipartResponse(response, client)) { - // Multiple ranges requested, data will be delivered by - // MultipartResponseDelegate. - client_info->data_offset = 0; - return; - } - int64 upper_bound = 0, instance_size = 0; - // Single range requested - go through original processing for - // non-multipart requests, but update data offset. - MultipartResponseDelegate::ReadContentRanges(response, - &client_info->data_offset, - &upper_bound, - &instance_size); - } else if (response.httpStatusCode() == kHttpResponseSuccessStatusCode) { - RenderThreadImpl::current()->RecordAction( - base::UserMetricsAction("Plugin_200ForByteRange")); - // If the client issued a byte range request and the server responds with - // HTTP 200 OK, it indicates that the server does not support byte range - // requests. - // We need to emulate Firefox behavior by doing the following:- - // 1. Destroy the plugin instance in the plugin process. Ensure that - // existing resource requests initiated for the plugin instance - // continue to remain valid. - // 2. Create a new plugin instance and notify it about the response - // received here. - if (!ReinitializePluginForResponse(loader)) { - NOTREACHED(); - return; - } - - // The server does not support byte range requests. No point in creating - // seekable streams. - request_is_seekable = false; - - delete client; - client = NULL; - - // Create a new resource client for this request. - for (size_t i = 0; i < clients_.size(); ++i) { - if (clients_[i].loader.get() == loader) { - WebPluginResourceClient* resource_client = - delegate_->CreateResourceClient(clients_[i].id, plugin_url_, 0); - clients_[i].client = resource_client; - client = resource_client; - break; - } - } - - DCHECK(client != NULL); - } - } - // Calling into a plugin could result in reentrancy if the plugin yields // control to the OS like entering a modal loop etc. Prevent this by // stopping further loading until the plugin notifies us that it is ready to @@ -1063,7 +925,7 @@ void WebPluginImpl::didReceiveResponse(WebURLLoader* loader, GetAllHeaders(response), response_info.expected_length, response_info.last_modified, - request_is_seekable); + true); // 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 @@ -1161,121 +1023,6 @@ void WebPluginImpl::SetContainer(WebPluginContainer* container) { container_->allowScriptObjects(); } -void WebPluginImpl::HandleURLRequest(const char* url, - const char* method, - const char* target, - const char* buf, - unsigned int len, - int notify_id, - bool popups_allowed, - bool notify_redirects) { - // GetURL/PostURL requests initiated explicitly by plugins should specify the - // plugin SRC url as the referrer if it is available. - HandleURLRequestInternal( - url, method, target, buf, len, notify_id, popups_allowed, PLUGIN_SRC, - notify_redirects, false); -} - -void WebPluginImpl::HandleURLRequestInternal(const char* url, - const char* method, - const char* target, - const char* buf, - unsigned int len, - int notify_id, - bool popups_allowed, - ReferrerValue referrer_flag, - bool notify_redirects, - bool is_plugin_src_load) { - // For this request, we either route the output to a frame - // because a target has been specified, or we handle the request - // here, i.e. by executing the script if it is a javascript url - // or by initiating a download on the URL, etc. There is one special - // case in that the request is a javascript url and the target is "_self", - // in which case we route the output to the plugin rather than routing it - // to the plugin's frame. - bool is_javascript_url = - url::FindAndCompareScheme(url, strlen(url), url::kJavaScriptScheme, NULL); - RoutingStatus routing_status = RouteToFrame( - url, is_javascript_url, popups_allowed, method, target, buf, len, - notify_id, referrer_flag); - if (routing_status == ROUTED) - return; - - if (is_javascript_url) { - GURL gurl(url); - WebString result = container_->executeScriptURL(gurl, popups_allowed); - - // delegate_ could be NULL because executeScript caused the container to - // be deleted. - if (delegate_) { - delegate_->SendJavaScriptStream( - gurl, result.utf8(), !result.isNull(), notify_id); - } - - return; - } - - unsigned long resource_id = GetNextResourceId(); - if (!resource_id) - return; - - GURL complete_url = CompleteURL(url); - // Remove when flash bug is fixed. http://crbug.com/40016. - if (!WebPluginImpl::IsValidUrl(complete_url, referrer_flag)) - return; - - // If the RouteToFrame call returned a failure then inform the result - // back to the plugin asynchronously. - if ((routing_status == INVALID_URL) || - (routing_status == GENERAL_FAILURE)) { - WebPluginResourceClient* resource_client = delegate_->CreateResourceClient( - resource_id, complete_url, notify_id); - if (resource_client) - resource_client->DidFail(resource_id); - return; - } - - // CreateResourceClient() sends a synchronous IPC message so it's possible - // that TearDownPluginInstance() may have been called in the nested - // message loop. If so, don't start the request. - if (!delegate_) - return; - - if (!base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisableDirectNPAPIRequests)) { - // We got here either because the plugin called GetURL/PostURL, or because - // we're fetching the data for an embed tag. If we're in multi-process mode, - // we want to fetch the data in the plugin process as the renderer won't be - // able to request any origin when site isolation is in place. So bounce - // this request back to the plugin process which will use ResourceDispatcher - // to fetch the url. - - // TODO(jam): any better way of getting this? Can't find a way to get - // frame()->loader()->outgoingReferrer() which - // WebFrameImpl::setReferrerForRequest does. - WebURLRequest request(complete_url); - SetReferrer(&request, referrer_flag); - Referrer referrer( - GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), - request.referrerPolicy()); - - GURL first_party_for_cookies = webframe_->document().firstPartyForCookies(); - delegate_->FetchURL(resource_id, notify_id, complete_url, - first_party_for_cookies, method, buf, len, referrer, - notify_redirects, is_plugin_src_load, 0, - render_frame_->GetRoutingID(), - render_view_->GetRoutingID()); - } else { - WebPluginResourceClient* resource_client = delegate_->CreateResourceClient( - resource_id, complete_url, notify_id); - if (!resource_client) - return; - InitiateHTTPRequest(resource_id, resource_client, complete_url, method, buf, - len, NULL, referrer_flag, notify_redirects, - is_plugin_src_load); - } -} - unsigned long WebPluginImpl::GetNextResourceId() { if (!webframe_) return 0; @@ -1285,67 +1032,6 @@ unsigned long WebPluginImpl::GetNextResourceId() { return view->createUniqueIdentifierForRequest(); } -bool WebPluginImpl::InitiateHTTPRequest(unsigned long resource_id, - WebPluginResourceClient* client, - const GURL& url, - const char* method, - const char* buf, - int buf_len, - const char* range_info, - ReferrerValue referrer_flag, - bool notify_redirects, - bool is_plugin_src_load) { - if (!client) { - NOTREACHED(); - return false; - } - - ClientInfo info; - info.id = resource_id; - info.client = client; - info.request.initialize(); - info.request.setURL(url); - info.request.setFirstPartyForCookies( - webframe_->document().firstPartyForCookies()); - info.request.setRequestorProcessID(delegate_->GetProcessId()); - // TODO(mkwst): Is this a request for a plugin object itself - // (RequestContextObject), or a request that the plugin makes - // (RequestContextPlugin)? - info.request.setRequestContext(WebURLRequest::RequestContextPlugin); - info.request.setHTTPMethod(WebString::fromUTF8(method)); - // ServiceWorker is disabled for NPAPI. - info.request.setSkipServiceWorker(true); - info.pending_failure_notification = false; - info.notify_redirects = notify_redirects; - info.is_plugin_src_load = is_plugin_src_load; - info.data_offset = 0; - - if (range_info) { - info.request.addHTTPHeaderField(WebString::fromUTF8("Range"), - WebString::fromUTF8(range_info)); - } - - if (strcmp(method, "POST") == 0) { - // Adds headers or form data to a request. This must be called before - // we initiate the actual request. - SetPostData(&info.request, buf, buf_len); - } - - SetReferrer(&info.request, referrer_flag); - - WebURLLoaderOptions options; - options.allowCredentials = true; - options.crossOriginRequestPolicy = - WebURLLoaderOptions::CrossOriginRequestPolicyAllow; - info.loader.reset(webframe_->createAssociatedURLLoader(options)); - if (!info.loader.get()) - return false; - info.loader->loadAsynchronously(info.request, &loader_client_); - - clients_.push_back(info); - return true; -} - void WebPluginImpl::CancelDocumentLoad() { if (webframe_) { ignore_response_error_ = true; @@ -1353,25 +1039,6 @@ void WebPluginImpl::CancelDocumentLoad() { } } -void WebPluginImpl::InitiateHTTPRangeRequest( - const char* url, const char* range_info, int range_request_id) { - unsigned long resource_id = GetNextResourceId(); - if (!resource_id) - return; - - GURL complete_url = CompleteURL(url); - // Remove when flash bug is fixed. http://crbug.com/40016. - if (!WebPluginImpl::IsValidUrl(complete_url, - load_manually_ ? NO_REFERRER : PLUGIN_SRC)) - return; - - WebPluginResourceClient* resource_client = - delegate_->CreateSeekableResourceClient(resource_id, range_request_id); - InitiateHTTPRequest( - resource_id, resource_client, complete_url, "GET", NULL, 0, range_info, - load_manually_ ? NO_REFERRER : PLUGIN_SRC, false, false); -} - void WebPluginImpl::DidStartLoading() { if (render_view_.get()) { // TODO(darin): Make is_loading_ be a counter! @@ -1539,7 +1206,6 @@ void WebPluginImpl::TearDownPluginInstance( // This needs to be called now and not in the destructor since the // webframe_ might not be valid anymore. webframe_ = NULL; - weak_factory_.InvalidateWeakPtrs(); } void WebPluginImpl::SetReferrer(blink::WebURLRequest* request, diff --git a/content/renderer/npapi/webplugin_impl.h b/content/renderer/npapi/webplugin_impl.h index 3eb157e..39e3226 100644 --- a/content/renderer/npapi/webplugin_impl.h +++ b/content/renderer/npapi/webplugin_impl.h @@ -86,15 +86,10 @@ class WebPluginImpl : public WebPlugin, blink::WebInputEventResult handleInputEvent( const blink::WebInputEvent& event, blink::WebCursorInfo& cursor_info) override; - void didReceiveResponse(const blink::WebURLResponse& response) override; - void didReceiveData(const char* data, int data_length) override; - void didFinishLoading() override; - void didFailLoading(const blink::WebURLError& error) override; - void didFinishLoadingFrameRequest(const blink::WebURL& url, - void* notify_data) override; - void didFailLoadingFrameRequest(const blink::WebURL& url, - void* notify_data, - const blink::WebURLError& error) override; + void didReceiveResponse(const blink::WebURLResponse& response) override {} + void didReceiveData(const char* data, int data_length) override {} + void didFinishLoading() override {} + void didFailLoading(const blink::WebURLError& error) override {} bool isPlaceholder() override; // WebPlugin implementation: @@ -112,18 +107,7 @@ class WebPluginImpl : public WebPlugin, const std::string& cookie) override; std::string GetCookies(const GURL& url, const GURL& first_party_for_cookies) override; - void HandleURLRequest(const char* url, - const char* method, - const char* target, - const char* buf, - unsigned int len, - int notify_id, - bool popups_allowed, - bool notify_redirects) override; void CancelDocumentLoad() override; - void InitiateHTTPRangeRequest(const char* url, - const char* range_info, - int pending_request_id) override; void DidStartLoading() override; void DidStopLoading() override; bool IsOffTheRecord() override; @@ -175,26 +159,12 @@ class WebPluginImpl : public WebPlugin, const char* target, const char* buf, unsigned int len, - int notify_id, ReferrerValue referrer_flag); // Returns the next avaiable resource id. Returns 0 if the operation fails. // It may fail if the page has already been closed. unsigned long GetNextResourceId(); - // Initiates HTTP GET/POST requests. - // Returns true on success. - bool InitiateHTTPRequest(unsigned long resource_id, - WebPluginResourceClient* client, - const GURL& url, - const char* method, - const char* buf, - int len, - const char* range_info, - ReferrerValue referrer_flag, - bool notify_redirects, - bool check_mixed_scripting); - gfx::Rect GetWindowClipRect(const gfx::Rect& rect); // Sets the actual Widget for the plugin. @@ -239,24 +209,10 @@ class WebPluginImpl : public WebPlugin, bool HandleHttpMultipartResponse(const blink::WebURLResponse& response, WebPluginResourceClient* client); - void HandleURLRequestInternal(const char* url, - const char* method, - const char* target, - const char* buf, - unsigned int len, - int notify_id, - bool popups_allowed, - ReferrerValue referrer_flag, - bool notify_redirects, - bool check_mixed_scripting); - // Tears down the existing plugin instance and creates a new plugin instance // to handle the response identified by the loader parameter. bool ReinitializePluginForResponse(blink::WebURLLoader* loader); - // Delayed task for downloading the plugin source URL. - void OnDownloadPluginSrcUrl(); - struct ClientInfo; // Helper functions @@ -359,8 +315,6 @@ class WebPluginImpl : public WebPlugin, LoaderClient loader_client_; - base::WeakPtrFactory<WebPluginImpl> weak_factory_; - DISALLOW_COPY_AND_ASSIGN(WebPluginImpl); }; diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc index 811c107..d23f9f9 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.cc +++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc @@ -3116,7 +3116,7 @@ int32_t PepperPluginInstanceImpl::Navigate( WebString target_str = WebString::fromUTF8(target); blink::WebScopedUserGesture user_gesture(CurrentUserGestureToken()); - container_->loadFrameRequest(web_request, target_str, false, NULL); + container_->loadFrameRequest(web_request, target_str); return PP_OK; } diff --git a/content/renderer/pepper/pepper_webplugin_impl.cc b/content/renderer/pepper/pepper_webplugin_impl.cc index e4bf44d..0f53f2a 100644 --- a/content/renderer/pepper/pepper_webplugin_impl.cc +++ b/content/renderer/pepper/pepper_webplugin_impl.cc @@ -254,14 +254,6 @@ void PepperWebPluginImpl::didFailLoading(const blink::WebURLError& error) { document_loader->didFail(NULL, error); } -void PepperWebPluginImpl::didFinishLoadingFrameRequest(const blink::WebURL& url, - void* notify_data) {} - -void PepperWebPluginImpl::didFailLoadingFrameRequest( - const blink::WebURL& url, - void* notify_data, - const blink::WebURLError& error) {} - bool PepperWebPluginImpl::hasSelection() const { return !selectionAsText().isEmpty(); } diff --git a/content/renderer/pepper/pepper_webplugin_impl.h b/content/renderer/pepper/pepper_webplugin_impl.h index 6046406..5bfa988 100644 --- a/content/renderer/pepper/pepper_webplugin_impl.h +++ b/content/renderer/pepper/pepper_webplugin_impl.h @@ -62,11 +62,6 @@ class PepperWebPluginImpl : public blink::WebPlugin { void didReceiveData(const char* data, int data_length) override; void didFinishLoading() override; void didFailLoading(const blink::WebURLError&) override; - void didFinishLoadingFrameRequest(const blink::WebURL& url, - void* notify_data) override; - void didFailLoadingFrameRequest(const blink::WebURL& url, - void* notify_data, - const blink::WebURLError& error) override; bool hasSelection() const override; blink::WebString selectionAsText() const override; blink::WebString selectionAsMarkup() const override; diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 0db8f24..76dd11c 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -3723,16 +3723,6 @@ void RenderFrameImpl::didChangePerformanceTiming() { DidChangePerformanceTiming()); } -void RenderFrameImpl::didAbortLoading(blink::WebLocalFrame* frame) { - DCHECK(!frame_ || frame_ == frame); -#if defined(ENABLE_PLUGINS) - if (frame != render_view_->webview()->mainFrame()) - return; - PluginChannelHost::Broadcast( - new PluginHostMsg_DidAbortLoading(render_view_->GetRoutingID())); -#endif -} - void RenderFrameImpl::didCreateScriptContext(blink::WebLocalFrame* frame, v8::Local<v8::Context> context, int extension_group, diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index 374e09d..3ed0635 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h @@ -531,7 +531,6 @@ class CONTENT_EXPORT RenderFrameImpl const blink::WebURL& main_resource_url, const blink::WebCString& main_resource_security_info) override; void didChangePerformanceTiming() override; - void didAbortLoading(blink::WebLocalFrame* frame) override; void didCreateScriptContext(blink::WebLocalFrame* frame, v8::Local<v8::Context> context, int extension_group, diff --git a/content/shell/tools/plugin/PluginTest.cpp b/content/shell/tools/plugin/PluginTest.cpp index d0a56c7..fa95d89 100644 --- a/content/shell/tools/plugin/PluginTest.cpp +++ b/content/shell/tools/plugin/PluginTest.cpp @@ -135,16 +135,6 @@ NPError PluginTest::NPP_SetValue(NPNVariable, void* value) { // NPN functions. -NPError PluginTest::NPN_GetURL(const char* url, const char* target) { - return browser->geturl(m_npp, url, target); -} - -NPError PluginTest::NPN_GetURLNotify(const char* url, - const char* target, - void* notifyData) { - return browser->geturlnotify(m_npp, url, target, notifyData); -} - NPError PluginTest::NPN_GetValue(NPNVariable variable, void* value) { return browser->getvalue(m_npp, variable, value); } diff --git a/content/shell/tools/plugin/PluginTest.h b/content/shell/tools/plugin/PluginTest.h index 82093ae..5df0620 100644 --- a/content/shell/tools/plugin/PluginTest.h +++ b/content/shell/tools/plugin/PluginTest.h @@ -98,10 +98,6 @@ class PluginTest { virtual NPError NPP_SetValue(NPNVariable, void* value); // NPN functions. - NPError NPN_GetURL(const char* url, const char* target); - NPError NPN_GetURLNotify(const char* url, - const char* target, - void* notifyData); NPError NPN_GetValue(NPNVariable, void* value); void NPN_InvalidateRect(NPRect* invalidRect); bool NPN_Invoke(NPObject*, diff --git a/content/shell/tools/plugin/Tests/DocumentOpenInDestroyStream.cpp b/content/shell/tools/plugin/Tests/DocumentOpenInDestroyStream.cpp deleted file mode 100644 index b4b2e8f..0000000 --- a/content/shell/tools/plugin/Tests/DocumentOpenInDestroyStream.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2014 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. - -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -using namespace std; - -extern bool testDocumentOpen(NPP npp); - -// Call document.open from NPP_DestroyStream. - -class DocumentOpenInDestroyStream : public PluginTest { -public: - DocumentOpenInDestroyStream(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - , m_shouldOpen(true) - { - } - -private: - NPError NPP_DestroyStream(NPStream*, NPReason) override { - if (m_shouldOpen) { - testDocumentOpen(m_npp); - m_shouldOpen = false; - } - - return NPERR_NO_ERROR; - } - - bool m_shouldOpen; -}; - -static PluginTest::Register<DocumentOpenInDestroyStream> documentOpenInDestroyStream("document-open-in-destroy-stream"); diff --git a/content/shell/tools/plugin/Tests/GetURLNotifyWithURLThatFailsToLoad.cpp b/content/shell/tools/plugin/Tests/GetURLNotifyWithURLThatFailsToLoad.cpp deleted file mode 100644 index cfbc2cd..0000000 --- a/content/shell/tools/plugin/Tests/GetURLNotifyWithURLThatFailsToLoad.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2014 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. - -/* - * Copyright (C) 2011 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -#include <string.h> - -using namespace std; - -// From NPP_New, call NPN_GetURLNotify with a URL that fails to load (NPP_NewStream won't be called). -// The plugin should still get a NPP_URLNotify indicating that the load failed. -static const char *urlThatFailsToLoad = "foo://bar/"; - -class GetURLNotifyWithURLThatFailsToLoad : public PluginTest { -public: - GetURLNotifyWithURLThatFailsToLoad(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - { - } - -private: - NPError NPP_New(NPMIMEType pluginType, - uint16_t mode, - int16_t argc, - char* argn[], - char* argv[], - NPSavedData* saved) override { - NPN_GetURLNotify(urlThatFailsToLoad, 0, reinterpret_cast<void*>(0x12345678)); - return NPERR_NO_ERROR; - } - - bool NPP_URLNotify(const char* url, - NPReason reason, - void* notifyData) override { - bool didFail = false; - - if (strcmp(url, urlThatFailsToLoad)) - didFail = true; - - if (reason != NPRES_NETWORK_ERR) - didFail = true; - - if (notifyData != reinterpret_cast<void*>(0x12345678)) - didFail = true; - - if (!didFail) - executeScript("testSucceeded()"); - else - executeScript("notifyDone()"); - return true; - } -}; - -static PluginTest::Register<GetURLNotifyWithURLThatFailsToLoad> getURLWithJavaScriptURLDestroyingPlugin("get-url-notify-with-url-that-fails-to-load"); diff --git a/content/shell/tools/plugin/Tests/GetURLWithJavaScriptURL.cpp b/content/shell/tools/plugin/Tests/GetURLWithJavaScriptURL.cpp deleted file mode 100644 index 336a370..0000000 --- a/content/shell/tools/plugin/Tests/GetURLWithJavaScriptURL.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright 2014 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. - -/* - * Copyright (C) 2011 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -#include <string.h> -#include <vector> - -using namespace std; - -const char *javaScriptURL = "javascript:'Hello, ' + 'World!'"; -const char *javaScriptResult = "Hello, World!"; - -// Test that evaluating a javascript: URL will send a stream with the result of the evaluation. -// Test that evaluating JavaScript using NPN_GetURL will a stream with result of the evaluation. -class GetURLWithJavaScriptURL : public PluginTest { -public: - GetURLWithJavaScriptURL(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - , m_didFail(false) - { - } - -private: - NPError NPP_New(NPMIMEType pluginType, - uint16_t mode, - int16_t argc, - char* argn[], - char* argv[], - NPSavedData* saved) override { - NPN_GetURL(javaScriptURL, 0); - return NPERR_NO_ERROR; - } - - NPError NPP_NewStream(NPMIMEType type, - NPStream* stream, - NPBool seekable, - uint16_t* stype) override { - stream->pdata = this; - - if (strcmp(stream->url, javaScriptURL)) - m_didFail = true; - - if (stream->end != strlen(javaScriptResult)) - m_didFail = true; - - *stype = NP_NORMAL; - return NPERR_NO_ERROR; - } - - NPError NPP_DestroyStream(NPStream* stream, NPReason reason) override { - if (stream->pdata != this) - m_didFail = true; - - if (reason != NPRES_DONE) - m_didFail = true; - - if (m_data.size() != stream->end) - m_didFail = true; - - m_data.push_back('\0'); - - if (strcmp(&m_data[0], javaScriptResult)) - m_didFail = true; - - if (!m_didFail) - executeScript("testSucceeded()"); - else - executeScript("notifyDone()"); - - return NPERR_NO_ERROR; - } - - int32_t NPP_WriteReady(NPStream* stream) override { - if (stream->pdata != this) - m_didFail = true; - - return 2; - } - - int32_t NPP_Write(NPStream* stream, - int32_t offset, - int32_t len, - void* buffer) override { - if (stream->pdata != this) - m_didFail = true; - - m_data.insert(m_data.end(), static_cast<char*>(buffer), static_cast<char*>(buffer) + len); - return len; - } - - vector<char> m_data; - bool m_didFail; -}; - -static PluginTest::Register<GetURLWithJavaScriptURL> getURLWithJavaScriptURLDestroyingPlugin("get-url-with-javascript-url"); diff --git a/content/shell/tools/plugin/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp b/content/shell/tools/plugin/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp deleted file mode 100644 index 4e7470f..0000000 --- a/content/shell/tools/plugin/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2014 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. - -/* - * Copyright (C) 2011 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -using namespace std; - -// From NPP_New, call NPN_GetURL to evaluate JavaScript that destroys the plugin. - -class GetURLWithJavaScriptURLDestroyingPlugin : public PluginTest { -public: - GetURLWithJavaScriptURLDestroyingPlugin(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - { - } - -private: - NPError NPP_New(NPMIMEType pluginType, - uint16_t mode, - int16_t argc, - char* argn[], - char* argv[], - NPSavedData* saved) override { - NPN_GetURL("javascript:removePlugin()", 0); - return NPERR_NO_ERROR; - } -}; - -static PluginTest::Register<GetURLWithJavaScriptURLDestroyingPlugin> getURLWithJavaScriptURLDestroyingPlugin("get-url-with-javascript-url-destroying-plugin"); diff --git a/third_party/WebKit/LayoutTests/NeverFixTests b/third_party/WebKit/LayoutTests/NeverFixTests index 5c4da0a..10c6dda 100644 --- a/third_party/WebKit/LayoutTests/NeverFixTests +++ b/third_party/WebKit/LayoutTests/NeverFixTests @@ -145,7 +145,6 @@ fast/canvas/canvas-lost-gpu-context.html [ WontFix ] # Chrome Linux doesn't support NPAPI plugins anymore. [ Linux ] http/tests/plugins/interrupted-get-url.html [ WontFix ] -[ Linux ] http/tests/plugins/third-party-cookie-accept-policy.html [ WontFix ] [ Linux ] plugins/mouse-click-plugin-clears-selection.html [ WontFix ] # Missing Chrome Mac support, will start working when we move to harfbuzz on mac. diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 399b6a3..c965b6d 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations @@ -544,7 +544,6 @@ crbug.com/318978 [ Linux ] http/tests/security/contentSecurityPolicy/object-src- crbug.com/318978 [ Linux ] http/tests/security/contentSecurityPolicy/object-src-none-allowed.html [ Skip ] crbug.com/318978 [ Linux ] http/tests/security/contentSecurityPolicy/object-src-url-blocked.html [ Skip ] crbug.com/318978 [ Linux ] http/tests/security/contentSecurityPolicy/plugin-in-iframe-with-csp.html [ Skip ] -crbug.com/318978 [ Linux ] http/tests/security/frameNavigation/xss-DENIED-plugin-navigation.html [ Skip ] crbug.com/318978 [ Linux ] permissionclient/plugin-permission.html [ Skip ] crbug.com/318978 [ Linux ] plugins/ [ Skip ] diff --git a/third_party/WebKit/LayoutTests/http/tests/plugins/get-url-expected.txt b/third_party/WebKit/LayoutTests/http/tests/plugins/get-url-expected.txt deleted file mode 100644 index 7beb442..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/plugins/get-url-expected.txt +++ /dev/null @@ -1 +0,0 @@ -This tests that NPN_GetURLNotify works as expected and does not ASSERT intermittently in debug builds. diff --git a/third_party/WebKit/LayoutTests/http/tests/plugins/get-url-notify-on-removal-expected.txt b/third_party/WebKit/LayoutTests/http/tests/plugins/get-url-notify-on-removal-expected.txt deleted file mode 100644 index 113aa4c..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/plugins/get-url-notify-on-removal-expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -ALERT: Request completed -This tests that NPP_URLNotify gets called exactly once for canceled streams on plugin removal. -SUCCESS - diff --git a/third_party/WebKit/LayoutTests/http/tests/plugins/get-url-notify-on-removal.html b/third_party/WebKit/LayoutTests/http/tests/plugins/get-url-notify-on-removal.html deleted file mode 100644 index d2a01bd..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/plugins/get-url-notify-on-removal.html +++ /dev/null @@ -1,40 +0,0 @@ -<html> -<body> -This tests that NPP_URLNotify gets called exactly once for canceled streams on plugin removal. -<div id="result">FAILURE</div> -<embed name="plg" type="application/x-webkit-test-netscape"></embed> -<script> - var callbackRun = false; - function callback() - { - if (callbackRun) { - result.textContent = "FAILURE - callback run twice"; - return; - } - - callbackRun = true; - result.textContent = "SUCCESS"; - // Force the plugin to spin a nested event loop. - alert("Request completed"); - // Don't stop the test until a small delay, in case callback is called again. - setTimeout(notify, 50); - } - function notify() - { - if (window.testRunner) - testRunner.notifyDone(); - } - if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.waitUntilDone(); - } - - plg.getURLNotify("resources/slow-resource.pl", null, "callback"); - // Remove the plugin after a short delay (to give the resource time to - // propagate through the system to the browser). - setTimeout(function() { - plg.parentNode.removeChild(plg); - }, 50); -</script> -</body> -</html> diff --git a/third_party/WebKit/LayoutTests/http/tests/plugins/get-url.html b/third_party/WebKit/LayoutTests/http/tests/plugins/get-url.html deleted file mode 100644 index 7b0e0a2..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/plugins/get-url.html +++ /dev/null @@ -1,19 +0,0 @@ -<html> -<body> -This tests that NPN_GetURLNotify works as expected and does not ASSERT intermittently in debug builds. -<embed name="plg" type="application/x-webkit-test-netscape"></embed> -<script> - function notify() - { - if (window.testRunner) - testRunner.notifyDone(); - } - if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.waitUntilDone(); - } - - plg.getURLNotify("resources/load-me-1.txt", null, "notify"); -</script> -</body> -</html> diff --git a/third_party/WebKit/LayoutTests/http/tests/plugins/geturlnotify-from-npp-destroystream-expected.txt b/third_party/WebKit/LayoutTests/http/tests/plugins/geturlnotify-from-npp-destroystream-expected.txt deleted file mode 100644 index 8076e59..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/plugins/geturlnotify-from-npp-destroystream-expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -This tests that a plugin that calls NPP_GetURLNotify from its NPP_DestroyStream during teardown will not cause a crash. -SUCCESS! Did not crash! diff --git a/third_party/WebKit/LayoutTests/http/tests/plugins/geturlnotify-from-npp-destroystream.html b/third_party/WebKit/LayoutTests/http/tests/plugins/geturlnotify-from-npp-destroystream.html deleted file mode 100644 index e2f6dc9..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/plugins/geturlnotify-from-npp-destroystream.html +++ /dev/null @@ -1,27 +0,0 @@ -<html> -<script> -function streamDestroyed() -{ - plg.getURL("data:text/html,Stream data"); -} - -function runTest() { - plg.getURL("/plugins/resources/slow-resource.pl"); - - if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.waitUntilDone(); - } - - var url = 'data:text/html,<scri' + 'pt>if (window.testRunner) testRunner.notifyDone();</scri' + 'pt>'; - url += '<div>This tests that a plugin that calls NPP_GetURLNotify from its NPP_DestroyStream during teardown ' - url += 'will not cause a crash.</div><div>SUCCESS! Did not crash!</div>'; - - setTimeout(function() { window.location.href = url; }, 100); -} - -</script> -<body onload="runTest()"> -<embed name="plg" type="application/x-webkit-test-netscape" onstreamdestroy="streamDestroyed()"></embed> -</body> -</html> diff --git a/third_party/WebKit/LayoutTests/http/tests/plugins/local-geturl-from-remote-expected.txt b/third_party/WebKit/LayoutTests/http/tests/plugins/local-geturl-from-remote-expected.txt deleted file mode 100644 index 3a3ca13..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/plugins/local-geturl-from-remote-expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -CONSOLE ERROR: Not allowed to load local resource: tmp.html -This tests that a plugin in a remote document can't access local files using NPN_GetURL - -FAILURE diff --git a/third_party/WebKit/LayoutTests/http/tests/plugins/local-geturl-from-remote.html b/third_party/WebKit/LayoutTests/http/tests/plugins/local-geturl-from-remote.html deleted file mode 100644 index d90c5f9..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/plugins/local-geturl-from-remote.html +++ /dev/null @@ -1,36 +0,0 @@ -<html> -<head> -<script> -function notify() -{ - if (window.testRunner) - testRunner.notifyDone(); -} - -function runTest() -{ - if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.waitUntilDone(); - } - - // No need to let this point to a real file. - - - var result = plg.getURL('file:///tmp.html', '_self'); - if (result == 1) - document.getElementById('result').innerHTML = "SUCCESS"; - else - document.getElementById('result').innerHTML = "FAILURE"; - - // Round-trip to the plugin once more, so errors can propagate. - plg.getURLNotify("resources/load-me-1.txt", null, "notify"); -} -</script> -</head> -<body onload="runTest()"> -<div>This tests that a plugin in a remote document can't access local files using NPN_GetURL</div> -<embed name="plg" type="application/x-webkit-test-netscape"></embed> -<div id="result">FAILURE</div> -</body> -</html> diff --git a/third_party/WebKit/LayoutTests/http/tests/plugins/npapi-response-headers-expected.txt b/third_party/WebKit/LayoutTests/http/tests/plugins/npapi-response-headers-expected.txt deleted file mode 100644 index 27920cc..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/plugins/npapi-response-headers-expected.txt +++ /dev/null @@ -1,16 +0,0 @@ - -Test for bug 13029: Permit NPAPI plugins to see HTTP response headers. - -Expected result below is two HTTP response extracts, one for the initial stream specified in the "src" attribute, the other for an NPN_GetURLNotify request. Each block should contain the URL; the status line, which should say "HTTP 200 OK"; and the MIME-type, which should say "Content-Type: text/plain". - ----------- - -http://[varies, not being tested]/plugins/resources/load-me-1.txt -HTTP 200 OK -Content-Type: text/plain - ----------- - -http://[varies, not being tested]/plugins/resources/load-me-2.txt -HTTP 200 OK -Content-Type: text/plain diff --git a/third_party/WebKit/LayoutTests/http/tests/plugins/npapi-response-headers.html b/third_party/WebKit/LayoutTests/http/tests/plugins/npapi-response-headers.html deleted file mode 100644 index 7eb7460..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/plugins/npapi-response-headers.html +++ /dev/null @@ -1,108 +0,0 @@ -<html> -<head> -<script> -if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.waitUntilDone(); -} - -loadedFirstURL = false; - -var res1, res2; - -function test() -{ - try { - res1 = document.getElementById("result1"); - res2 = document.getElementById("result2"); - } catch (ex) { - showErr("Exception: " + ex.description); - if (window.testRunner) - testRunner.notifyDone(); - } -} - -function streamLoaded() -{ - if (loadedFirstURL) - return; - - loadedFirstURL = true; - plg.getURLNotify("/plugins/resources/load-me-2.txt", null, "callback"); -} - -function callback(errCode, streamDump) -{ - var parse = parseStreamDump(streamDump); - if (parse.err) - showErr(parse.err); - else { - res1.innerHTML = newlinesToHTML(parse.res1); - res2.innerHTML = newlinesToHTML(parse.res2); - } - - if (window.testRunner) - testRunner.notifyDone(); -} - -// Format passed by plugin: four fields separated by \n\n: -// First URL; first header block; last URL; last header block. -function parseStreamDump(streamDump) -{ - var rtn = {}; - - if (typeof streamDump == "string" || ((typeof streamDump == "object") && (streamDump.constructor == String))) { - var parts = streamDump.split("\n\n"); - if (parts.length >= 4) { - rtn.res1 = genericURL(parts[0]) + "\n" + parseHeaders(parts[1]); - rtn.res2 = genericURL(parts[2]) + "\n" + parseHeaders(parts[3]); - } else - rtn.err = "streamDump from plugin does not have expected format"; - } else - rtn.err = "streamDump from plugin is not a string: " + streamDump; - - return rtn; -} - -function showErr(err) -{ - res1.innerHTML = "FAILED - " + err; - res2.innerHTML = ""; -} - -function newlinesToHTML(str) -{ - return str.replace(/\n/g, "<br>"); -} - -function genericURL(url) -{ - return url.replace(/^(http:\/\/)[^\/]+/, "$1[varies, not being tested]"); -} - -function parseHeaders(hdrs) -{ - var parts = hdrs.split("\n"); - var rtn = parts[0] + "\n"; - - for (var i = 0; i < parts.length; i++) - if (parts[i].match(/^Content-Type:/)) - rtn += parts[i]; - - return rtn; -} -</script> -</head> -<body onload="test()"> -<embed name="plg" type="application/x-webkit-test-netscape" src="/plugins/resources/load-me-1.txt" onstreamload="streamLoaded()"></embed> -<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=13029">bug 13029<a/>: -Permit NPAPI plugins to see HTTP response headers.</p> -<p>Expected result below is two HTTP response extracts, one for the initial stream specified in the "src" -attribute, the other for an NPN_GetURLNotify request. Each block should contain the URL; the status line, -which should say "HTTP 200 OK"; and the MIME-type, which should say "Content-Type: text/plain".</p> -<p>----------</p> -<p id="result1">Running test, result should appear here in a very short time...</p> -<p>----------</p> -<p id="result2">Running test, result should appear here in a very short time...</p> -</body> -</html> diff --git a/third_party/WebKit/LayoutTests/http/tests/plugins/third-party-cookie-accept-policy-expected.txt b/third_party/WebKit/LayoutTests/http/tests/plugins/third-party-cookie-accept-policy-expected.txt deleted file mode 100644 index 97b5ec8..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/plugins/third-party-cookie-accept-policy-expected.txt +++ /dev/null @@ -1,6 +0,0 @@ -CONSOLE WARNING: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. -ALERT: Cookies should be clear, and are: '' -ALERT: About to set a cookie, but on localhost instead of 127.0.0.1, which is our main document domain - This should fail. -ALERT: Cookies should still be clear, and are: '' -This tests that plugins cannot set cookies in violation of the 3rd party cookie policy. - diff --git a/third_party/WebKit/LayoutTests/http/tests/plugins/third-party-cookie-accept-policy.html b/third_party/WebKit/LayoutTests/http/tests/plugins/third-party-cookie-accept-policy.html deleted file mode 100644 index 89c71fb..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/plugins/third-party-cookie-accept-policy.html +++ /dev/null @@ -1,18 +0,0 @@ -<html> -<head> -<script src="../cookies/resources/resetCookies.js"></script> -<script> -resetCookies(); - -if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.waitUntilDone(); -} - -</script> -<body> -This tests that plugins cannot set cookies in violation of the 3rd party cookie policy.<br> -<iframe src="http://localhost:8000/plugins/resources/third-party-cookie-accept-policy-iframe.html"></iframe> - -</body> -</html> diff --git a/third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/resources/frame-with-plugin-to-navigate.html b/third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/resources/frame-with-plugin-to-navigate.html deleted file mode 100644 index 16120a6..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/resources/frame-with-plugin-to-navigate.html +++ /dev/null @@ -1,44 +0,0 @@ -<html> -<head> - <script src="../../resources/cross-frame-access.js"></script> - <script> - window.onload = function() - { - document.getElementsByTagName('h4')[0].innerHTML = document.domain; - window.addEventListener('message', runTest); - } - - runTest = function() - { - if (!window.testRunner) - return; - - plg.getURL("navigation-happened.html", "toNavigate"); - - start = new Date(); - myInterval = setInterval(checkIfDone, 500); - } - - checkIfDone = function() - { - var numOpenWindows = testRunner.windowCount(); - var now = new Date(); - if (numOpenWindows == 2) { - log("Test PASSED"); - clearInterval(myInterval); - testRunner.notifyDone(); - } else if (now - start > 10000) { - log('TEST FAILED: Window count ' + numOpenWindows); - clearInterval(myInterval); - testRunner.notifyDone(); - } - } - </script> -</head> -<body> - <embed name="plg" type="application/x-webkit-test-netscape"></embed> - <h3>Frame-with-plugin-to-navigate</h3> - <h4>DOMAIN</h4> - <pre id='console'></pre> -</body> -</html> diff --git a/third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/xss-DENIED-plugin-navigation-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/xss-DENIED-plugin-navigation-expected.txt deleted file mode 100644 index caf9d6b..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/xss-DENIED-plugin-navigation-expected.txt +++ /dev/null @@ -1,19 +0,0 @@ -CONSOLE ERROR: Unsafe JavaScript attempt to initiate navigation for frame with URL 'http://127.0.0.1:8000/security/resources/cross-frame-iframe.html' from frame with URL 'http://localhost:8000/security/frameNavigation/resources/frame-with-plugin-to-navigate.html'. The frame attempting navigation is neither same-origin with the target, nor is it the target's parent or opener. - - - --------- -Frame: '<!--framePath //<!--frame0-->-->' --------- - -Frame-with-plugin-to-navigate - -localhost - -Test PASSED - - --------- -Frame: 'toNavigate' --------- -Inner iframe. diff --git a/third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/xss-DENIED-plugin-navigation.html b/third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/xss-DENIED-plugin-navigation.html deleted file mode 100644 index b53c669..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/xss-DENIED-plugin-navigation.html +++ /dev/null @@ -1,23 +0,0 @@ -<html> -<head> - <script src="../resources/cross-frame-access.js"></script> - <script> - window.onload = function() - { - if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.dumpChildFramesAsText(); - testRunner.waitUntilDone(); - testRunner.setCanOpenWindows(); - testRunner.setCloseRemainingWindowsWhenComplete(true); - } - window.frames[0].postMessage('run test', '*'); - } - </script> -</head> -<body> -<pre id='console'></pre> -<iframe src="http://localhost:8000/security/frameNavigation/resources/frame-with-plugin-to-navigate.html"></iframe> -<iframe name="toNavigate" src="http://127.0.0.1:8000/security/resources/cross-frame-iframe.html"></iframe> -</body> -</html> diff --git a/third_party/WebKit/LayoutTests/plugins/document-open-expected.txt b/third_party/WebKit/LayoutTests/plugins/document-open-expected.txt deleted file mode 100644 index 8b13789..0000000 --- a/third_party/WebKit/LayoutTests/plugins/document-open-expected.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/third_party/WebKit/LayoutTests/plugins/document-open.html b/third_party/WebKit/LayoutTests/plugins/document-open.html deleted file mode 100644 index 1d0d39d..0000000 --- a/third_party/WebKit/LayoutTests/plugins/document-open.html +++ /dev/null @@ -1,20 +0,0 @@ -<html> -<head> -<body> -<embed id="testPlugin" - type="application/x-webkit-test-netscape" - src="data:text/plain," - test="document-open-in-destroy-stream"> -</embed> - -<div> - This tests that document.open invoked by a plugin via NPN_Invoke without a javascript context succeeds. -</div> -<script> - if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.waitUntilDone(); - } -</script> -</body> -</html> diff --git a/third_party/WebKit/LayoutTests/plugins/embed-inside-object-expected.txt b/third_party/WebKit/LayoutTests/plugins/embed-inside-object-expected.txt deleted file mode 100644 index 93e31b3..0000000 --- a/third_party/WebKit/LayoutTests/plugins/embed-inside-object-expected.txt +++ /dev/null @@ -1,5 +0,0 @@ - -This tests that it's possible to control an embed that is nested inside an object with a span tag in between. -plugin object is: [object HTMLEmbedElement] -SUCCESS - diff --git a/third_party/WebKit/LayoutTests/plugins/embed-inside-object.html b/third_party/WebKit/LayoutTests/plugins/embed-inside-object.html deleted file mode 100644 index dfc0da3..0000000 --- a/third_party/WebKit/LayoutTests/plugins/embed-inside-object.html +++ /dev/null @@ -1,37 +0,0 @@ -<html> -<script> - function debug(str) { - document.getElementById('console').innerHTML += str + "<br>"; - } - - function pluginCallback() { - debug('SUCCESS'); - if (window.testRunner) - testRunner.notifyDone(); - } - - function runTest() { - if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.waitUntilDone(); - } - - var plugin = document.plugin; - - debug('plugin object is: ' + plugin); - plugin.getURL('javascript:pluginCallback()', '_self') - } -</script> -<body onload="runTest()"> -<object name="plugin" type="application/x-webkit-test-netscape"> - <span> - <embed name="plugin" type="application/x-webkit-test-netscape"></embed> - </span> -</object> -<div> - This tests that it's possible to control an embed that is nested inside an object with a span tag in between. -</div> -<div id="console"> -</div> -</body> -</html> diff --git a/third_party/WebKit/ManualTests/NPN_Invoke/main.c b/third_party/WebKit/ManualTests/NPN_Invoke/main.c deleted file mode 100644 index b726b72..0000000 --- a/third_party/WebKit/ManualTests/NPN_Invoke/main.c +++ /dev/null @@ -1,265 +0,0 @@ -/* - IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in - consideration of your agreement to the following terms, and your use, installation, - modification or redistribution of this Apple software constitutes acceptance of these - terms. If you do not agree with these terms, please do not use, install, modify or - redistribute this Apple software. - - In consideration of your agreement to abide by the following terms, and subject to these - terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in - this original Apple software (the "Apple Software"), to use, reproduce, modify and - redistribute the Apple Software, with or without modifications, in source and/or binary - forms; provided that if you redistribute the Apple Software in its entirety and without - modifications, you must retain this notice and the following text and disclaimers in all - such redistributions of the Apple Software. Neither the name, trademarks, service marks - or logos of Apple Computer, Inc. may be used to endorse or promote products derived from - the Apple Software without specific prior written permission from Apple. Except as expressly - stated in this notice, no other rights or licenses, express or implied, are granted by Apple - herein, including but not limited to any patent rights that may be infringed by your - derivative works or by other works in which the Apple Software may be incorporated. - - The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, - EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS - USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - - IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, - REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND - WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR - OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import <WebKit/npapi.h> -#import <WebKit/npfunctions.h> -#import <WebKit/npruntime.h> - -NPNetscapeFuncs *browser; - -NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); -NPError NPP_Destroy(NPP instance, NPSavedData** save); -NPError NPP_SetWindow(NPP instance, NPWindow* window); -NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); -NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason); -int32_t NPP_WriteReady(NPP instance, NPStream* stream); -int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); -void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname); -void NPP_Print(NPP instance, NPPrint* platformPrint); -int16_t NPP_HandleEvent(NPP instance, void* event); -void NPP_URLNotify(NPP instance, const char* URL, NPReason reason, void* notifyData); -NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value); -NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value); - -#pragma export on -// Mach-o entry points -NPError NP_Initialize(NPNetscapeFuncs *browserFuncs); -NPError NP_GetEntryPoints(NPPluginFuncs *pluginFuncs); -void NP_Shutdown(void); -// For compatibility with CFM browsers. -int main(NPNetscapeFuncs *browserFuncs, NPPluginFuncs *pluginFuncs, NPP_ShutdownProcPtr *shutdown); -#pragma export off - - -typedef void (* FunctionPointer) (void); -typedef void (* TransitionVector) (void); -static FunctionPointer functionPointerForTVector(TransitionVector); -static TransitionVector tVectorForFunctionPointer(FunctionPointer); - -// Mach-o entry points -NPError NP_Initialize(NPNetscapeFuncs* browserFuncs) -{ - browser = browserFuncs; - return NPERR_NO_ERROR; -} - -NPError NP_GetEntryPoints(NPPluginFuncs* pluginFuncs) -{ - pluginFuncs->version = 11; - pluginFuncs->size = sizeof(pluginFuncs); - pluginFuncs->newp = NPP_New; - pluginFuncs->destroy = NPP_Destroy; - pluginFuncs->setwindow = NPP_SetWindow; - pluginFuncs->newstream = NPP_NewStream; - pluginFuncs->destroystream = NPP_DestroyStream; - pluginFuncs->asfile = NPP_StreamAsFile; - pluginFuncs->writeready = NPP_WriteReady; - pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write; - pluginFuncs->print = NPP_Print; - pluginFuncs->event = NPP_HandleEvent; - pluginFuncs->urlnotify = NPP_URLNotify; - pluginFuncs->getvalue = NPP_GetValue; - pluginFuncs->setvalue = NPP_SetValue; - - return NPERR_NO_ERROR; -} - -void NP_Shutdown(void) -{ - -} - -// For compatibility with CFM browsers. -int main(NPNetscapeFuncs *browserFuncs, NPPluginFuncs *pluginFuncs, NPP_ShutdownProcPtr *shutdown) -{ - browser = malloc(sizeof(NPNetscapeFuncs)); - bzero(browser, sizeof(NPNetscapeFuncs)); - - browser->size = browserFuncs->size; - browser->version = browserFuncs->version; - - // Since this is a mach-o plugin and the browser is CFM because it is calling main, translate - // our function points into TVectors so the browser can call them. - browser->geturl = (NPN_GetURLProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->geturl); - browser->posturl = (NPN_PostURLProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->posturl); - browser->requestread = (NPN_RequestReadProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->requestread); - browser->newstream = (NPN_NewStreamProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->newstream); - browser->write = (NPN_WriteProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->write); - browser->destroystream = (NPN_DestroyStreamProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->destroystream); - browser->status = (NPN_StatusProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->status); - browser->uagent = (NPN_UserAgentProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->uagent); - browser->memalloc = (NPN_MemAllocProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->memalloc); - browser->memfree = (NPN_MemFreeProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->memfree); - browser->memflush = (NPN_MemFlushProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->memflush); - browser->reloadplugins = (NPN_ReloadPluginsProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->reloadplugins); - browser->geturlnotify = (NPN_GetURLNotifyProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->geturlnotify); - browser->posturlnotify = (NPN_PostURLNotifyProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->posturlnotify); - browser->getvalue = (NPN_GetValueProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->getvalue); - browser->setvalue = (NPN_SetValueProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->setvalue); - browser->invalidaterect = (NPN_InvalidateRectProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->invalidaterect); - browser->invalidateregion = (NPN_InvalidateRegionProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->invalidateregion); - browser->forceredraw = (NPN_ForceRedrawProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->forceredraw); - browser->getJavaEnv = (NPN_GetJavaEnvProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->getJavaEnv); - browser->getJavaPeer = (NPN_GetJavaPeerProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->getJavaPeer); - - pluginFuncs->version = 11; - pluginFuncs->size = sizeof(pluginFuncs); - pluginFuncs->newp = (NPP_NewProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_New); - pluginFuncs->destroy = (NPP_DestroyProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_Destroy); - pluginFuncs->setwindow = (NPP_SetWindowProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_SetWindow); - pluginFuncs->newstream = (NPP_NewStreamProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_NewStream); - pluginFuncs->destroystream = (NPP_DestroyStreamProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_DestroyStream); - pluginFuncs->asfile = (NPP_StreamAsFileProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_StreamAsFile); - pluginFuncs->writeready = (NPP_WriteReadyProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_WriteReady); - pluginFuncs->write = (NPP_WriteProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_Write); - pluginFuncs->print = (NPP_PrintProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_Print); - pluginFuncs->event = (NPP_HandleEventProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_HandleEvent); - pluginFuncs->urlnotify = (NPP_URLNotifyProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_URLNotify); - pluginFuncs->getvalue = (NPP_GetValueProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_GetValue); - pluginFuncs->setvalue = (NPP_SetValueProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_SetValue); - - *shutdown = (NPP_ShutdownProcPtr)tVectorForFunctionPointer((FunctionPointer)NP_Shutdown); - - return NPERR_NO_ERROR; -} - -NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved) -{ - // Call window.alert("Success!") - NPError error; - NPObject *windowObject = NULL; - error = browser->getvalue(instance, NPNVWindowNPObject, &windowObject); - if (error == NPERR_NO_ERROR) { - NPVariant alertMessage; - STRINGZ_TO_NPVARIANT("Success!", alertMessage); - NPVariant result; - browser->invoke(instance, windowObject, browser->getstringidentifier("alert"), &alertMessage, 1, &result); - browser->releaseobject(windowObject); - } - - return NPERR_NO_ERROR; -} - -NPError NPP_Destroy(NPP instance, NPSavedData** save) -{ - return NPERR_NO_ERROR; -} - -NPError NPP_SetWindow(NPP instance, NPWindow* window) -{ - return NPERR_NO_ERROR; -} - -NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype) -{ - *stype = NP_ASFILEONLY; - return NPERR_NO_ERROR; -} - -NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason) -{ - return NPERR_NO_ERROR; -} - -int32_t NPP_WriteReady(NPP instance, NPStream* stream) -{ - return 0; -} - -int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer) -{ - return 0; -} - -void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname) -{ -} - -void NPP_Print(NPP instance, NPPrint* platformPrint) -{ - -} - -int16_t NPP_HandleEvent(NPP instance, void* event) -{ - return 1; -} - -void NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData) -{ - -} - -NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) -{ - return NPERR_GENERIC_ERROR; -} - -NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) -{ - return NPERR_GENERIC_ERROR; -} - -// function pointer converters - -FunctionPointer functionPointerForTVector(TransitionVector tvp) -{ - const uint32_t temp[6] = {0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420}; - uint32_t *newGlue = NULL; - - if (tvp != NULL) { - newGlue = (uint32_t *)malloc(sizeof(temp)); - if (newGlue != NULL) { - unsigned i; - for (i = 0; i < 6; i++) newGlue[i] = temp[i]; - newGlue[0] |= ((UInt32)tvp >> 16); - newGlue[1] |= ((UInt32)tvp & 0xFFFF); - MakeDataExecutable(newGlue, sizeof(temp)); - } - } - - return (FunctionPointer)newGlue; -} - -TransitionVector tVectorForFunctionPointer(FunctionPointer fp) -{ - FunctionPointer *newGlue = NULL; - if (fp != NULL) { - newGlue = (FunctionPointer *)malloc(2 * sizeof(FunctionPointer)); - if (newGlue != NULL) { - newGlue[0] = fp; - newGlue[1] = NULL; - } - } - return (TransitionVector)newGlue; -} diff --git a/third_party/WebKit/ManualTests/NPN_Invoke/test.html b/third_party/WebKit/ManualTests/NPN_Invoke/test.html deleted file mode 100644 index 5164701..0000000 --- a/third_party/WebKit/ManualTests/NPN_Invoke/test.html +++ /dev/null @@ -1,29 +0,0 @@ -<html> -<head> -<title>NPN_Invoke() test</title> -</head> -<body> - -<object width="0" height="0" type="test/npn-invoke"> - <!-- Fallback content to describe how to run the test -- /> - <p>You do not have the "NPN_Invoke" plugin installed. Before you run this test:</p> - <ol> - <li>Build the included Xcode project, "NPN_Invoke.xcodeproj".</li> - <li>Copy the built plugin (NPN_Invoke.plugin) to /Library/Internet Plug-Ins.</li> - <li>Restart Safari.</li> - </ol> -</object> - -<p>This tests NPN_Invoke(), part of the Netscape Plugin API scripting interface.</p> -<p>To verify, you must run this test with JavaScript enabled and then repeat the test with JavaScript disabled.</p> - -<h4>JavaScript enabled</h4> -<p style="color: green">Success: An alert dialog is shown with the message "Success!"</p> -<p style="color: red">Failure: No alert dialog is shown, or the message is not "Success!"</p> - -<h4>JavaScript disabled</h4> -<p style="color: green">Success: No alert dialog is shown, and Safari remains open (does not crash).</p> -<p style="color: red">Failure: An alert dialog is shown, or Safari crashes.</p> - -</body> -</html> diff --git a/third_party/WebKit/Source/core/html/PluginDocument.cpp b/third_party/WebKit/Source/core/html/PluginDocument.cpp index dc40f1c..b10bfbf 100644 --- a/third_party/WebKit/Source/core/html/PluginDocument.cpp +++ b/third_party/WebKit/Source/core/html/PluginDocument.cpp @@ -135,14 +135,7 @@ void PluginDocumentParser::appendBytes(const char* data, size_t length) void PluginDocumentParser::finish() { - if (PluginView* view = pluginView()) { - const ResourceError& error = document()->loader()->mainDocumentError(); - if (error.isNull()) - view->didFinishLoading(); - else - view->didFailLoading(error); - m_embedElement = nullptr; - } + m_embedElement = nullptr; RawDataDocumentParser::finish(); } diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp index 245b086..0d2e963 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp @@ -217,7 +217,6 @@ void DocumentLoader::mainReceivedError(const ResourceError& error) m_applicationCacheHost->failedLoadingMainResource(); if (!frameLoader()) return; - m_mainDocumentError = error; if (m_state < MainResourceDone) m_state = MainResourceDone; frameLoader()->receivedMainResourceError(this, error); @@ -723,7 +722,6 @@ bool DocumentLoader::maybeLoadEmpty() void DocumentLoader::startLoadingMainResource() { RefPtrWillBeRawPtr<DocumentLoader> protect(this); - m_mainDocumentError = ResourceError(); timing().markNavigationStart(); ASSERT(!m_mainResource); ASSERT(m_state == NotStarted); diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.h b/third_party/WebKit/Source/core/loader/DocumentLoader.h index ff2d375..6b2e39c 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoader.h +++ b/third_party/WebKit/Source/core/loader/DocumentLoader.h @@ -98,7 +98,6 @@ public: void stopLoading(); bool isLoading() const; const ResourceResponse& response() const { return m_response; } - const ResourceError& mainDocumentError() const { return m_mainDocumentError; } bool isClientRedirect() const { return m_isClientRedirect; } void setIsClientRedirect(bool isClientRedirect) { m_isClientRedirect = isClientRedirect; } bool replacesCurrentHistoryItem() const { return m_replacesCurrentHistoryItem; } @@ -213,8 +212,6 @@ private: ResourceResponse m_response; - ResourceError m_mainDocumentError; - bool m_isClientRedirect; bool m_replacesCurrentHistoryItem; diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp index 7ae9aea..ba674ec 100644 --- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp +++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp @@ -996,11 +996,6 @@ void FrameLoader::stopAllLoaders() m_frame->navigationScheduler().cancel(); m_inStopAllLoaders = false; - - // LocalFrame::detach() can be called multiple times which - // means we may no longer have a FrameLoaderClient to talk to. - if (client()) - client()->didStopAllLoaders(); } void FrameLoader::didAccessInitialDocument() diff --git a/third_party/WebKit/Source/core/loader/FrameLoaderClient.h b/third_party/WebKit/Source/core/loader/FrameLoaderClient.h index 7fe131b..42e507d 100644 --- a/third_party/WebKit/Source/core/loader/FrameLoaderClient.h +++ b/third_party/WebKit/Source/core/loader/FrameLoaderClient.h @@ -231,8 +231,6 @@ public: virtual PassOwnPtr<WebApplicationCacheHost> createApplicationCacheHost(WebApplicationCacheHostClient*) = 0; - virtual void didStopAllLoaders() { } - virtual void dispatchDidChangeManifest() { } virtual unsigned backForwardLength() { return 0; } diff --git a/third_party/WebKit/Source/core/plugins/PluginView.h b/third_party/WebKit/Source/core/plugins/PluginView.h index 372d999..638ae68 100644 --- a/third_party/WebKit/Source/core/plugins/PluginView.h +++ b/third_party/WebKit/Source/core/plugins/PluginView.h @@ -53,8 +53,6 @@ public: virtual void didReceiveResponse(const ResourceResponse&) { } virtual void didReceiveData(const char*, int) { } - virtual void didFinishLoading() { } - virtual void didFailLoading(const ResourceError&) { } virtual void layoutIfNeeded() { } virtual void invalidatePaintIfNeeded() { } diff --git a/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp b/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp index 69945ad..19de8ca 100644 --- a/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp +++ b/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp @@ -99,7 +99,6 @@ #include "web/WebDevToolsFrontendImpl.h" #include "web/WebLocalFrameImpl.h" #include "web/WebPluginContainerImpl.h" -#include "web/WebPluginLoadObserver.h" #include "web/WebViewImpl.h" #include "wtf/StringExtras.h" #include "wtf/text/CString.h" @@ -494,37 +493,17 @@ void FrameLoaderClientImpl::dispatchDidCommitLoad(HistoryItem* item, HistoryComm void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad( const ResourceError& error, HistoryCommitType commitType) { - OwnPtrWillBeRawPtr<WebPluginLoadObserver> observer = pluginLoadObserver(m_webFrame->frame()->loader().provisionalDocumentLoader()); m_webFrame->didFail(error, true, commitType); - if (observer) - observer->didFailLoading(error); } void FrameLoaderClientImpl::dispatchDidFailLoad(const ResourceError& error, HistoryCommitType commitType) { - OwnPtrWillBeRawPtr<WebPluginLoadObserver> observer = pluginLoadObserver(m_webFrame->frame()->loader().documentLoader()); m_webFrame->didFail(error, false, commitType); - if (observer) - observer->didFailLoading(error); - - // Don't clear the redirect chain, this will happen in the middle of client - // redirects, and we need the context. The chain will be cleared when the - // provisional load succeeds or fails, not the "real" one. } void FrameLoaderClientImpl::dispatchDidFinishLoad() { - OwnPtrWillBeRawPtr<WebPluginLoadObserver> observer = pluginLoadObserver(m_webFrame->frame()->loader().documentLoader()); - - if (m_webFrame->client()) - m_webFrame->client()->didFinishLoad(m_webFrame); - - if (observer) - observer->didFinishLoading(); - - // Don't clear the redirect chain, this will happen in the middle of client - // redirects, and we need the context. The chain will be cleared when the - // provisional load succeeds or fails, not the "real" one. + m_webFrame->didFinish(); } void FrameLoaderClientImpl::dispatchDidChangeThemeColor() @@ -883,11 +862,6 @@ ObjectContentType FrameLoaderClientImpl::objectContentType( return ObjectContentNone; } -PassOwnPtrWillBeRawPtr<WebPluginLoadObserver> FrameLoaderClientImpl::pluginLoadObserver(DocumentLoader* loader) -{ - return WebDataSourceImpl::fromDocumentLoader(loader)->releasePluginLoadObserver(); -} - WebCookieJar* FrameLoaderClientImpl::cookieJar() const { if (!m_webFrame->client()) @@ -1001,12 +975,6 @@ PassOwnPtr<WebApplicationCacheHost> FrameLoaderClientImpl::createApplicationCach return adoptPtr(m_webFrame->client()->createApplicationCacheHost(m_webFrame, client)); } -void FrameLoaderClientImpl::didStopAllLoaders() -{ - if (m_webFrame->client()) - m_webFrame->client()->didAbortLoading(m_webFrame); -} - void FrameLoaderClientImpl::dispatchDidChangeManifest() { if (m_webFrame->client()) diff --git a/third_party/WebKit/Source/web/FrameLoaderClientImpl.h b/third_party/WebKit/Source/web/FrameLoaderClientImpl.h index 3cdeabc..360f5b0 100644 --- a/third_party/WebKit/Source/web/FrameLoaderClientImpl.h +++ b/third_party/WebKit/Source/web/FrameLoaderClientImpl.h @@ -41,7 +41,6 @@ namespace blink { class WebLocalFrameImpl; -class WebPluginLoadObserver; class FrameLoaderClientImpl final : public FrameLoaderClient { public: @@ -171,8 +170,6 @@ public: PassOwnPtr<WebApplicationCacheHost> createApplicationCacheHost(WebApplicationCacheHostClient*) override; - void didStopAllLoaders() override; - void dispatchDidChangeManifest() override; unsigned backForwardLength() override; @@ -184,8 +181,6 @@ private: bool isFrameLoaderClientImpl() const override { return true; } - PassOwnPtrWillBeRawPtr<WebPluginLoadObserver> pluginLoadObserver(DocumentLoader*); - // The WebFrame that owns this object and manages its lifetime. Therefore, // the web frame object is guaranteed to exist. RawPtrWillBeMember<WebLocalFrameImpl> m_webFrame; diff --git a/third_party/WebKit/Source/web/WebDataSourceImpl.cpp b/third_party/WebKit/Source/web/WebDataSourceImpl.cpp index 45a6748..455be26b 100644 --- a/third_party/WebKit/Source/web/WebDataSourceImpl.cpp +++ b/third_party/WebKit/Source/web/WebDataSourceImpl.cpp @@ -38,12 +38,6 @@ namespace blink { -static OwnPtrWillBePersistent<WebPluginLoadObserver>& nextPluginLoadObserver() -{ - DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WebPluginLoadObserver>, nextPluginLoadObserver, ()); - return nextPluginLoadObserver; -} - PassRefPtrWillBeRawPtr<WebDataSourceImpl> WebDataSourceImpl::create(LocalFrame* frame, const ResourceRequest& request, const SubstituteData& data) { return adoptRefWillBeNoop(new WebDataSourceImpl(frame, request, data)); @@ -137,25 +131,9 @@ WebNavigationType WebDataSourceImpl::toWebNavigationType(NavigationType type) } } -void WebDataSourceImpl::setNextPluginLoadObserver(PassOwnPtrWillBeRawPtr<WebPluginLoadObserver> observer) -{ - nextPluginLoadObserver() = observer; -} - WebDataSourceImpl::WebDataSourceImpl(LocalFrame* frame, const ResourceRequest& request, const SubstituteData& data) : DocumentLoader(frame, request, data) { - if (!nextPluginLoadObserver()) - return; - // When a new frame is created, it initially gets a data source for an - // empty document. Then it is navigated to the source URL of the - // frame, which results in a second data source being created. We want - // to wait to attach the WebPluginLoadObserver to that data source. - if (request.url().isEmpty()) - return; - - ASSERT(nextPluginLoadObserver()->url() == WebURL(request.url())); - m_pluginLoadObserver = nextPluginLoadObserver().release(); } WebDataSourceImpl::~WebDataSourceImpl() @@ -170,12 +148,10 @@ void WebDataSourceImpl::detachFromFrame() DocumentLoader::detachFromFrame(); m_extraData.clear(); - m_pluginLoadObserver.clear(); } DEFINE_TRACE(WebDataSourceImpl) { - visitor->trace(m_pluginLoadObserver); DocumentLoader::trace(visitor); } diff --git a/third_party/WebKit/Source/web/WebDataSourceImpl.h b/third_party/WebKit/Source/web/WebDataSourceImpl.h index 77e8580..b948d87 100644 --- a/third_party/WebKit/Source/web/WebDataSourceImpl.h +++ b/third_party/WebKit/Source/web/WebDataSourceImpl.h @@ -37,7 +37,6 @@ #include "platform/heap/Handle.h" #include "platform/weborigin/KURL.h" #include "public/web/WebDataSource.h" -#include "web/WebPluginLoadObserver.h" #include "wtf/OwnPtr.h" #include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" @@ -70,9 +69,6 @@ public: static WebNavigationType toWebNavigationType(NavigationType); - PassOwnPtrWillBeRawPtr<WebPluginLoadObserver> releasePluginLoadObserver() { return m_pluginLoadObserver.release(); } - static void setNextPluginLoadObserver(PassOwnPtrWillBeRawPtr<WebPluginLoadObserver>); - DECLARE_VIRTUAL_TRACE(); private: @@ -88,7 +84,6 @@ private: mutable WrappedResourceResponse m_responseWrapper; OwnPtr<ExtraData> m_extraData; - OwnPtrWillBeMember<WebPluginLoadObserver> m_pluginLoadObserver; }; } // namespace blink diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp index eb7bedf..71dfa1b 100644 --- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp +++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp @@ -1975,6 +1975,17 @@ void WebLocalFrameImpl::didFail(const ResourceError& error, bool wasProvisional, client()->didFailProvisionalLoad(this, webError, webCommitType); else client()->didFailLoad(this, webError, webCommitType); + if (WebPluginContainerImpl* plugin = pluginContainerFromFrame(frame())) + plugin->didFailLoading(error); +} + +void WebLocalFrameImpl::didFinish() +{ + if (!client()) + return; + client()->didFinishLoad(this); + if (WebPluginContainerImpl* plugin = pluginContainerFromFrame(frame())) + plugin->didFinishLoading(); } void WebLocalFrameImpl::setCanHaveScrollbars(bool canHaveScrollbars) diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.h b/third_party/WebKit/Source/web/WebLocalFrameImpl.h index c2618b7..147c417 100644 --- a/third_party/WebKit/Source/web/WebLocalFrameImpl.h +++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.h @@ -317,6 +317,7 @@ public: void setFindEndstateFocusAndSelection(); void didFail(const ResourceError&, bool wasProvisional, HistoryCommitType); + void didFinish(); // Sets whether the WebLocalFrameImpl allows its document to be scrolled. // If the parameter is true, allow the document to be scrolled. diff --git a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp index 10a10cf..8de3047 100644 --- a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp +++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp @@ -493,23 +493,12 @@ WebString WebPluginContainerImpl::executeScriptURL(const WebURL& url, bool popup return toCoreString(v8::Local<v8::String>::Cast(result)); } -void WebPluginContainerImpl::loadFrameRequest(const WebURLRequest& request, const WebString& target, bool notifyNeeded, void* notifyData) +void WebPluginContainerImpl::loadFrameRequest(const WebURLRequest& request, const WebString& target) { LocalFrame* frame = m_element->document().frame(); if (!frame || !frame->loader().documentLoader()) return; // FIXME: send a notification in this case? - if (notifyNeeded) { - // FIXME: This is a bit of hack to allow us to observe completion of - // our frame request. It would be better to evolve FrameLoader to - // support a completion callback instead. - OwnPtrWillBeRawPtr<WebPluginLoadObserver> observer = WebPluginLoadObserver::create(this, request.url(), notifyData); -#if !ENABLE(OILPAN) - m_pluginLoadObservers.append(observer.get()); -#endif - WebDataSourceImpl::setNextPluginLoadObserver(observer.release()); - } - FrameLoadRequest frameRequest(frame->document(), request.toResourceRequest(), target); frame->loader().load(frameRequest); } @@ -686,16 +675,6 @@ bool WebPluginContainerImpl::wantsWheelEvents() return m_wantsWheelEvents; } -#if !ENABLE(OILPAN) -void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver* observer) -{ - size_t pos = m_pluginLoadObservers.find(observer); - if (pos == kNotFound) - return; - m_pluginLoadObservers.remove(pos); -} -#endif - // Private methods ------------------------------------------------------------- WebPluginContainerImpl::WebPluginContainerImpl(HTMLPlugInElement* element, WebPlugin* webPlugin) @@ -731,11 +710,6 @@ void WebPluginContainerImpl::dispose() if (m_element && m_touchEventRequestType != TouchEventRequestTypeNone && m_element->document().frameHost()) m_element->document().frameHost()->eventHandlerRegistry().didRemoveEventHandler(*m_element, EventHandlerRegistry::TouchEvent); -#if !ENABLE(OILPAN) - for (const auto& observer : m_pluginLoadObservers) - observer->clearPluginContainer(); -#endif - if (m_webPlugin) { RELEASE_ASSERT(!m_webPlugin->container() || m_webPlugin->container() == this); m_webPlugin->destroy(); @@ -747,9 +721,6 @@ void WebPluginContainerImpl::dispose() m_webLayer = nullptr; } -#if !ENABLE(OILPAN) - m_pluginLoadObservers.clear(); -#endif m_element = nullptr; } diff --git a/third_party/WebKit/Source/web/WebPluginContainerImpl.h b/third_party/WebKit/Source/web/WebPluginContainerImpl.h index d0be624..a79503b 100644 --- a/third_party/WebKit/Source/web/WebPluginContainerImpl.h +++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.h @@ -55,7 +55,6 @@ class ResourceError; class ResourceResponse; class TouchEvent; class WebPlugin; -class WebPluginLoadObserver; class WheelEvent; class Widget; struct WebPrintParams; @@ -108,7 +107,7 @@ public: NPObject* scriptableObjectForElement() override; v8::Local<v8::Object> v8ObjectForElement() override; WebString executeScriptURL(const WebURL&, bool popupsAllowed) override; - void loadFrameRequest(const WebURLRequest&, const WebString& target, bool notifyNeeded, void* notifyData) override; + void loadFrameRequest(const WebURLRequest&, const WebString& target) override; bool isRectTopmost(const WebRect&) override; void requestTouchEventType(TouchEventRequestType) override; void setWantsWheelEvents(bool) override; @@ -153,12 +152,8 @@ public: // Resource load events for the plugin's source data: void didReceiveResponse(const ResourceResponse&) override; void didReceiveData(const char *data, int dataLength) override; - void didFinishLoading() override; - void didFailLoading(const ResourceError&) override; - -#if !ENABLE(OILPAN) - void willDestroyPluginLoadObserver(WebPluginLoadObserver*); -#endif + void didFinishLoading(); + void didFailLoading(const ResourceError&); DECLARE_VIRTUAL_TRACE(); void dispose() override; @@ -202,9 +197,6 @@ private: RawPtrWillBeMember<HTMLPlugInElement> m_element; WebPlugin* m_webPlugin; -#if !ENABLE(OILPAN) - Vector<WebPluginLoadObserver*> m_pluginLoadObservers; -#endif WebLayer* m_webLayer; diff --git a/third_party/WebKit/Source/web/WebPluginLoadObserver.cpp b/third_party/WebKit/Source/web/WebPluginLoadObserver.cpp deleted file mode 100644 index 911a751..0000000 --- a/third_party/WebKit/Source/web/WebPluginLoadObserver.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "web/WebPluginLoadObserver.h" - -#include "public/web/WebPlugin.h" -#include "web/WebPluginContainerImpl.h" - -namespace blink { - -WebPluginLoadObserver::~WebPluginLoadObserver() -{ -#if !ENABLE(OILPAN) - if (m_pluginContainer) - m_pluginContainer->willDestroyPluginLoadObserver(this); -#endif -} - -DEFINE_TRACE(WebPluginLoadObserver) -{ - visitor->trace(m_pluginContainer); -} - -void WebPluginLoadObserver::didFinishLoading() -{ - if (!m_pluginContainer) - return; - if (WebPlugin* plugin = m_pluginContainer->plugin()) - plugin->didFinishLoadingFrameRequest(m_notifyURL, m_notifyData); -} - -void WebPluginLoadObserver::didFailLoading(const WebURLError& error) -{ - if (!m_pluginContainer) - return; - if (WebPlugin* plugin = m_pluginContainer->plugin()) - plugin->didFailLoadingFrameRequest(m_notifyURL, m_notifyData, error); -} - -} // namespace blink diff --git a/third_party/WebKit/Source/web/WebPluginLoadObserver.h b/third_party/WebKit/Source/web/WebPluginLoadObserver.h deleted file mode 100644 index 25ecd7a..0000000 --- a/third_party/WebKit/Source/web/WebPluginLoadObserver.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebPluginLoadObserver_h -#define WebPluginLoadObserver_h - -#include "platform/heap/Handle.h" -#include "public/platform/WebURL.h" - -namespace blink { - -class WebPluginContainerImpl; -struct WebURLError; - -class WebPluginLoadObserver final : public NoBaseWillBeGarbageCollectedFinalized<WebPluginLoadObserver> { -public: - static PassOwnPtrWillBeRawPtr<WebPluginLoadObserver> create(WebPluginContainerImpl* pluginContainer, const WebURL& notifyURL, void* notifyData) - { - return adoptPtrWillBeNoop(new WebPluginLoadObserver(pluginContainer, notifyURL, notifyData)); - } - ~WebPluginLoadObserver(); - - const WebURL& url() const { return m_notifyURL; } - -#if !ENABLE(OILPAN) - void clearPluginContainer() { m_pluginContainer = nullptr; } -#endif - void didFinishLoading(); - void didFailLoading(const WebURLError&); - - DECLARE_TRACE(); - -private: - WebPluginLoadObserver(WebPluginContainerImpl* pluginContainer, const WebURL& notifyURL, void* notifyData) - : m_pluginContainer(pluginContainer) - , m_notifyURL(notifyURL) - , m_notifyData(notifyData) - { - } - - RawPtrWillBeWeakMember<WebPluginContainerImpl> m_pluginContainer; - WebURL m_notifyURL; - void* m_notifyData; -}; - -} // namespace blink - -#endif diff --git a/third_party/WebKit/Source/web/tests/FakeWebPlugin.h b/third_party/WebKit/Source/web/tests/FakeWebPlugin.h index 6fd138e..5b3f1c3 100644 --- a/third_party/WebKit/Source/web/tests/FakeWebPlugin.h +++ b/third_party/WebKit/Source/web/tests/FakeWebPlugin.h @@ -64,8 +64,6 @@ public: void didReceiveData(const char* data, int dataLength) override { } void didFinishLoading() override { } void didFailLoading(const WebURLError&) override { } - void didFinishLoadingFrameRequest(const WebURL&, void* notifyData) override { } - void didFailLoadingFrameRequest(const WebURL&, void* notifyData, const WebURLError&) override { } bool isPlaceholder() override { return false; } protected: diff --git a/third_party/WebKit/Source/web/web.gypi b/third_party/WebKit/Source/web/web.gypi index bcbc134..f92224b 100644 --- a/third_party/WebKit/Source/web/web.gypi +++ b/third_party/WebKit/Source/web/web.gypi @@ -190,8 +190,6 @@ 'WebPluginContainerImpl.cpp', 'WebPluginContainerImpl.h', 'WebPluginDocument.cpp', - 'WebPluginLoadObserver.cpp', - 'WebPluginLoadObserver.h', 'WebPluginScriptForbiddenScope.cpp', 'WebRange.cpp', 'WebRemoteFrameImpl.cpp', diff --git a/third_party/WebKit/public/web/WebFrameClient.h b/third_party/WebKit/public/web/WebFrameClient.h index d51e821..89f2cef 100644 --- a/third_party/WebKit/public/web/WebFrameClient.h +++ b/third_party/WebKit/public/web/WebFrameClient.h @@ -460,9 +460,6 @@ public: // A performance timing event (e.g. first paint) occurred virtual void didChangePerformanceTiming() { } - // The loaders in this frame have been stopped. - virtual void didAbortLoading(WebLocalFrame*) { } - // Script notifications ------------------------------------------------ diff --git a/third_party/WebKit/public/web/WebPlugin.h b/third_party/WebKit/public/web/WebPlugin.h index 0d979f4..dfeefbf 100644 --- a/third_party/WebKit/public/web/WebPlugin.h +++ b/third_party/WebKit/public/web/WebPlugin.h @@ -118,12 +118,6 @@ public: virtual void didFinishLoading() = 0; virtual void didFailLoading(const WebURLError&) = 0; - // Called in response to WebPluginContainer::loadFrameRequest - virtual void didFinishLoadingFrameRequest( - const WebURL&, void* notifyData) = 0; - virtual void didFailLoadingFrameRequest( - const WebURL&, void* notifyData, const WebURLError&) = 0; - // Printing interface. // Whether the plugin supports its own paginated print. The other print // interface methods are called only if this method returns true. diff --git a/third_party/WebKit/public/web/WebPluginContainer.h b/third_party/WebKit/public/web/WebPluginContainer.h index b757702..46edc00 100644 --- a/third_party/WebKit/public/web/WebPluginContainer.h +++ b/third_party/WebKit/public/web/WebPluginContainer.h @@ -106,7 +106,7 @@ public: // called if the load failed. The given notifyData is passed along to // the callback. virtual void loadFrameRequest( - const WebURLRequest&, const WebString& target, bool notifyNeeded, void* notifyData) = 0; + const WebURLRequest&, const WebString& target) = 0; // Determines whether the given rectangle in this plugin is above all other // content. The rectangle is in the plugin's coordinate system. |