mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 23:23:33 +00:00
Bug 949435, part 4 - Update nsFrameLoader to handle SVG iframe. r=bz
This commit is contained in:
parent
21f47f8140
commit
e1b46c9303
@ -86,6 +86,7 @@
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/dom/HTMLIFrameElement.h"
|
||||
#include "mozilla/dom/SVGIFrameElement.h"
|
||||
#include "nsSandboxFlags.h"
|
||||
#include "JavaScriptParent.h"
|
||||
|
||||
@ -318,7 +319,8 @@ nsFrameLoader::LoadFrame()
|
||||
|
||||
nsAutoString src;
|
||||
|
||||
bool isSrcdoc = mOwnerContent->IsHTML(nsGkAtoms::iframe) &&
|
||||
bool isSrcdoc = (mOwnerContent->IsHTML(nsGkAtoms::iframe) ||
|
||||
mOwnerContent->IsSVG(nsGkAtoms::iframe)) &&
|
||||
mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::srcdoc);
|
||||
if (isSrcdoc) {
|
||||
src.AssignLiteral("about:srcdoc");
|
||||
@ -518,7 +520,8 @@ nsFrameLoader::ReallyStartLoadingInternal()
|
||||
nsCOMPtr<nsIURI> referrer;
|
||||
|
||||
nsAutoString srcdoc;
|
||||
bool isSrcdoc = mOwnerContent->IsHTML(nsGkAtoms::iframe) &&
|
||||
bool isSrcdoc = (mOwnerContent->IsHTML(nsGkAtoms::iframe) ||
|
||||
mOwnerContent->IsSVG(nsGkAtoms::iframe)) &&
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::srcdoc,
|
||||
srcdoc);
|
||||
|
||||
@ -1603,8 +1606,13 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||
// Apply sandbox flags even if our owner is not an iframe, as this copies
|
||||
// flags from our owning content's owning document.
|
||||
uint32_t sandboxFlags = 0;
|
||||
HTMLIFrameElement* iframe = HTMLIFrameElement::FromContent(mOwnerContent);
|
||||
if (iframe) {
|
||||
if (!mOwnerContent->IsSVG(nsGkAtoms::iframe)) {
|
||||
HTMLIFrameElement* iframe = HTMLIFrameElement::FromContent(mOwnerContent);
|
||||
if (iframe) {
|
||||
sandboxFlags = iframe->GetSandboxFlags();
|
||||
}
|
||||
} else {
|
||||
SVGIFrameElement* iframe = static_cast<SVGIFrameElement*>(mOwnerContent);
|
||||
sandboxFlags = iframe->GetSandboxFlags();
|
||||
}
|
||||
ApplySandboxFlags(sandboxFlags);
|
||||
@ -1620,7 +1628,8 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||
nsAutoString frameName;
|
||||
|
||||
int32_t namespaceID = mOwnerContent->GetNameSpaceID();
|
||||
if (namespaceID == kNameSpaceID_XHTML && !mOwnerContent->IsInHTMLDocument()) {
|
||||
if ((namespaceID == kNameSpaceID_XHTML || namespaceID == kNameSpaceID_SVG)
|
||||
&& !mOwnerContent->IsInHTMLDocument()) {
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::id, frameName);
|
||||
} else {
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, frameName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user