OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/testing/NullExecutionContext.h" | 5 #include "core/testing/NullExecutionContext.h" |
6 | 6 |
7 #include "core/dom/ExecutionContextTask.h" | 7 #include "core/dom/ExecutionContextTask.h" |
8 #include "core/events/Event.h" | 8 #include "core/events/Event.h" |
9 #include "core/frame/DOMTimer.h" | 9 #include "core/frame/DOMTimer.h" |
10 #include "core/frame/csp/ContentSecurityPolicy.h" | 10 #include "core/frame/csp/ContentSecurityPolicy.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 void NullExecutionContext::PostTask(TaskType, | 32 void NullExecutionContext::PostTask(TaskType, |
33 const WebTraceLocation&, | 33 const WebTraceLocation&, |
34 std::unique_ptr<ExecutionContextTask>, | 34 std::unique_ptr<ExecutionContextTask>, |
35 const String&) {} | 35 const String&) {} |
36 | 36 |
37 void NullExecutionContext::SetIsSecureContext(bool is_secure_context) { | 37 void NullExecutionContext::SetIsSecureContext(bool is_secure_context) { |
38 is_secure_context_ = is_secure_context; | 38 is_secure_context_ = is_secure_context; |
39 } | 39 } |
40 | 40 |
41 bool NullExecutionContext::IsSecureContext( | 41 bool NullExecutionContext::IsSecureContext(String& error_message) const { |
42 String& error_message, | |
43 const SecureContextCheck privilege_context_check) const { | |
44 if (!is_secure_context_) | 42 if (!is_secure_context_) |
45 error_message = "A secure context is required"; | 43 error_message = "A secure context is required"; |
46 return is_secure_context_; | 44 return is_secure_context_; |
47 } | 45 } |
48 | 46 |
49 void NullExecutionContext::SetUpSecurityContext() { | 47 void NullExecutionContext::SetUpSecurityContext() { |
50 ContentSecurityPolicy* policy = ContentSecurityPolicy::Create(); | 48 ContentSecurityPolicy* policy = ContentSecurityPolicy::Create(); |
51 SecurityContext::SetSecurityOrigin(SecurityOrigin::Create(url_)); | 49 SecurityContext::SetSecurityOrigin(SecurityOrigin::Create(url_)); |
52 policy->BindToExecutionContext(this); | 50 policy->BindToExecutionContext(this); |
53 SecurityContext::SetContentSecurityPolicy(policy); | 51 SecurityContext::SetContentSecurityPolicy(policy); |
54 } | 52 } |
55 | 53 |
56 } // namespace blink | 54 } // namespace blink |
OLD | NEW |