OLD | NEW |
(Empty) | |
| 1 self.addEventListener('install', function(event) { |
| 2 test(function() { |
| 3 assert_throws(new TypeError(), function() { |
| 4 new ForeignFetchEvent('type'); |
| 5 }); |
| 6 }, 'ForeignFetchEvent constructor with no init dict'); |
| 7 |
| 8 test(function() { |
| 9 assert_throws(new TypeError(), function() { |
| 10 new ForeignFetchEvent('type', {}); |
| 11 }); |
| 12 }, 'ForeignFetchEvent constructor with empty init dict'); |
| 13 |
| 14 test(function() { |
| 15 assert_throws(new TypeError(), function() { |
| 16 new ForeignFetchEvent('type', { request: null }); |
| 17 }); |
| 18 }, 'ForeignFetchEvent constructor with null request'); |
| 19 |
| 20 test(function() { |
| 21 var request = new Request('https://www.example.com/'); |
| 22 var event = new ForeignFetchEvent('type', { request: request, origin: 'o
rigin' }); |
| 23 assert_equals(event.type, 'type'); |
| 24 assert_equals(event.request, request); |
| 25 assert_equals(event.origin, 'origin'); |
| 26 }, 'ForeignFetchEvent constructor with all init dict members'); |
| 27 }); |
| 28 |
| 29 // Import testharness after install handler to make sure our install handler |
| 30 // runs first. Otherwise only one test will run. |
| 31 importScripts('../../resources/testharness.js'); |
OLD | NEW |