nsIContentPolicy should pass the frameelement for loads in frames as

aRequestingNode.  Bug 245836, r=mvl, sr=jst
This commit is contained in:
bzbarsky%mit.edu 2004-07-18 20:02:31 +00:00
Родитель 07cf57d7dd
Коммит 6eda51fef3
1 изменённых файлов: 4 добавлений и 5 удалений

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

@ -5110,16 +5110,15 @@ nsDocShell::InternalLoad(nsIURI * aURI,
// Only abort the load if a content policy listener explicitly vetos it! // Only abort the load if a content policy listener explicitly vetos it!
// //
nsCOMPtr<nsIDOMElement> requestingElement; nsCOMPtr<nsIDOMElement> requestingElement;
// Use nsPIDOMWindow since we _want_ to cross the chrome boundary if needed
nsCOMPtr<nsPIDOMWindow> privateWin(do_QueryInterface(mScriptGlobal));
if (privateWin)
requestingElement = privateWin->GetFrameElementInternal();
PRInt16 shouldLoad = nsIContentPolicy::ACCEPT; PRInt16 shouldLoad = nsIContentPolicy::ACCEPT;
PRUint32 contentType; PRUint32 contentType;
if (IsFrame()) { if (IsFrame()) {
nsCOMPtr<nsIDOMWindowInternal> intWin(do_QueryInterface(mScriptGlobal));
if (intWin)
intWin->GetFrameElement(getter_AddRefs(requestingElement));
#ifdef DEBUG_riceman
NS_ASSERTION(requestingElement, "A frame but no DOM element!?"); NS_ASSERTION(requestingElement, "A frame but no DOM element!?");
#endif
contentType = nsIContentPolicy::TYPE_SUBDOCUMENT; contentType = nsIContentPolicy::TYPE_SUBDOCUMENT;
} else { } else {
contentType = nsIContentPolicy::TYPE_DOCUMENT; contentType = nsIContentPolicy::TYPE_DOCUMENT;