Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(657)

Unified Diff: third_party/WebKit/Source/core/workers/AbstractGlobalScope.cpp

Issue 1535943005: Initial implementation of bindings and basic classes for worklets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix memory leak. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698