1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19

content / test / data / service_worker / fetch_event.js [blame]

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

this.onfetch = function(event) {
    var headers = new Headers;
    headers.set('Content-Language', 'fi');
    headers.set('Content-Type', 'text/html; charset=UTF-8');
    var blob = new Blob(["This resource is gone. Gone, gone, gone."]);
    var response = new Response(blob, {
        status: 301,
        statusText: 'Moved Permanently',
        headers: headers
    });

    event.respondWith(new Promise(function(r) {
        setTimeout(function() { r(response); }, 5);
    }));
};