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

Side by Side Diff: content/test/data/workers/worker_common.js

Issue 2889603007: Set render_frame_id while fetching from the dedicated worker for off-main-thread-fetch (Closed)
Patch Set: Created 3 years, 7 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Track the number of clients for this worker - tests can use this to ensure 5 // Track the number of clients for this worker - tests can use this to ensure
6 // that shared workers are actually shared, not distinct. 6 // that shared workers are actually shared, not distinct.
7 var num_clients = 0; 7 var num_clients = 0;
8 8
9 if (!self.postMessage) { 9 if (!self.postMessage) {
10 // This is a shared worker - mimic dedicated worker APIs 10 // This is a shared worker - mimic dedicated worker APIs
11 onconnect = function(event) { 11 onconnect = function(event) {
12 num_clients++; 12 num_clients++;
13 event.ports[0].onmessage = function(e) { 13 event.ports[0].onmessage = function(e) {
14 self.postMessage = function(msg) { 14 self.postMessage = function(msg) {
15 event.ports[0].postMessage(msg); 15 event.ports[0].postMessage(msg);
16 }; 16 };
17 self.onmessage(e); 17 self.onmessage(e);
18 }; 18 };
19 }; 19 };
20 } else { 20 } else {
21 num_clients++; 21 num_clients++;
22 } 22 }
23 onmessage = function(evt) { 23 onmessage = function(evt) {
24 if (evt.data == "ping") 24 if (evt.data == "ping") {
25 postMessage("pong"); 25 postMessage("pong");
26 else if (evt.data == "auth") 26 } else if (evt.data == "auth") {
27 importScripts("/auth-basic"); 27 importScripts("/auth-basic");
28 else if (evt.data == "close") 28 } else if (evt.data == "close") {
29 close(); 29 close();
30 else if (/eval.+/.test(evt.data)) { 30 } else if (/eval.+/.test(evt.data)) {
31 try { 31 try {
32 postMessage(eval(evt.data.substr(5))); 32 postMessage(eval(evt.data.substr(5)));
33 } catch (ex) { 33 } catch (ex) {
34 postMessage(ex); 34 postMessage(ex);
35 } 35 }
36 } else if (/tls-client-auth.+/.test(evt.data)) { 36 } else if (/tls-client-auth-import.+/.test(evt.data)) {
37 try { 37 try {
38 importScripts(evt.data.substr(16)); 38 importScripts(evt.data.substr(23));
39 } catch (ex) { 39 } catch (ex) {
40 } 40 }
41 postMessage("done"); 41 postMessage("done");
42 } else if (/tls-client-auth-fetch.+/.test(evt.data)) {
43 fetch(evt.data.substr(22)).then(_ => {}, _ => postMessage("done"));
42 } 44 }
43 } 45 }
OLDNEW
« no previous file with comments | « content/renderer/service_worker/worker_fetch_context_impl.cc ('k') | content/test/data/workers/worker_tls_client_auth.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698