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

Unified Diff: Source/modules/background_sync/SyncManager.cpp

Issue 1309393003: [Background Sync] Allow sync manager access from uncontrolled clients (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixing comment Created 5 years, 4 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
« no previous file with comments | « Source/modules/background_sync/SyncManager.h ('k') | Source/modules/background_sync/SyncManager.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/background_sync/SyncManager.cpp
diff --git a/Source/modules/background_sync/SyncManager.cpp b/Source/modules/background_sync/SyncManager.cpp
index 99f89176ecfd37154ef3f1482d0d6cf65f40fe42..4e0ac1683b15f54f5bd6e852c92bab0bc1d5605b 100644
--- a/Source/modules/background_sync/SyncManager.cpp
+++ b/Source/modules/background_sync/SyncManager.cpp
@@ -40,11 +40,8 @@ SyncManager::SyncManager(ServiceWorkerRegistration* registration)
ASSERT(registration);
}
-ScriptPromise SyncManager::registerFunction(ScriptState* scriptState, const SyncRegistrationOptions& options)
+ScriptPromise SyncManager::registerFunction(ScriptState* scriptState, ExecutionContext* context, const SyncRegistrationOptions& options)
{
- if (!m_registration->active())
- return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(AbortError, "Registration failed - no active Service Worker"));
-
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
@@ -56,16 +53,13 @@ ScriptPromise SyncManager::registerFunction(ScriptState* scriptState, const Sync
WebSyncRegistration::NetworkStateOnline /* networkState */,
WebSyncRegistration::PowerStateAuto /* powerState */
);
- backgroundSyncProvider()->registerBackgroundSync(webSyncRegistration, m_registration->webRegistration(), new SyncRegistrationCallbacks(resolver, m_registration));
+ backgroundSyncProvider()->registerBackgroundSync(webSyncRegistration, m_registration->webRegistration(), context->isServiceWorkerGlobalScope(), new SyncRegistrationCallbacks(resolver, m_registration));
return promise;
}
ScriptPromise SyncManager::getRegistration(ScriptState* scriptState, const String& syncRegistrationId)
{
- if (!m_registration->active())
- return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(AbortError, "Operation failed - no active Service Worker"));
-
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
@@ -76,9 +70,6 @@ ScriptPromise SyncManager::getRegistration(ScriptState* scriptState, const Strin
ScriptPromise SyncManager::getRegistrations(ScriptState* scriptState)
{
- if (!m_registration->active())
- return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(AbortError, "Operation failed - no active Service Worker"));
-
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
@@ -89,9 +80,6 @@ ScriptPromise SyncManager::getRegistrations(ScriptState* scriptState)
ScriptPromise SyncManager::permissionState(ScriptState* scriptState)
{
- if (!m_registration->active())
- return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(AbortError, "Operation failed - no active Service Worker"));
-
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
« no previous file with comments | « Source/modules/background_sync/SyncManager.h ('k') | Source/modules/background_sync/SyncManager.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698