| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/workers/WorkletGlobalScope.h" | 5 #include "core/workers/WorkletGlobalScope.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include "bindings/core/v8/SourceLocation.h" | 8 #include "bindings/core/v8/SourceLocation.h" |
| 9 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 9 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| 10 #include "core/inspector/MainThreadDebugger.h" | 10 #include "core/inspector/MainThreadDebugger.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 void WorkletGlobalScope::DisableEval(const String& error_message) { | 54 void WorkletGlobalScope::DisableEval(const String& error_message) { |
| 55 script_controller_->DisableEval(error_message); | 55 script_controller_->DisableEval(error_message); |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool WorkletGlobalScope::IsJSExecutionForbidden() const { | 58 bool WorkletGlobalScope::IsJSExecutionForbidden() const { |
| 59 return script_controller_->IsExecutionForbidden(); | 59 return script_controller_->IsExecutionForbidden(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 bool WorkletGlobalScope::IsSecureContext( | 62 bool WorkletGlobalScope::IsSecureContext(String& error_message) const { |
| 63 String& error_message, | |
| 64 const SecureContextCheck privilege_context_check) const { | |
| 65 // Until there are APIs that are available in worklets and that | 63 // Until there are APIs that are available in worklets and that |
| 66 // require a privileged context test that checks ancestors, just do | 64 // require a privileged context test that checks ancestors, just do |
| 67 // a simple check here. | 65 // a simple check here. |
| 68 if (GetSecurityOrigin()->IsPotentiallyTrustworthy()) | 66 if (GetSecurityOrigin()->IsPotentiallyTrustworthy()) |
| 69 return true; | 67 return true; |
| 70 error_message = GetSecurityOrigin()->IsPotentiallyTrustworthyErrorMessage(); | 68 error_message = GetSecurityOrigin()->IsPotentiallyTrustworthyErrorMessage(); |
| 71 return false; | 69 return false; |
| 72 } | 70 } |
| 73 | 71 |
| 74 KURL WorkletGlobalScope::VirtualCompleteURL(const String& url) const { | 72 KURL WorkletGlobalScope::VirtualCompleteURL(const String& url) const { |
| 75 // Always return a null URL when passed a null string. | 73 // Always return a null URL when passed a null string. |
| 76 // TODO(ikilpatrick): Should we change the KURL constructor to have this | 74 // TODO(ikilpatrick): Should we change the KURL constructor to have this |
| 77 // behavior? | 75 // behavior? |
| 78 if (url.IsNull()) | 76 if (url.IsNull()) |
| 79 return KURL(); | 77 return KURL(); |
| 80 // Always use UTF-8 in Worklets. | 78 // Always use UTF-8 in Worklets. |
| 81 return KURL(url_, url); | 79 return KURL(url_, url); |
| 82 } | 80 } |
| 83 | 81 |
| 84 DEFINE_TRACE(WorkletGlobalScope) { | 82 DEFINE_TRACE(WorkletGlobalScope) { |
| 85 visitor->Trace(script_controller_); | 83 visitor->Trace(script_controller_); |
| 86 ExecutionContext::Trace(visitor); | 84 ExecutionContext::Trace(visitor); |
| 87 SecurityContext::Trace(visitor); | 85 SecurityContext::Trace(visitor); |
| 88 WorkerOrWorkletGlobalScope::Trace(visitor); | 86 WorkerOrWorkletGlobalScope::Trace(visitor); |
| 89 } | 87 } |
| 90 | 88 |
| 91 } // namespace blink | 89 } // namespace blink |
| OLD | NEW |