зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1270648
part 2 - Merge nsContentUtils::ParseSandboxAttributeToFlags into HTMLIFrameElement::GetSandboxFlags. r=smaug
nsContentUtils::ParseSandboxAttributeToFlags is not used anywhere else, and given that sandbox flags would also be affected by allowfullscreen attribute, this function alone could be misused. MozReview-Commit-ID: EzlGQ7iY8WG --HG-- extra : source : 3d58c6e5372e360706045e23c601604c49fc3b43
This commit is contained in:
Родитель
e0aa1f5add
Коммит
0bcdce79ef
|
@ -1346,32 +1346,6 @@ nsContentUtils::GetParserService()
|
|||
return sParserService;
|
||||
}
|
||||
|
||||
/**
|
||||
* A helper function that parses a sandbox attribute (of an <iframe> or
|
||||
* a CSP directive) and converts it to the set of flags used internally.
|
||||
*
|
||||
* @param sandboxAttr the sandbox attribute
|
||||
* @return the set of flags (0 if sandboxAttr is null)
|
||||
*/
|
||||
uint32_t
|
||||
nsContentUtils::ParseSandboxAttributeToFlags(const nsAttrValue* sandboxAttr)
|
||||
{
|
||||
// No sandbox attribute, no sandbox flags.
|
||||
if (!sandboxAttr) { return 0; }
|
||||
|
||||
// Start off by setting all the restriction flags.
|
||||
uint32_t out = SANDBOX_ALL_FLAGS;
|
||||
|
||||
// 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"
|
||||
|
||||
return out;
|
||||
#undef SANDBOX_KEYWORD
|
||||
}
|
||||
|
||||
nsIBidiKeyboard*
|
||||
nsContentUtils::GetBidiKeyboard()
|
||||
{
|
||||
|
|
|
@ -907,15 +907,6 @@ public:
|
|||
const char* aKey,
|
||||
nsXPIDLString& aResult);
|
||||
|
||||
/**
|
||||
* A helper function that parses a sandbox attribute (of an <iframe> or
|
||||
* a CSP directive) and converts it to the set of flags used internally.
|
||||
*
|
||||
* @param sandboxAttr the sandbox attribute
|
||||
* @return the set of flags (0 if sandboxAttr is null)
|
||||
*/
|
||||
static uint32_t ParseSandboxAttributeToFlags(const nsAttrValue* sandboxAttr);
|
||||
|
||||
/**
|
||||
* Helper function that generates a UUID.
|
||||
*/
|
||||
|
|
|
@ -247,7 +247,22 @@ uint32_t
|
|||
HTMLIFrameElement::GetSandboxFlags()
|
||||
{
|
||||
const nsAttrValue* sandboxAttr = GetParsedAttr(nsGkAtoms::sandbox);
|
||||
return nsContentUtils::ParseSandboxAttributeToFlags(sandboxAttr);
|
||||
// No sandbox attribute, no sandbox flags.
|
||||
if (!sandboxAttr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Start off by setting all the restriction flags.
|
||||
uint32_t out = SANDBOX_ALL_FLAGS;
|
||||
|
||||
// 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"
|
||||
|
||||
return out;
|
||||
#undef SANDBOX_KEYWORD
|
||||
}
|
||||
|
||||
JSObject*
|
||||
|
|
Загрузка…
Ссылка в новой задаче