New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 17 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jan 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Launch-OWP
Launch-Accessibility: ----
Launch-Exp-Leadership: ----
Launch-Leadership: ----
Launch-Legal: ----
Launch-M-Approved: ----
Launch-M-Target: ----
Launch-Privacy: ----
Launch-Security: ----
Launch-Test: ----
Launch-UI: ----
Rollout-Type: ----


Sign in to add a comment

Background Sync One-Shot API for Service Workers

Project Member Reported by kenjibaheux@chromium.org, Jan 16 2015

Issue description

Change description:
A new API that extends Service Workers with an onsync event and associated registration API. 

Changes to API surface:
Tentatively,
 partial interface ServiceWorkerRegistration {
  readonly attribute SyncManager syncManager;
};

interface SyncManager {
  Promise<boolean> register(string id, optional SyncRegistrationOptions);
  Promise<boolean> unregister(string id);
  Promise<sequence<DOMString>> getRegistrationIds();
  Promise<SyncPermissionStatus> hasPermission();
  readonly attribute unsigned long minAllowablePeriodMillis;
};

partial interface ServiceWorkerGlobalScope {
  attribute EventHandler onsync;
};


Links:
https://github.com/slightlyoff/BackgroundSync/blob/master/explainer.md

Support in other browsers:
Internet Explorer: no signals
Firefox: (related API for Firefox OS)
Safari: no signals


 
Labels: -M-42 M-43
Labels: -Pri-2 Pri-1
Let's try to get a minimal viable product[1] implemented by M43.

[1] tentative scope can be seen here:
https://github.com/slightlyoff/BackgroundSync/issues/42
Labels: Cr-Blink-ServiceWorker
Labels: Cr-Blink-BackgroundSync
Project Member

Comment 6 by bugdroid1@chromium.org, Mar 20 2015

The following revision refers to this bug:
  http://src.chromium.org/viewvc/blink?view=rev&rev=192279

------------------------------------------------------------------
r192279 | iclelland@chromium.org | 2015-03-20T19:28:03.363705Z

Changed paths:
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/SyncEvent.idl?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/background_sync/resources/interfaces-worker.js?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/SyncRegistration.cpp?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/ServiceWorkerRegistrationSync.idl?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/SyncRegistrationOptions.idl?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/SyncManager.h?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/SyncEvent.cpp?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/SyncCallbacks.h?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/ServiceWorkerRegistrationSync.cpp?r1=192279&r2=192278&pathrev=192279
   M http://src.chromium.org/viewvc/blink/trunk/Source/modules/modules.gypi?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/background_sync?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/SyncEventInit.idl?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/SyncError.h?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/SyncManager.idl?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/background_sync/resources?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/background_sync/resources/empty_worker.js?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/SyncManager.cpp?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/ServiceWorkerGlobalScopeSync.h?r1=192279&r2=192278&pathrev=192279
   M http://src.chromium.org/viewvc/blink/trunk/public/platform/Platform.h?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/DEPS?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/SyncCallbacks.cpp?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/SyncRegistration.h?r1=192279&r2=192278&pathrev=192279
   M http://src.chromium.org/viewvc/blink/trunk/public/platform/modules/background_sync/WebSyncRegistration.h?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/background_sync/interfaces.html?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/SyncEvent.h?r1=192279&r2=192278&pathrev=192279
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/webexposed/global-interface-listing-expected.txt?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/SyncError.cpp?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/ServiceWorkerRegistrationSync.h?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/ServiceWorkerGlobalScopeSync.idl?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/OWNERS?r1=192279&r2=192278&pathrev=192279
   M http://src.chromium.org/viewvc/blink/trunk/public/platform/modules/background_sync/WebSyncProvider.h?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/SyncRegistration.idl?r1=192279&r2=192278&pathrev=192279
   M http://src.chromium.org/viewvc/blink/trunk/Source/modules/serviceworkers/ServiceWorkerGlobalScope.idl?r1=192279&r2=192278&pathrev=192279
   A http://src.chromium.org/viewvc/blink/trunk/public/platform/modules/background_sync/OWNERS?r1=192279&r2=192278&pathrev=192279

Add IDL and initial Blink API for Background Sync

