mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix for bug 540443 (Change one argument of nsContentUtils::CheckSameOrigin from nsIDOMNode to nsINode). r=bz.
This commit is contained in:
parent
6289e634b5
commit
648f658133
@ -393,7 +393,7 @@ public:
|
|||||||
* Never call this function with the first node provided by script, it
|
* Never call this function with the first node provided by script, it
|
||||||
* must always be known to be a 'real' node!
|
* must always be known to be a 'real' node!
|
||||||
*/
|
*/
|
||||||
static nsresult CheckSameOrigin(nsIDOMNode* aTrustedNode,
|
static nsresult CheckSameOrigin(nsINode* aTrustedNode,
|
||||||
nsIDOMNode* aUnTrustedNode);
|
nsIDOMNode* aUnTrustedNode);
|
||||||
|
|
||||||
// Check if the (JS) caller can access aNode.
|
// Check if the (JS) caller can access aNode.
|
||||||
|
@ -980,7 +980,7 @@ nsContentUtils::IsCallerTrustedForCapability(const char* aCapability)
|
|||||||
*/
|
*/
|
||||||
// static
|
// static
|
||||||
nsresult
|
nsresult
|
||||||
nsContentUtils::CheckSameOrigin(nsIDOMNode *aTrustedNode,
|
nsContentUtils::CheckSameOrigin(nsINode *aTrustedNode,
|
||||||
nsIDOMNode *aUnTrustedNode)
|
nsIDOMNode *aUnTrustedNode)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aTrustedNode, "There must be a trusted node");
|
NS_PRECONDITION(aTrustedNode, "There must be a trusted node");
|
||||||
@ -996,13 +996,12 @@ nsContentUtils::CheckSameOrigin(nsIDOMNode *aTrustedNode,
|
|||||||
/*
|
/*
|
||||||
* Get hold of each node's principal
|
* Get hold of each node's principal
|
||||||
*/
|
*/
|
||||||
nsCOMPtr<nsINode> trustedNode = do_QueryInterface(aTrustedNode);
|
|
||||||
nsCOMPtr<nsINode> unTrustedNode = do_QueryInterface(aUnTrustedNode);
|
nsCOMPtr<nsINode> unTrustedNode = do_QueryInterface(aUnTrustedNode);
|
||||||
|
|
||||||
// Make sure these are both real nodes
|
// Make sure these are both real nodes
|
||||||
NS_ENSURE_TRUE(trustedNode && unTrustedNode, NS_ERROR_UNEXPECTED);
|
NS_ENSURE_TRUE(aTrustedNode && unTrustedNode, NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
nsIPrincipal* trustedPrincipal = trustedNode->NodePrincipal();
|
nsIPrincipal* trustedPrincipal = aTrustedNode->NodePrincipal();
|
||||||
nsIPrincipal* unTrustedPrincipal = unTrustedNode->NodePrincipal();
|
nsIPrincipal* unTrustedPrincipal = unTrustedNode->NodePrincipal();
|
||||||
|
|
||||||
if (trustedPrincipal == unTrustedPrincipal) {
|
if (trustedPrincipal == unTrustedPrincipal) {
|
||||||
|
@ -147,8 +147,7 @@ NS_IMETHODIMP nsTreeWalker::SetCurrentNode(nsIDOMNode * aCurrentNode)
|
|||||||
NS_ENSURE_TRUE(aCurrentNode, NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
NS_ENSURE_TRUE(aCurrentNode, NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||||
|
|
||||||
// This QI is dumb, but this shouldn't be a critical operation
|
// This QI is dumb, but this shouldn't be a critical operation
|
||||||
nsCOMPtr<nsIDOMNode> domRoot = do_QueryInterface(mRoot);
|
nsresult rv = nsContentUtils::CheckSameOrigin(mRoot, aCurrentNode);
|
||||||
nsresult rv = nsContentUtils::CheckSameOrigin(domRoot, aCurrentNode);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
mCurrentNode = do_QueryInterface(aCurrentNode);
|
mCurrentNode = do_QueryInterface(aCurrentNode);
|
||||||
|
@ -287,9 +287,7 @@ nsXULCommandDispatcher::AddCommandUpdater(nsIDOMElement* aElement,
|
|||||||
if (! aElement)
|
if (! aElement)
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> doc(do_QueryInterface(mDocument));
|
nsresult rv = nsContentUtils::CheckSameOrigin(mDocument, aElement);
|
||||||
|
|
||||||
nsresult rv = nsContentUtils::CheckSameOrigin(doc, aElement);
|
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -782,15 +782,13 @@ nsXULDocument::AddBroadcastListenerFor(nsIDOMElement* aBroadcaster,
|
|||||||
NS_ENSURE_ARG(aBroadcaster && aListener);
|
NS_ENSURE_ARG(aBroadcaster && aListener);
|
||||||
|
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
nsContentUtils::CheckSameOrigin(static_cast<nsDocument *>(this),
|
nsContentUtils::CheckSameOrigin(this, aBroadcaster);
|
||||||
aBroadcaster);
|
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = nsContentUtils::CheckSameOrigin(static_cast<nsDocument *>(this),
|
rv = nsContentUtils::CheckSameOrigin(this, aListener);
|
||||||
aListener);
|
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
|
Loading…
Reference in New Issue
Block a user