OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "core/workers/AbstractGlobalScope.h" |
| 7 |
| 8 #include "bindings/core/v8/GlobalScopeScriptController.h" |
| 9 #include "platform/weborigin/KURL.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 AbstractGlobalScope::AbstractGlobalScope(const KURL& url, const String& userAgen
t) |
| 14 : m_url(url) |
| 15 , m_userAgent(userAgent) |
| 16 { |
| 17 } |
| 18 |
| 19 AbstractGlobalScope::~AbstractGlobalScope() |
| 20 { |
| 21 } |
| 22 |
| 23 void AbstractGlobalScope::disableEval(const String& errorMessage) |
| 24 { |
| 25 script()->disableEval(errorMessage); |
| 26 } |
| 27 |
| 28 KURL AbstractGlobalScope::virtualCompleteURL(const String& url) const |
| 29 { |
| 30 // Always return a null URL when passed a null string. |
| 31 // FIXME: Should we change the KURL constructor to have this behavior? |
| 32 if (url.isNull()) |
| 33 return KURL(); |
| 34 // Always use UTF-8 in Workers. |
| 35 return KURL(m_url, url); |
| 36 } |
| 37 |
| 38 bool AbstractGlobalScope::isSecureContext(String& errorMessage, const SecureCont
extCheck privilegeContextCheck) const |
| 39 { |
| 40 // Until there are APIs that are available in workers and that |
| 41 // require a privileged context test that checks ancestors, just do |
| 42 // a simple check here. Once we have a need for a real |
| 43 // |isSecureContext| check here, we can check the responsible |
| 44 // document for a privileged context at worker creation time, pass |
| 45 // it in via WorkerThreadStartupData, and check it here. |
| 46 return securityOrigin()->isPotentiallyTrustworthy(errorMessage); |
| 47 } |
| 48 |
| 49 } // namespace blink |
OLD | NEW |