OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 m_workerClients->reattachThread(); | 96 m_workerClients->reattachThread(); |
97 m_thread->setWorkerInspectorController(m_workerInspectorController.get()); | 97 m_thread->setWorkerInspectorController(m_workerInspectorController.get()); |
98 } | 98 } |
99 | 99 |
100 WorkerGlobalScope::~WorkerGlobalScope() | 100 WorkerGlobalScope::~WorkerGlobalScope() |
101 { | 101 { |
102 } | 102 } |
103 | 103 |
104 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic
y, ContentSecurityPolicyHeaderType contentSecurityPolicyType) | 104 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic
y, ContentSecurityPolicyHeaderType contentSecurityPolicyType) |
105 { | 105 { |
106 setContentSecurityPolicy(ContentSecurityPolicy::create(this)); | 106 // FIXME: This doesn't match the CSP2 spec's Worker behavior (see https://w3
c.github.io/webappsec/specs/content-security-policy/#processing-model-workers) |
107 contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType,
ContentSecurityPolicyHeaderSourceHTTP); | 107 RefPtr<ContentSecurityPolicy> csp = ContentSecurityPolicy::create(); |
| 108 csp->didReceiveHeader(policy, contentSecurityPolicyType, ContentSecurityPoli
cyHeaderSourceHTTP); |
| 109 csp->bindToExecutionContext(executionContext()); |
| 110 setContentSecurityPolicy(csp); |
108 } | 111 } |
109 | 112 |
110 ExecutionContext* WorkerGlobalScope::executionContext() const | 113 ExecutionContext* WorkerGlobalScope::executionContext() const |
111 { | 114 { |
112 return const_cast<WorkerGlobalScope*>(this); | 115 return const_cast<WorkerGlobalScope*>(this); |
113 } | 116 } |
114 | 117 |
115 const KURL& WorkerGlobalScope::virtualURL() const | 118 const KURL& WorkerGlobalScope::virtualURL() const |
116 { | 119 { |
117 return m_url; | 120 return m_url; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 visitor->trace(m_workerInspectorController); | 335 visitor->trace(m_workerInspectorController); |
333 visitor->trace(m_eventQueue); | 336 visitor->trace(m_eventQueue); |
334 visitor->trace(m_workerClients); | 337 visitor->trace(m_workerClients); |
335 visitor->trace(m_messageStorage); | 338 visitor->trace(m_messageStorage); |
336 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); | 339 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); |
337 ExecutionContext::trace(visitor); | 340 ExecutionContext::trace(visitor); |
338 EventTargetWithInlineData::trace(visitor); | 341 EventTargetWithInlineData::trace(visitor); |
339 } | 342 } |
340 | 343 |
341 } // namespace blink | 344 } // namespace blink |
OLD | NEW |