Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: LayoutTests/http/tests/navigatorconnect/resources/connect-helper.js

Issue 1191393003: Update client side navigator.connect API to use ServicePortCollection [1/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@serviceport
Patch Set: address more comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698