Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / service_worker / bindings / page.js
blobe9698a74a98e3a227c4b7ec8e2fac8a229323d68
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 var logForDebugging = false;
6 function log(message) {
7 if (logForDebugging)
8 console.log(message);
10 navigator.serviceWorker.register('/sw.js').then(function(registration) {
11 // Registration was successful
12 log('ServiceWorker registration successful with scope: ',
13 registration.scope);
14 chrome.test.succeed();
15 }).catch(function(err) {
16 // registration failed :(
17 var errorMsg = err.name + ': ' + err.message;
18 log('ServiceWorker registration failed: ' + errorMsg);
19 chrome.test.fail();
20 });