mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Bug 1341657 - Properly deal with not having a frame element in nsDocShell::InternalLoad(); r=smaug
This commit is contained in:
parent
4f4a529bd2
commit
8f5e5aeae0
14
docshell/base/crashtests/1341657.html
Normal file
14
docshell/base/crashtests/1341657.html
Normal file
@ -0,0 +1,14 @@
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
o1 = document.createElement("script");
|
||||
o2 = document.implementation.createDocument('', '', null);
|
||||
o3 = document.createElement("iframe");
|
||||
document.documentElement.appendChild(o3);
|
||||
o4 = o3.contentWindow;
|
||||
o5 = document.createTextNode('o2.adoptNode(o3); try { o4.location = "" } catch(e) {}');
|
||||
o1.appendChild(o5);
|
||||
document.documentElement.appendChild(o1);
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
@ -14,3 +14,4 @@ load 678872-1.html
|
||||
skip-if(Android) pref(dom.disable_open_during_load,false) load 914521.html
|
||||
pref(browser.send_pings,true) load 1257730-1.html
|
||||
load 1331295.html
|
||||
load 1341657.html
|
||||
|
@ -9892,9 +9892,14 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
||||
if (IsFrame() && !isTargetTopLevelDocShell) {
|
||||
nsCOMPtr<Element> requestingElement =
|
||||
mScriptGlobal->AsOuter()->GetFrameElementInternal();
|
||||
NS_ASSERTION(requestingElement, "A frame but no DOM element!?");
|
||||
contentType = requestingElement->IsHTMLElement(nsGkAtoms::iframe) ?
|
||||
nsIContentPolicy::TYPE_INTERNAL_IFRAME : nsIContentPolicy::TYPE_INTERNAL_FRAME;
|
||||
if (requestingElement) {
|
||||
contentType = requestingElement->IsHTMLElement(nsGkAtoms::iframe) ?
|
||||
nsIContentPolicy::TYPE_INTERNAL_IFRAME : nsIContentPolicy::TYPE_INTERNAL_FRAME;
|
||||
} else {
|
||||
// If we have lost our frame element by now, just assume we're
|
||||
// an iframe since that's more common.
|
||||
contentType = nsIContentPolicy::TYPE_INTERNAL_IFRAME;
|
||||
}
|
||||
} else {
|
||||
contentType = nsIContentPolicy::TYPE_DOCUMENT;
|
||||
isTargetTopLevelDocShell = true;
|
||||
@ -9924,13 +9929,15 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
||||
requestingContext = requestingElement;
|
||||
|
||||
#ifdef DEBUG
|
||||
// Get the docshell type for requestingElement.
|
||||
nsCOMPtr<nsIDocument> requestingDoc = requestingElement->OwnerDoc();
|
||||
nsCOMPtr<nsIDocShell> elementDocShell = requestingDoc->GetDocShell();
|
||||
if (requestingElement) {
|
||||
// Get the docshell type for requestingElement.
|
||||
nsCOMPtr<nsIDocument> requestingDoc = requestingElement->OwnerDoc();
|
||||
nsCOMPtr<nsIDocShell> elementDocShell = requestingDoc->GetDocShell();
|
||||
|
||||
// requestingElement docshell type = current docshell type.
|
||||
MOZ_ASSERT(mItemType == elementDocShell->ItemType(),
|
||||
"subframes should have the same docshell type as their parent");
|
||||
// requestingElement docshell type = current docshell type.
|
||||
MOZ_ASSERT(mItemType == elementDocShell->ItemType(),
|
||||
"subframes should have the same docshell type as their parent");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user