OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011 Google, Inc. All rights reserved. | 2 * Copyright (C) 2011 Google, Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1414 } | 1414 } |
1415 | 1415 |
1416 ContentSecurityPolicy::~ContentSecurityPolicy() | 1416 ContentSecurityPolicy::~ContentSecurityPolicy() |
1417 { | 1417 { |
1418 } | 1418 } |
1419 | 1419 |
1420 void ContentSecurityPolicy::copyStateFrom(const ContentSecurityPolicy* other) | 1420 void ContentSecurityPolicy::copyStateFrom(const ContentSecurityPolicy* other) |
1421 { | 1421 { |
1422 ASSERT(m_policies.isEmpty()); | 1422 ASSERT(m_policies.isEmpty()); |
1423 for (CSPDirectiveListVector::const_iterator iter = other->m_policies.begin() ; iter != other->m_policies.end(); ++iter) | 1423 for (CSPDirectiveListVector::const_iterator iter = other->m_policies.begin() ; iter != other->m_policies.end(); ++iter) |
1424 didReceiveHeader((*iter)->header(), (*iter)->headerType()); | 1424 addPolicyFromHeaderValue((*iter)->header(), (*iter)->headerType()); |
1425 } | 1425 } |
1426 | 1426 |
1427 void ContentSecurityPolicy::didReceiveHeader(const String& header, HeaderType ty pe) | 1427 void ContentSecurityPolicy::didReceiveHeader(const String& header, HeaderType ty pe) |
1428 { | 1428 { |
1429 // ContentSecurityPolicy should be mutable only it has a browsing context. | |
1430 ASSERT(!m_scriptExecutionContext->isDocument() || toDocument(m_scriptExecuti onContext)->frame()); | |
Mike West
2013/07/22 14:39:42
I don't understand this assertion. Could you expla
| |
1431 addPolicyFromHeaderValue(header, type); | |
1432 } | |
1433 | |
1434 void ContentSecurityPolicy::addPolicyFromHeaderValue(const String& header, Heade rType type) | |
1435 { | |
1429 if (m_scriptExecutionContext->isDocument()) { | 1436 if (m_scriptExecutionContext->isDocument()) { |
1430 Document* document = toDocument(m_scriptExecutionContext); | 1437 Document* document = toDocument(m_scriptExecutionContext); |
1431 if (type == PrefixedReport || type == PrefixedEnforce) | 1438 if (type == PrefixedReport || type == PrefixedEnforce) |
1432 UseCounter::countDeprecation(document, getUseCounterType(type)); | 1439 UseCounter::countDeprecation(document, getUseCounterType(type)); |
1433 else | 1440 else |
1434 UseCounter::count(document, getUseCounterType(type)); | 1441 UseCounter::count(document, getUseCounterType(type)); |
1435 } | 1442 } |
1436 | 1443 |
1437 Vector<UChar> characters; | 1444 Vector<UChar> characters; |
1438 header.appendTo(characters); | 1445 header.appendTo(characters); |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1872 { | 1879 { |
1873 if (context && context->isDocument()) { | 1880 if (context && context->isDocument()) { |
1874 Document* document = toDocument(context); | 1881 Document* document = toDocument(context); |
1875 if (document->frame()) | 1882 if (document->frame()) |
1876 return document->frame()->script()->shouldBypassMainWorldContentSecu rityPolicy(); | 1883 return document->frame()->script()->shouldBypassMainWorldContentSecu rityPolicy(); |
1877 } | 1884 } |
1878 return false; | 1885 return false; |
1879 } | 1886 } |
1880 | 1887 |
1881 } | 1888 } |
OLD | NEW |