Index: content/child/npapi/plugin_host.cc |
diff --git a/content/child/npapi/plugin_host.cc b/content/child/npapi/plugin_host.cc |
index ea7d0a00274b87a020d6fdb09fdfe9da46430c69..fdab548334b1fbadd4b71206029779e3a9c9b6c4 100644 |
--- a/content/child/npapi/plugin_host.cc |
+++ b/content/child/npapi/plugin_host.cc |
@@ -351,48 +351,11 @@ NPError NPN_RequestRead(NPStream* stream, NPByteRange* 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; |
-} |
- |
-// Requests creation of a new stream with the contents of the |
-// specified URL; gets notification of the result. |
NPError NPN_GetURLNotify(NPP id, |
dcheng
2015/11/18 18:38:18
I feel like we should just nuke this one too.
Nate Chapin
2015/11/18 23:28:50
These functions are referenced by the _NPPluginFun
dcheng
2015/11/19 03:41:40
Oops, sorry. I posted the comment on the wrong lin
|
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) { |
@@ -408,19 +371,52 @@ NPError NPN_GetURL(NPP id, const char* url, const char* target) { |
// browser window |
// If the target is _self, no other instance of the plugin is created. The |
// plugin continues to operate in its own window |
+ 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); |
+ return NPERR_NO_ERROR; |
+} |
- return GetURLNotify(id, url, target, false, 0); |
+NPError NPN_PostURLNotify(NPP id, |
dcheng
2015/11/18 18:38:18
Ditto: why not nuke?
Nate Chapin
2015/11/18 23:28:50
See above.
|
+ const char* url, |
+ const char* target, |
+ uint32_t len, |
+ const char* buf, |
+ NPBool file, |
+ void* notify_data) { |
+ return NPERR_GENERIC_ERROR; |
} |
-// 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) { |
+NPError NPN_PostURL(NPP id, |
+ const char* url, |
+ const char* target, |
+ 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 |
+ |
if (!url) |
return NPERR_INVALID_URL; |
@@ -495,50 +491,10 @@ static NPError PostURLNotify(NPP id, |
// 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); |
+ plugin->RequestURL(url, "POST", target, buf, len); |
return NPERR_NO_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); |
-} |
- |
-NPError NPN_PostURL(NPP id, |
- const char* url, |
- const char* target, |
- 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); |
-} |
- |
NPError NPN_NewStream(NPP id, |
NPMIMEType type, |
const char* target, |
@@ -1098,10 +1054,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" |