author | Olli Pettay <Olli.Pettay@helsinki.fi> |
Thu, 19 Jul 2012 10:43:33 +0300 | |
changeset 99646 | 6d8456a77e57d91a4a246ed2b5ffad77f6a2cea7 |
parent 99645 | 768eb7111521672de28ccfc2de60c50a4bf1d88e |
child 99647 | 4d5060c3cc623b1d75160eba6a51d6bd6d09332a |
push id | 23144 |
push user | opettay@mozilla.com |
push date | Thu, 19 Jul 2012 08:19:00 +0000 |
treeherder | mozilla-central@6d8456a77e57 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mrbkap |
bugs | 770429 |
milestone | 17.0a1 |
first release with | nightly linux32
6d8456a77e57
/
17.0a1
/
20120719030543
/
files
nightly linux64
6d8456a77e57
/
17.0a1
/
20120719030543
/
files
nightly mac
6d8456a77e57
/
17.0a1
/
20120719030543
/
files
nightly win32
6d8456a77e57
/
17.0a1
/
20120719030543
/
files
nightly win64
6d8456a77e57
/
17.0a1
/
20120719030543
/
files
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
17.0a1
/
20120719030543
/
pushlog to previous
nightly linux64
17.0a1
/
20120719030543
/
pushlog to previous
nightly mac
17.0a1
/
20120719030543
/
pushlog to previous
nightly win32
17.0a1
/
20120719030543
/
pushlog to previous
nightly win64
17.0a1
/
20120719030543
/
pushlog to previous
|
--- a/dom/base/nsLocation.cpp +++ b/dom/base/nsLocation.cpp @@ -32,16 +32,17 @@ #include "nsDOMError.h" #include "nsDOMClassInfoID.h" #include "nsCRT.h" #include "nsIProtocolHandler.h" #include "nsReadableUtils.h" #include "nsITextToSubURI.h" #include "nsJSUtils.h" #include "jsfriendapi.h" +#include "nsContentUtils.h" static nsresult GetContextFromStack(nsIJSContextStack *aStack, JSContext **aContext) { nsCOMPtr<nsIJSContextStackIterator> iterator(do_CreateInstance("@mozilla.org/js/xpc/ContextStackIterator;1")); NS_ENSURE_TRUE(iterator, NS_ERROR_FAILURE); @@ -163,28 +164,34 @@ GetFrameDocument(JSContext *cx, JSStackF nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc); return doc.forget(); } nsresult nsLocation::CheckURL(nsIURI* aURI, nsIDocShellLoadInfo** aLoadInfo) { *aLoadInfo = nsnull; + JSContext* cx; + if ((cx = nsContentUtils::GetCurrentJSContext())) { + nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); + NS_ENSURE_STATE(ssm); + // Check to see if URI is allowed. + nsresult rv = ssm->CheckLoadURIFromScript(cx, aURI); + NS_ENSURE_SUCCESS(rv, rv); + } nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mDocShell)); NS_ENSURE_TRUE(docShell, NS_ERROR_NOT_AVAILABLE); nsresult rv; // Get JSContext from stack. nsCOMPtr<nsIJSContextStack> stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1", &rv)); NS_ENSURE_SUCCESS(rv, rv); - JSContext *cx; - NS_ENSURE_SUCCESS(GetContextFromStack(stack, &cx), NS_ERROR_FAILURE); nsCOMPtr<nsISupports> owner; nsCOMPtr<nsIURI> sourceURI; if (cx) { // No cx means that there's no JS running, or at least no JS that // was run through code that properly pushed a context onto the