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