Bug 1270648 part 5 - Setup the sandboxed fullscreen flag and make it work properly. r=smaug

MozReview-Commit-ID: 3EKRbOyXwNi
This commit is contained in:
Xidorn Quan
2016-05-18 09:08:12 +10:00
parent 4c579e3342
commit 1a5da08d6a
4 changed files with 45 additions and 11 deletions

View File

@@ -216,7 +216,12 @@ HTMLIFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
bool aNotify)
{
if (aName == nsGkAtoms::sandbox && aNameSpaceID == kNameSpaceID_None && mFrameLoader) {
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) &&
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.
@@ -258,11 +263,15 @@ HTMLIFrameElement::GetSandboxFlags()
// Macro for updating the flag according to the keywords
#define SANDBOX_KEYWORD(string, atom, flags) \
if (sandboxAttr->Contains(nsGkAtoms::atom, eIgnoreCase)) { out &= ~(flags); }
#include "IframeSandboxKeywordList.h"
#undef SANDBOX_KEYWORD
if (GetParsedAttr(nsGkAtoms::allowfullscreen) ||
GetParsedAttr(nsGkAtoms::mozallowfullscreen)) {
out &= ~SANDBOXED_FULLSCREEN;
}
return out;
#undef SANDBOX_KEYWORD
}
JSObject*