Bug 1283526 part 2 - Remove fullscreen sandbox flag. r?smaug
MozReview-Commit-ID: 5qH4gZxvNQz
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -2508,20 +2508,16 @@ nsDocShell::GetFullscreenAllowed(bool* a
if (mFullscreenAllowed != CHECK_ATTRIBUTES) {
*aFullscreenAllowed = (mFullscreenAllowed == PARENT_ALLOWS);
return NS_OK;
}
// Assume false until we determine otherwise...
*aFullscreenAllowed = false;
- // If it is sandboxed, fullscreen is not allowed.
- if (mSandboxFlags & SANDBOXED_FULLSCREEN) {
- return NS_OK;
- }
nsCOMPtr<nsPIDOMWindowOuter> win = GetWindow();
if (!win) {
return NS_OK;
}
nsCOMPtr<Element> frameElement = win->GetFrameElementInternal();
if (frameElement && !frameElement->IsXULElement()) {
// We do not allow document inside any containing element other
// than iframe to enter fullscreen.
--- a/dom/base/nsSandboxFlags.h
+++ b/dom/base/nsSandboxFlags.h
@@ -80,38 +80,33 @@ const unsigned long SANDBOXED_AUTOMATIC_
/**
* This flag prevents URL schemes that use storage areas from being able to
* access the origin's data.
*/
// We don't have an explicit representation of this one, apparently?
// const unsigned long SANDBOXED_STORAGE_AREA_URLS = 0x200;
/**
- * This flag prevents content from using the requestFullscreen() method.
- */
-const unsigned long SANDBOXED_FULLSCREEN = 0x400;
-
-/**
* This flag blocks the document from changing document.domain.
*/
-const unsigned long SANDBOXED_DOMAIN = 0x800;
+const unsigned long SANDBOXED_DOMAIN = 0x400;
/**
* This flag prevents content from using window.alert(), window.confirm(),
* window.print(), window.prompt() and the beforeunload event from putting up
* dialogs.
*/
-const unsigned long SANDBOXED_MODALS = 0x1000;
+const unsigned long SANDBOXED_MODALS = 0x800;
/**
* This flag prevents content from escaping the sandbox by ensuring that any
* auxiliary browsing context it creates inherits the content's active
* sandboxing flag set.
*/
-const unsigned long SANDBOX_PROPAGATES_TO_AUXILIARY_BROWSING_CONTEXTS = 0x2000;
+const unsigned long SANDBOX_PROPAGATES_TO_AUXILIARY_BROWSING_CONTEXTS = 0x1000;
/**
* This flag prevents locking screen orientation.
*/
-const unsigned long SANDBOXED_ORIENTATION_LOCK = 0x4000;
+const unsigned long SANDBOXED_ORIENTATION_LOCK = 0x2000;
-const unsigned long SANDBOX_ALL_FLAGS = 0x7FFF;
+const unsigned long SANDBOX_ALL_FLAGS = 0x3FFF;
#endif
--- a/dom/html/HTMLIFrameElement.cpp
+++ b/dom/html/HTMLIFrameElement.cpp
@@ -199,21 +199,17 @@ HTMLIFrameElement::SetAttr(int32_t aName
return NS_OK;
}
nsresult
HTMLIFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
bool aNotify)
{
- if ((aName == nsGkAtoms::sandbox ||
- // The allowfullscreen attribute affects the sandboxed fullscreen
- // flag, thus we should also reapply it if that is changed.
- aName == nsGkAtoms::allowfullscreen ||
- aName == nsGkAtoms::mozallowfullscreen) &&
+ if (aName == nsGkAtoms::sandbox &&
aNameSpaceID == kNameSpaceID_None && mFrameLoader) {
// If we have an nsFrameLoader, apply the new sandbox flags.
// Since this is called after the setter, the sandbox flags have
// alreay been updated.
mFrameLoader->ApplySandboxFlags(GetSandboxFlags());
}
return nsGenericHTMLFrameElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aNotify);
@@ -239,25 +235,17 @@ HTMLIFrameElement::UnsetAttr(int32_t aNa
uint32_t
HTMLIFrameElement::GetSandboxFlags()
{
const nsAttrValue* sandboxAttr = GetParsedAttr(nsGkAtoms::sandbox);
// No sandbox attribute, no sandbox flags.
if (!sandboxAttr) {
return SANDBOXED_NONE;
}
-
- uint32_t out = nsContentUtils::ParseSandboxAttributeToFlags(sandboxAttr);
-
- if (GetParsedAttr(nsGkAtoms::allowfullscreen) ||
- GetParsedAttr(nsGkAtoms::mozallowfullscreen)) {
- out &= ~SANDBOXED_FULLSCREEN;
- }
-
- return out;
+ return nsContentUtils::ParseSandboxAttributeToFlags(sandboxAttr);
}
JSObject*
HTMLIFrameElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return HTMLIFrameElementBinding::Wrap(aCx, this, aGivenProto);
}