| 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 "modules/worklet/WorkletGlobalScope.h" | 5 #include "modules/worklet/WorkletGlobalScope.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 7 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 void WorkletGlobalScope::disableEval(const String& errorMessage) | 45 void WorkletGlobalScope::disableEval(const String& errorMessage) |
| 46 { | 46 { |
| 47 m_script->disableEval(errorMessage); | 47 m_script->disableEval(errorMessage); |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool WorkletGlobalScope::isSecureContext(String& errorMessage, const SecureConte
xtCheck privilegeContextCheck) const | 50 bool WorkletGlobalScope::isSecureContext(String& errorMessage, const SecureConte
xtCheck privilegeContextCheck) const |
| 51 { | 51 { |
| 52 // Until there are APIs that are available in worklets and that | 52 // Until there are APIs that are available in worklets and that |
| 53 // require a privileged context test that checks ancestors, just do | 53 // require a privileged context test that checks ancestors, just do |
| 54 // a simple check here. | 54 // a simple check here. |
| 55 return securityOrigin()->isPotentiallyTrustworthy(errorMessage); | 55 if (securityOrigin()->isPotentiallyTrustworthy()) |
| 56 return true; |
| 57 errorMessage = securityOrigin()->isPotentiallyTrustworthyErrorMessage(); |
| 58 return false; |
| 56 } | 59 } |
| 57 | 60 |
| 58 KURL WorkletGlobalScope::virtualCompleteURL(const String& url) const | 61 KURL WorkletGlobalScope::virtualCompleteURL(const String& url) const |
| 59 { | 62 { |
| 60 // Always return a null URL when passed a null string. | 63 // Always return a null URL when passed a null string. |
| 61 // TODO(ikilpatrick): Should we change the KURL constructor to have this | 64 // TODO(ikilpatrick): Should we change the KURL constructor to have this |
| 62 // behavior? | 65 // behavior? |
| 63 if (url.isNull()) | 66 if (url.isNull()) |
| 64 return KURL(); | 67 return KURL(); |
| 65 // Always use UTF-8 in Worklets. | 68 // Always use UTF-8 in Worklets. |
| 66 return KURL(m_url, url); | 69 return KURL(m_url, url); |
| 67 } | 70 } |
| 68 | 71 |
| 69 DEFINE_TRACE(WorkletGlobalScope) | 72 DEFINE_TRACE(WorkletGlobalScope) |
| 70 { | 73 { |
| 71 visitor->trace(m_script); | 74 visitor->trace(m_script); |
| 72 ExecutionContext::trace(visitor); | 75 ExecutionContext::trace(visitor); |
| 73 SecurityContext::trace(visitor); | 76 SecurityContext::trace(visitor); |
| 74 } | 77 } |
| 75 | 78 |
| 76 } // namespace blink | 79 } // namespace blink |
| OLD | NEW |