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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/background_sync/oneshot.html

Issue 1471763003: [BackgroundSync] Only allow SyncManager.register to occur from main frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split
Patch Set: Address comments from PS6 Created 5 years, 1 month 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/LayoutTests/http/tests/background_sync/oneshot.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/background_sync/oneshot.html b/third_party/WebKit/LayoutTests/http/tests/background_sync/oneshot.html
index e2090b943753f1e4c25657725ad3118aa32c0d53..a763ab2e907c9e0d48bfc32a06624dc790123290 100644
--- a/third_party/WebKit/LayoutTests/http/tests/background_sync/oneshot.html
+++ b/third_party/WebKit/LayoutTests/http/tests/background_sync/oneshot.html
@@ -14,9 +14,7 @@ promise_test(function(t) {
var sync_manager;
var sync_registration;
- // This test verifies that one-shot syncs can be registered from service-
- // worker-controlled documents. It creates a frame, after the service worker
- // is active, in order to use its service worker registration.
+ // This test verifies that registration of one-shots fails from an iframe.
return service_worker_unregister_and_register(t, url, scope)
.then(function(sw_registration_page) {
return wait_for_state(t, sw_registration_page.installing, 'activated');
@@ -38,10 +36,13 @@ promise_test(function(t) {
return sync_manager.register('abcde');
})
.then(function() {
- return service_worker_unregister(t, scope);
+ assert_unreached('iframes should not be able to register syncs');
+ }, function(e) {
+ assert_equals(e.name, 'AbortError');
+ assert_equals(e.message, 'Registration failed - not called from a main frame.');
+ service_worker_unregister(t, scope);
});
- }, 'Background Sync API should allow one-shot syncs to be registered from ' +
- 'the Document scope');
+ }, 'Background Sync should not allow registration from an iframe');
promise_test(function(t) {
var url = 'resources/empty_worker.js';
@@ -66,5 +67,5 @@ promise_test(function(t) {
return service_worker_unregister(t, scope);
})
}, 'Background Sync API should allow one-shot syncs to be registered ' +
- 'with window clients not currently controlled by service worker');
+ 'from an uncontrolled main-frame document');
</script>
« no previous file with comments | « content/test/data/background_sync/service_worker.js ('k') | third_party/WebKit/Source/modules/background_sync/SyncManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698