| Index: third_party/WebKit/Source/core/workers/AbstractGlobalScope.cpp
|
| diff --git a/third_party/WebKit/Source/core/workers/AbstractGlobalScope.cpp b/third_party/WebKit/Source/core/workers/AbstractGlobalScope.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8eb28e85916508ef8141d03a91d61dc848bf0321
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/workers/AbstractGlobalScope.cpp
|
| @@ -0,0 +1,49 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "config.h"
|
| +#include "core/workers/AbstractGlobalScope.h"
|
| +
|
| +#include "bindings/core/v8/GlobalScopeScriptController.h"
|
| +#include "platform/weborigin/KURL.h"
|
| +
|
| +namespace blink {
|
| +
|
| +AbstractGlobalScope::AbstractGlobalScope(const KURL& url, const String& userAgent)
|
| + : m_url(url)
|
| + , m_userAgent(userAgent)
|
| +{
|
| +}
|
| +
|
| +AbstractGlobalScope::~AbstractGlobalScope()
|
| +{
|
| +}
|
| +
|
| +void AbstractGlobalScope::disableEval(const String& errorMessage)
|
| +{
|
| + script()->disableEval(errorMessage);
|
| +}
|
| +
|
| +KURL AbstractGlobalScope::virtualCompleteURL(const String& url) const
|
| +{
|
| + // Always return a null URL when passed a null string.
|
| + // FIXME: Should we change the KURL constructor to have this behavior?
|
| + if (url.isNull())
|
| + return KURL();
|
| + // Always use UTF-8 in Workers.
|
| + return KURL(m_url, url);
|
| +}
|
| +
|
| +bool AbstractGlobalScope::isSecureContext(String& errorMessage, const SecureContextCheck privilegeContextCheck) const
|
| +{
|
| + // Until there are APIs that are available in workers and that
|
| + // require a privileged context test that checks ancestors, just do
|
| + // a simple check here. Once we have a need for a real
|
| + // |isSecureContext| check here, we can check the responsible
|
| + // document for a privileged context at worker creation time, pass
|
| + // it in via WorkerThreadStartupData, and check it here.
|
| + return securityOrigin()->isPotentiallyTrustworthy(errorMessage);
|
| +}
|
| +
|
| +} // namespace blink
|
|
|