This patch adds the interfaces for background sync (https://github.com/slightlyoff/BackgroundSync/blob/master/explainer.md) to the IDL and exposes syncManager on the ServiceWorkerRegistration interface.

It includes just enough of the implementation to be able to instantiate SyncRegistration objects and pass them through to the browser code (not included in this patch, except for the header definitions in public/platform/

BUG= 449443 

Review URL: https://codereview.chromium.org/963683002
-----------------------------------------------------------------
Project Member

Comment 7 by bugdroid1@chromium.org, Mar 26 2015

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/34ee23cfb4147f51b8ca0f728e6354f8f86db8ee

commit 34ee23cfb4147f51b8ca0f728e6354f8f86db8ee
Author: jkarlin <jkarlin@chromium.org>
Date: Thu Mar 26 13:58:50 2015

[BackgroundSync] Initial land of the BackgroundSyncManager

The BackgroundSyncManager is the class that handles registration of
background syncs. This first CL handles storage and retrieval of
registrations and sequential ordering of async operations. Future CLs
will add permission checks and incorporate a scheduler.

Eventually the BackgroundSyncManager will be created and owned by the
BackgroundSyncMessageFilter, which will be owned by the RenderViewHost.

BackgroundSync Design Doc: https://docs.google.com/document/d/1MAuNzV0q5FporLZVJMh7CMrwTHwcZsWX6YUwPwKMGco/

BUG= 449443 

Review URL: https://codereview.chromium.org/950343006

Cr-Commit-Position: refs/heads/master@{#322375}

[modify] http://crrev.com/34ee23cfb4147f51b8ca0f728e6354f8f86db8ee/content/browser/BUILD.gn
[add] http://crrev.com/34ee23cfb4147f51b8ca0f728e6354f8f86db8ee/content/browser/background_sync/BUILD.gn
[add] http://crrev.com/34ee23cfb4147f51b8ca0f728e6354f8f86db8ee/content/browser/background_sync/OWNERS
[add] http://crrev.com/34ee23cfb4147f51b8ca0f728e6354f8f86db8ee/content/browser/background_sync/PRESUBMIT.py
[add] http://crrev.com/34ee23cfb4147f51b8ca0f728e6354f8f86db8ee/content/browser/background_sync/background_sync.proto
[add] http://crrev.com/34ee23cfb4147f51b8ca0f728e6354f8f86db8ee/content/browser/background_sync/background_sync_manager.cc
[add] http://crrev.com/34ee23cfb4147f51b8ca0f728e6354f8f86db8ee/content/browser/background_sync/background_sync_manager.h
[add] http://crrev.com/34ee23cfb4147f51b8ca0f728e6354f8f86db8ee/content/browser/background_sync/background_sync_manager_unittest.cc
[add] http://crrev.com/34ee23cfb4147f51b8ca0f728e6354f8f86db8ee/content/browser/background_sync/background_sync_proto.gyp
[modify] http://crrev.com/34ee23cfb4147f51b8ca0f728e6354f8f86db8ee/content/browser/service_worker/service_worker_context_wrapper.h
[modify] http://crrev.com/34ee23cfb4147f51b8ca0f728e6354f8f86db8ee/content/browser/service_worker/service_worker_storage.cc
[modify] http://crrev.com/34ee23cfb4147f51b8ca0f728e6354f8f86db8ee/content/browser/service_worker/service_worker_storage.h
[modify] http://crrev.com/34ee23cfb4147f51b8ca0f728e6354f8f86db8ee/content/content_browser.gypi
[modify] http://crrev.com/34ee23cfb4147f51b8ca0f728e6354f8f86db8ee/content/content_tests.gypi
[modify] http://crrev.com/34ee23cfb4147f51b8ca0f728e6354f8f86db8ee/content/test/BUILD.gn

Project Member

Comment 8 by bugdroid1@chromium.org, Mar 31 2015

The following revision refers to this bug:
  http://src.chromium.org/viewvc/blink?view=rev&rev=192884

------------------------------------------------------------------
r192884 | jkarlin@chromium.org | 2015-03-31T23:47:49.045872Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/modules/background_sync/ServiceWorkerRegistrationSync.idl?r1=192884&r2=192883&pathrev=192884
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/frame/UseCounter.h?r1=192884&r2=192883&pathrev=192884

[BackgroundSync] Track syncManager usage

Downstream of: https://codereview.chromium.org/1049743002/

BUG= 449443 

Review URL: https://codereview.chromium.org/1043103003
-----------------------------------------------------------------
Project Member

Comment 9 by bugdroid1@chromium.org, Apr 3 2015

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9059304cb5c6f7f683ea30259eeacc5a429566c9

commit 9059304cb5c6f7f683ea30259eeacc5a429566c9
Author: jkarlin <jkarlin@chromium.org>
Date: Fri Apr 03 16:46:44 2015

[BackgroundSync] Handle storage failure

This CL introduces proper failure handling in case the storage backend fails.

Changes:

1. If the ServiceWorker is unregistered - Remove the sync registrations from memory
2. If the ServiceWorkerStorage is wiped - Reinit the BackgroundSyncManager
3. If reading or writing from ServiceWorkerStorage fails (SERVICE_WORKER_ERROR_FAILURE) - Delete everything and disable the BackgroundSyncManager until browser restart.

Added unittests for above cases. I had to change the unittest to register serviceworkers via the ServiceWorkerContext instead of directly in Storage so that the ServiceWorkerContextObserver receives updates.

BUG= 449443 

Review URL: https://codereview.chromium.org/1048053002

Cr-Commit-Position: refs/heads/master@{#323756}

[modify] http://crrev.com/9059304cb5c6f7f683ea30259eeacc5a429566c9/content/browser/background_sync/background_sync_manager.cc
[modify] http://crrev.com/9059304cb5c6f7f683ea30259eeacc5a429566c9/content/browser/background_sync/background_sync_manager.h
[modify] http://crrev.com/9059304cb5c6f7f683ea30259eeacc5a429566c9/content/browser/background_sync/background_sync_manager_unittest.cc
[modify] http://crrev.com/9059304cb5c6f7f683ea30259eeacc5a429566c9/content/browser/cache_storage/cache_storage_scheduler.cc
[modify] http://crrev.com/9059304cb5c6f7f683ea30259eeacc5a429566c9/content/browser/cache_storage/cache_storage_scheduler.h
[modify] http://crrev.com/9059304cb5c6f7f683ea30259eeacc5a429566c9/content/browser/cache_storage/cache_storage_scheduler_unittest.cc

Blockedon: chromium:474573
Blockedon: chromium:477366
Blockedon: chromium:477725
Blockedon: chromium:479251
Blockedon: chromium:482053
Blockedon: chromium:482083
Blockedon: chromium:482088
Blockedon: chromium:482091
Blockedon: chromium:482093
Blockedon: chromium:477705
Labels: -M-43 M-45
Blockedon: chromium:484306
Blockedon: chromium:486890
Blockedon: chromium:490482
Blockedon: chromium:490488
Blockedon: chromium:491137
Cc: nyquist@chromium.org
Labels: -M-45 M-46
Labels: -Cr-Blink-BackgroundSync Cr-Blink-ServiceWorker-BackgroundSync
Labels: -M-46 M-48
Labels: Hotlist-Recharge
This issue likely requires triage.  The current issue owner maybe inactive (i.e. hasn't fixed an issue in the last 30 days).  Thanks for helping out!

-Anthony
Cc: -gavinp@chromium.org kenjibaheux@chromium.org iclell...@chromium.org
Labels: -Hotlist-Recharge
Owner: owe...@chromium.org
Blockedon: -chromium:479674 -chromium:479708 -chromium:482088 -chromium:482093
Labels: -M-48 M-49
Summary: Background Sync One-Shot API for Service Workers (was: Background Sync API for Service Workers)
Updated changes to the Interface since intent-to-implement:

partial interface ServiceWorkerRegistration {
  readonly attribute SyncManager sync;
};

[Exposed=(Window,Worker)]
interface SyncManager {
  Promise<void> register(DOMString tag);
  Promise<sequence<DOMString>> getTags();
};

partial interface ServiceWorkerGlobalScope {
  attribute EventHandler onsync;
};

[Constructor(DOMString type, SyncEventInit init), Exposed=ServiceWorker]
interface SyncEvent : ExtendableEvent {
  readonly attribute DOMString tag;
  readonly attribute boolean lastChance;
};

dictionary SyncEventInit : ExtendableEventInit {
  required DOMString tag;
  boolean lastChance = false;
};

it works
owen: can we mark this fixed?
Status: Fixed
I'd sure say so \o/

Let's just keep the internal launch tracking bug open until it's actually shipped to stable, but I don't imagine there is any noise left for this thread.
Components: -Blink>ServiceWorker>BackgroundSync Blink>BackgroundSync
Project Member

Comment 38 by bugdroid1@chromium.org, Aug 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7619fdb2573c2a12ced6afbe0fb99838b75bc96a

commit 7619fdb2573c2a12ced6afbe0fb99838b75bc96a
Author: Hiroki Nakagawa <nhiroki@chromium.org>
Date: Mon Aug 07 13:42:15 2017

BackgroundSync: Remove "BackgroundSync" flag from RuntimeEnabledFeatures

BackgroundSync was shipped in milestone 49 and the flag is no longer necessary:
https://www.chromestatus.com/feature/6170807885627392

Bug:  449443 
Change-Id: I77570e5d66f46d504fa6511ddefaf2d9790bc8ad
Reviewed-on: https://chromium-review.googlesource.com/603193
Reviewed-by: Josh Karlin <jkarlin@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#492311}
[modify] https://crrev.com/7619fdb2573c2a12ced6afbe0fb99838b75bc96a/third_party/WebKit/Source/modules/background_sync/ServiceWorkerGlobalScopeSync.idl
[modify] https://crrev.com/7619fdb2573c2a12ced6afbe0fb99838b75bc96a/third_party/WebKit/Source/modules/background_sync/ServiceWorkerRegistrationSync.idl
[modify] https://crrev.com/7619fdb2573c2a12ced6afbe0fb99838b75bc96a/third_party/WebKit/Source/modules/background_sync/SyncEvent.idl
[modify] https://crrev.com/7619fdb2573c2a12ced6afbe0fb99838b75bc96a/third_party/WebKit/Source/modules/background_sync/SyncManager.idl
[modify] https://crrev.com/7619fdb2573c2a12ced6afbe0fb99838b75bc96a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeProxy.cpp
[modify] https://crrev.com/7619fdb2573c2a12ced6afbe0fb99838b75bc96a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5

Sign in to add a comment