Bug 1123008 - Make loadContext.topFrameElement work in non-e10s (r=smaug)

This commit is contained in:
Bill McCloskey 2015-01-21 16:19:07 -08:00
parent ebdcfaf1cc
commit 273e8f71a3
3 changed files with 19 additions and 7 deletions

View File

@ -12871,9 +12871,16 @@ nsDocShell::GetTopFrameElement(nsIDOMElement** aElement)
win->GetScriptableTop(getter_AddRefs(top));
NS_ENSURE_TRUE(top, NS_ERROR_FAILURE);
// GetFrameElement, /not/ GetScriptableFrameElement -- if |top| is inside
// <iframe mozbrowser>, we want to return the iframe, not null.
return top->GetFrameElement(aElement);
nsCOMPtr<nsPIDOMWindow> piTop = do_QueryInterface(top);
NS_ENSURE_TRUE(piTop, NS_ERROR_FAILURE);
// GetFrameElementInternal, /not/ GetScriptableFrameElement -- if |top| is
// inside <iframe mozbrowser>, we want to return the iframe, not null.
// And we want to cross the content/chrome boundary.
nsCOMPtr<nsIDOMElement> elt =
do_QueryInterface(piTop->GetFrameElementInternal());
elt.forget(aElement);
return NS_OK;
}
NS_IMETHODIMP

View File

@ -35,11 +35,14 @@ interface nsILoadContext : nsISupports
readonly attribute nsIDOMWindow topWindow;
/**
* topFrameElement is the <iframe> or <frame> element which contains the
* topWindow with which the load is associated.
* topFrameElement is the <iframe>, <frame>, or <browser> element which
* contains the topWindow with which the load is associated.
*
* Note that we may have a topFrameElement even when we don't have an
* associatedWindow, if the topFrameElement's content lives out of process.
* topFrameElement is available in single-process and multiprocess contexts.
* Note that topFrameElement may be in chrome even when the nsILoadContext is
* associated with content.
*/
readonly attribute nsIDOMElement topFrameElement;

View File

@ -207,11 +207,13 @@ let NetworkHelper = {
},
/**
* Gets the topFrameElement that is associated with aRequest.
* Gets the topFrameElement that is associated with aRequest. This
* works in single-process and multiprocess contexts. It may cross
* the content/chrome boundary.
*
* @param nsIHttpChannel aRequest
* @returns nsIDOMElement|null
* The top frame element for the given request, if available.
* The top frame element for the given request.
*/
getTopFrameForRequest: function NH_getTopFrameForRequest(aRequest)
{