summaryrefslogtreecommitdiffstats
path: root/webkit/glue/plugins/test/plugin_geturl_test.cc
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-03 07:57:44 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-03 07:57:44 +0000
commit4adf556dec57f4a937a3a03b9b3a3d9ffdf7a49e (patch)
tree7425f8ca3a9411f5b07a408253b951ff320aef1f /webkit/glue/plugins/test/plugin_geturl_test.cc
parent3d248b2db2eae7c805ada987f997caa0929700c7 (diff)
downloadchromium_src-4adf556dec57f4a937a3a03b9b3a3d9ffdf7a49e.zip
chromium_src-4adf556dec57f4a937a3a03b9b3a3d9ffdf7a49e.tar.gz
chromium_src-4adf556dec57f4a937a3a03b9b3a3d9ffdf7a49e.tar.bz2
Don't set referrers on outgoing plugin requests if the load_manually flag is set. This emulates the
behavior of other browsers and fixes http://code.google.com/p/chromium/issues/detail?id=28800 I added a UI test to validate that the plugin source URL is set on outgoing GetURL requests issued by the plugin. To validate that the document URL is set as the referrer on the initial URL request would take some more work. Will try and add that in a future CL. I also changed the WebPluginImpl::RouteToFrame function to set the referrer on similar lines. Bug=28800 Test=Covered by UI test Review URL: http://codereview.chromium.org/459003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33673 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins/test/plugin_geturl_test.cc')
-rw-r--r--webkit/glue/plugins/test/plugin_geturl_test.cc39
1 files changed, 33 insertions, 6 deletions
diff --git a/webkit/glue/plugins/test/plugin_geturl_test.cc b/webkit/glue/plugins/test/plugin_geturl_test.cc
index cdce37d..df4bcc5 100644
--- a/webkit/glue/plugins/test/plugin_geturl_test.cc
+++ b/webkit/glue/plugins/test/plugin_geturl_test.cc
@@ -46,12 +46,18 @@ NPError PluginGetURLTest::New(uint16 mode, int16 argc, const char* argn[],
if (page_not_found_url) {
page_not_found_url_ = page_not_found_url;
expect_404_response_ = true;
- } else {
- const char* fail_write_url = GetArgValue("fail_write_url", argc,
- argn, argv);
- if (fail_write_url) {
- fail_write_url_ = fail_write_url;
- }
+ }
+
+ const char* fail_write_url = GetArgValue("fail_write_url", argc,
+ argn, argv);
+ if (fail_write_url) {
+ fail_write_url_ = fail_write_url;
+ }
+
+ const char* referrer_target_url = GetArgValue("ref_target", argc,
+ argn, argv);
+ if (referrer_target_url) {
+ referrer_target_url_ = referrer_target_url;
}
return PluginTest::New(mode, argc, argn, argv, saved);
@@ -69,6 +75,11 @@ NPError PluginGetURLTest::SetWindow(NPWindow* pNPWindow) {
} else if (!fail_write_url_.empty()) {
HostFunctions()->geturl(id(), fail_write_url_.c_str(), NULL);
return NPERR_NO_ERROR;
+ } else if (!referrer_target_url_.empty()) {
+ HostFunctions()->pushpopupsenabledstate(id(), true);
+ HostFunctions()->geturl(id(), referrer_target_url_.c_str(), "_blank");
+ HostFunctions()->poppopupsenabledstate(id());
+ return NPERR_NO_ERROR;
}
std::string url = SELF_URL;
@@ -94,6 +105,10 @@ NPError PluginGetURLTest::NewStream(NPMIMEType type, NPStream* stream,
return PluginTest::NewStream(type, stream, seekable, stype);
}
+ if (!referrer_target_url_.empty()) {
+ return NPERR_NO_ERROR;
+ }
+
COMPILE_ASSERT(sizeof(unsigned long) <= sizeof(stream->notifyData),
cast_validity_check);
@@ -160,6 +175,10 @@ int32 PluginGetURLTest::WriteReady(NPStream *stream) {
return PluginTest::WriteReady(stream);
}
+ if (!referrer_target_url_.empty()) {
+ return STREAM_CHUNK;
+ }
+
COMPILE_ASSERT(sizeof(unsigned long) <= sizeof(stream->notifyData),
cast_validity_check);
unsigned long stream_id = reinterpret_cast<unsigned long>(
@@ -181,6 +200,10 @@ int32 PluginGetURLTest::Write(NPStream *stream, int32 offset, int32 len,
return -1;
}
+ if (!referrer_target_url_.empty()) {
+ return len;
+ }
+
if (stream == NULL) {
SetError("Write got null stream");
return -1;
@@ -244,6 +267,10 @@ NPError PluginGetURLTest::DestroyStream(NPStream *stream, NPError reason) {
return NPERR_NO_ERROR;
}
+ if (!referrer_target_url_.empty()) {
+ return NPERR_NO_ERROR;
+ }
+
unsigned long stream_id =
reinterpret_cast<unsigned long>(stream->notifyData);
switch (stream_id) {