Bug 737433 - Send the referer for embedded src="" streams for plugins (and make them part of the correct load group while we're at it!), r=josh

--HG--
extra : rebase_source : 1d3f255cfd861fb136d54cef63f327a77f76c931
This commit is contained in:
Benjamin Smedberg 2012-03-29 12:53:31 -04:00
Родитель 8ff6eda08e
Коммит 254658bd3a
4 изменённых файлов: 32 добавлений и 3 удалений

Просмотреть файл

@ -1097,7 +1097,7 @@ nsPluginHost::InstantiateEmbeddedPlugin(const char *aMimeType, nsIURI* aURL,
const char *value;
bool havedata = NS_SUCCEEDED(pti->GetAttribute("SRC", &value));
if (havedata && !isJava && bCanHandleInternally && !aContent->SrcStreamLoading()) {
NewEmbeddedPluginStream(aURL, nsnull, instance.get());
NewEmbeddedPluginStream(aURL, aContent, instance.get());
}
}
@ -3332,8 +3332,6 @@ nsresult nsPluginHost::NewEmbeddedPluginStream(nsIURI* aURL,
nsObjectLoadingContent *aContent,
nsNPAPIPluginInstance* aInstance)
{
NS_ASSERTION(!aContent || !aInstance, "Don't pass both content and an instance to NewEmbeddedPluginStream!");
nsCOMPtr<nsIStreamListener> listener;
nsresult rv = NewEmbeddedPluginStreamListener(aURL, aContent, aInstance,
getter_AddRefs(listener));

Просмотреть файл

@ -110,6 +110,7 @@ _MOCHITEST_FILES = \
test_instance_unparent2.html \
test_instance_unparent3.html \
test_pluginstream_referer.html \
test_pluginstream_src_referer.html \
plugin-stream-referer.sjs \
test_src_url_change.html \
$(NULL)

Просмотреть файл

@ -1,6 +1,8 @@
function handleRequest(request, response)
{
response.setHeader('Content-Type', 'text/plain', false);
response.setHeader('Cache-Control', 'no-cache', false);
response.setHeader('Content-Type', 'application/x-test', false);
if (request.hasHeader('Referer')) {
response.write('Referer found: ' + request.getHeader('Referer'));
}

Просмотреть файл

@ -0,0 +1,28 @@
<head>
<title>Do plugin stream src requests send the Referer header correctly?</title>
<script type="application/javascript"
src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css"
href="/tests/SimpleTest/test.css" />
<body>
<p id="display"></p>
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
function frameLoaded() {
var testframe = document.getElementById('pluginframe');
var content = testframe.contentDocument.body.innerHTML;
if (!content.length)
return;
is(content, "Referer found: " + window.location);
SimpleTest.finish();
}
</script>
<iframe name="pluginframe" id="pluginframe" onload="frameLoaded()"></iframe>
<embed id="plugin" type="application/x-test" src="plugin-stream-referer.sjs" width="200" height="200" frame="pluginframe"></embed>