OLD | NEW |
1 if ("importScripts" in self) { | 1 if ("importScripts" in self) { |
2 importScripts("/resources/testharness-helpers.js"); | 2 importScripts("/resources/testharness-helpers.js"); |
| 3 importScripts("test-helpers.js"); |
3 } | 4 } |
4 | 5 |
5 self.onmessage = function(e) { | 6 self.onmessage = function(e) { |
6 navigator.connect(e.data.connect) | 7 var service = e.data.connect; |
| 8 first_to_resolve([wrap_in_port(navigator.services.connect(service)), navigator
.connect(service)]) |
7 .then(function(port) { | 9 .then(function(port) { |
8 e.data.port.postMessage({success: true, result: port}, [port]); | 10 e.data.port.postMessage({success: true, result: port}, [port]); |
9 }) | 11 }) |
10 .catch(function(error) { | 12 .catch(function(error) { |
11 // Not all errors can be serialized as a SerializedScriptValue, so | 13 // Not all errors can be serialized as a SerializedScriptValue, so |
12 // convert to JSON and parse to get just the bits that certainly can. | 14 // convert to JSON and parse to get just the bits that certainly can. |
13 e.data.port.postMessage( | 15 e.data.port.postMessage( |
14 {success: false, result: JSON.parse(stringifyDOMObject(error))}); | 16 {success: false, result: JSON.parse(stringifyDOMObject(error))}); |
15 }); | 17 }); |
16 }; | 18 }; |
OLD | NEW |