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

Unified Diff: Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 383063008: Expose the ServiceWorker's v8 context to embedders. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@pinned
Patch Set: Don't #include .cpp files. :-P Created 6 years, 5 months 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: Source/web/ServiceWorkerGlobalScopeProxy.cpp
diff --git a/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/Source/web/ServiceWorkerGlobalScopeProxy.cpp
index f87bdefde6edc1f30d9d4e85a8ce65d90f42c023..06d559f9903e81e31801540dd65bd3d38fe04c94 100644
--- a/Source/web/ServiceWorkerGlobalScopeProxy.cpp
+++ b/Source/web/ServiceWorkerGlobalScopeProxy.cpp
@@ -35,6 +35,7 @@
#include "core/dom/CrossThreadTask.h"
#include "core/dom/ExecutionContext.h"
#include "core/dom/MessagePort.h"
+#include "core/events/ErrorEvent.h"
#include "core/events/MessageEvent.h"
#include "core/workers/WorkerGlobalScope.h"
#include "modules/push_messaging/PushEvent.h"
@@ -63,6 +64,14 @@ ServiceWorkerGlobalScopeProxy::~ServiceWorkerGlobalScopeProxy()
{
}
+void ServiceWorkerGlobalScopeProxy::evaluate(const ScriptSourceCode& javascript)
+{
+ RefPtrWillBeRawPtr<ErrorEvent> error;
+ m_workerGlobalScope->script()->evaluate(javascript, &error);
+ if (error)
+ m_client.reportException(error->message(), error->lineno(), error->colno(), error->filename());
+}
+
void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID)
{
ASSERT(m_workerGlobalScope);
@@ -114,6 +123,11 @@ void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID)
ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSyncEvent(eventID);
}
+v8::Handle<v8::Context> ServiceWorkerGlobalScopeProxy::v8Context()
+{
+ return m_workerGlobalScope->script()->context();
+}
+
void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL)
{
m_client.reportException(errorMessage, lineNumber, columnNumber, sourceURL);

Powered by Google App Engine
This is Rietveld 408576698