| OLD | NEW |
| 1 importScripts('worker-test-helpers.js'); | 1 importScripts('worker-test-helpers.js'); |
| 2 | 2 |
| 3 test(function() { | 3 test(function() { |
| 4 var expectedMap = { | 4 var expectedMap = { |
| 5 'Content-Language': 'ja', | 5 'Content-Language': 'ja', |
| 6 'Content-Type': 'text/html; charset=UTF-8', | 6 'Content-Type': 'text/html; charset=UTF-8', |
| 7 'X-ServiceWorker-Test': 'response test field' | 7 'X-ServiceWorker-Test': 'response test field' |
| 8 }; | 8 }; |
| 9 | 9 |
| 10 var headers = new HeaderMap; | 10 var headers = new HeaderMap; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 expectedMap[key] = expectedValue; | 75 expectedMap[key] = expectedValue; |
| 76 }); | 76 }); |
| 77 | 77 |
| 78 // 'forEach()' | 78 // 'forEach()' |
| 79 headers.forEach(function(value, key) { | 79 headers.forEach(function(value, key) { |
| 80 assert_true(key != deleteKey); | 80 assert_true(key != deleteKey); |
| 81 assert_true(key in expectedMap); | 81 assert_true(key in expectedMap); |
| 82 assert_equals(headers.get(key), expectedMap[key]); | 82 assert_equals(headers.get(key), expectedMap[key]); |
| 83 }); | 83 }); |
| 84 | 84 |
| 85 // 'forEach()' with thisArg |
| 86 var that = {}, saw_that; |
| 87 headers = new HeaderMap; |
| 88 headers.set('a', 'b'); |
| 89 headers.forEach(function() { saw_that = this; }, that); |
| 90 assert_equals(saw_that, that, 'Passed thisArg should match'); |
| 91 |
| 92 headers.forEach(function() { 'use strict'; saw_that = this; }, 'abc'); |
| 93 assert_equals(saw_that, 'abc', 'Passed non-object thisArg should match'); |
| 94 |
| 95 headers.forEach(function() { saw_that = this; }, null); |
| 96 assert_equals(saw_that, self, 'Passed null thisArg should be replaced with g
lobal object'); |
| 97 |
| 85 }, 'HeaderMap in ServiceWorkerGlobalScope'); | 98 }, 'HeaderMap in ServiceWorkerGlobalScope'); |
| 86 | |
| OLD | NEW |