// policy = directive-list // directive-list = [ directive *( ";" [ directive ] ) ] // void CSPDirectiveList::parse(const UChar* begin, const UChar* end) { m_header = String(begin, end - begin); if (begin == end) return; const UChar* position = begin; while (position < end) { const UChar* directiveBegin = position; skipUntil<UChar>(position, end, ';'); String name, value; if (parseDirective(directiveBegin, position, name, value)) { ASSERT(!name.isEmpty()); addDirective(name, value); } ASSERT(position == end || *position == ';'); skipExactly<UChar>(position, end, ';'); } }
// policy = directive-list // directive-list = [ directive *( ";" [ directive ] ) ] // void ContentSecurityPolicy::parse(const String& policy) { ASSERT(!m_havePolicy); if (policy.isEmpty()) return; const UChar* position = policy.characters(); const UChar* end = position + policy.length(); while (position < end) { const UChar* directiveBegin = position; skipUtil(position, end, ';'); String name, value; if (parseDirective(directiveBegin, position, name, value)) { ASSERT(!name.isEmpty()); addDirective(name, value); } ASSERT(position == end || *position == ';'); skipExactly(position, end, ';'); } }