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

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

Issue 1198653004: Update client side navigator.connect API to use ServicePortCollection [3/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@serviceport-part2
Patch Set: rebase Created 5 years, 5 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 importScripts("test-helpers.js");
4 } 4 }
5 5
6 self.onmessage = function(e) { 6 self.onmessage = function(e) {
7 var service = e.data.connect; 7 var service = e.data.connect;
8 first_to_resolve([wrap_in_port(navigator.services.connect(service)), navigator .connect(service)]) 8 wrap_in_port(navigator.services.connect(service, e.data.options))
9 .then(function(port) { 9 .then(function(port) {
10 e.data.port.postMessage({success: true, result: port}, [port]); 10 e.data.port.postMessage({
11 success: true,
12 result: {
13 port: port,
14 targetURL: port.targetURL,
15 name: port.name,
16 data: port.data
17 }
18 }, [port]);
11 }) 19 })
12 .catch(function(error) { 20 .catch(function(error) {
13 // Not all errors can be serialized as a SerializedScriptValue, so 21 // Not all errors can be serialized as a SerializedScriptValue, so
14 // convert to JSON and parse to get just the bits that certainly can. 22 // convert to JSON and parse to get just the bits that certainly can.
15 e.data.port.postMessage( 23 e.data.port.postMessage(
16 {success: false, result: JSON.parse(stringifyDOMObject(error))}); 24 {success: false, result: JSON.parse(stringifyDOMObject(error))});
17 }); 25 });
18 }; 26 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698