зеркало из https://github.com/mozilla/gecko-dev.git
Back out dcf31efc8c12 and 79c9926f0f45 (bug 702439) to investigate the effects on the browser-chrome leak
This commit is contained in:
Родитель
24b4a80799
Коммит
3d87aaa765
|
@ -55,8 +55,6 @@
|
|||
#include "nsIAsyncVerifyRedirectCallback.h"
|
||||
#include "nsAsyncRedirectVerifyHelper.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -286,28 +284,10 @@ CSPService::AsyncOnChannelRedirect(nsIChannel *oldChannel,
|
|||
// the redirect is permitted, so propagate the Content Security Policy
|
||||
// and load type to the redirecting channel
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIWritablePropertyBag2> props2 = do_QueryInterface(newChannel);
|
||||
if (props2) {
|
||||
rv = props2->SetPropertyAsInterface(NS_CHANNEL_PROP_CHANNEL_POLICY,
|
||||
channelPolicy);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIWritablePropertyBag2> props2 = do_QueryInterface(newChannel, &rv);
|
||||
if (props2)
|
||||
props2->SetPropertyAsInterface(NS_CHANNEL_PROP_CHANNEL_POLICY,
|
||||
channelPolicy);
|
||||
|
||||
// The redirecting channel isn't a writable property bag, we won't be able
|
||||
// to enforce the load policy if it redirects again, so we stop it now.
|
||||
nsXPIDLString message;
|
||||
nsCAutoString newUriSpec;
|
||||
newUri->GetSpec(newUriSpec);
|
||||
const PRUnichar *formatParams[] = { NS_ConvertUTF8toUTF16(newUriSpec).get() };
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
|
||||
"InvalidRedirectChannelWarning",
|
||||
formatParams, 1, nsnull, EmptyString(),
|
||||
0, 0, nsIScriptError::warningFlag,
|
||||
"Redirect Error");
|
||||
}
|
||||
|
||||
return NS_BINDING_FAILED;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -528,9 +528,6 @@ _TEST_FILES2 = \
|
|||
test_bug693875.html \
|
||||
test_nodelist_holes.html \
|
||||
test_xhr_abort_after_load.html \
|
||||
test_bug702439.html \
|
||||
test_bug702439.html^headers^ \
|
||||
file_bug702439.html \
|
||||
$(NULL)
|
||||
|
||||
_CHROME_FILES = \
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<html>
|
||||
<!--
|
||||
This document is a child frame of a CSP document and the
|
||||
test verifies that it is permitted to run javascript: URLs
|
||||
if the parent has a policy that allows them.
|
||||
-->
|
||||
<body onload="document.getElementById('a').click()">
|
||||
<a id="a" href="javascript:parent.javascript_link_ran = true;
|
||||
parent.checkResult();">click</a>
|
||||
</body>
|
||||
</html>
|
|
@ -1,32 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=702439
|
||||
|
||||
This test verifies that child iframes of CSP documents are
|
||||
permitted to execute javascript: URLs assuming the policy
|
||||
allows this.
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 428847</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
var javascript_link_ran = false;
|
||||
|
||||
// check that the script in the child frame's javascript: URL ran
|
||||
function checkResult()
|
||||
{
|
||||
is(javascript_link_ran, true,
|
||||
"javascript URL didn't execute");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
<iframe id="i" src="file_bug702439.html"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -1 +0,0 @@
|
|||
X-Content-Security-Policy: default-src *; options inline-script
|
|
@ -115,7 +115,7 @@ nsIJSONEncodeDeprecatedWarning=nsIJSON.encode is deprecated. Please use JSON.st
|
|||
nsIDOMWindowInternalWarning=Use of nsIDOMWindowInternal is deprecated. Use nsIDOMWindow instead.
|
||||
InputEncodingWarning=Use of inputEncoding is deprecated.
|
||||
GlobalStorageWarning=Use of globalStorage is deprecated. Please use localStorage instead.
|
||||
InvalidRedirectChannelWarning=Unable to redirect to %S because the channel doesn't implement nsIWritablePropertyBag2.FullScreenDeniedDisabled=Request for full-screen was denied because full-screen API is disabled by user preference.
|
||||
FullScreenDeniedDisabled=Request for full-screen was denied because full-screen API is disabled by user preference.
|
||||
FullScreenDeniedPlugins=Request for full-screen was denied because a document on this page contains a windowed plugin.
|
||||
FullScreenDeniedHidden=Request for full-screen was denied because the document is no longer visible.
|
||||
FullScreenDeniedIframeDisallowed=Request for full-screen was denied because at least one of the document's containing iframes does not have a "mozallowfullscreen" attribute.
|
||||
|
|
|
@ -232,7 +232,7 @@ NS_NewChannel(nsIChannel **result,
|
|||
if (loadFlags != nsIRequest::LOAD_NORMAL)
|
||||
rv |= chan->SetLoadFlags(loadFlags);
|
||||
if (channelPolicy) {
|
||||
nsCOMPtr<nsIWritablePropertyBag2> props = do_QueryInterface(chan);
|
||||
nsCOMPtr<nsIWritablePropertyBag2> props = do_QueryInterface(chan, &rv);
|
||||
if (props) {
|
||||
props->SetPropertyAsInterface(NS_CHANNEL_PROP_CHANNEL_POLICY,
|
||||
channelPolicy);
|
||||
|
|
Загрузка…
Ссылка в новой задаче