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

Side by Side Diff: chrome/browser/resources/inspect/inspect.js

Issue 304543002: Show the unregistered workers in chrome://serviceworker-internals and chrome://inspect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comment Created 6 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
« no previous file with comments | « no previous file | content/browser/resources/service_worker/serviceworker_internals.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 var MIN_VERSION_TAB_CLOSE = 25; 5 var MIN_VERSION_TAB_CLOSE = 25;
6 var MIN_VERSION_TARGET_ID = 26; 6 var MIN_VERSION_TARGET_ID = 26;
7 var MIN_VERSION_NEW_TAB = 29; 7 var MIN_VERSION_NEW_TAB = 29;
8 var MIN_VERSION_TAB_ACTIVATE = 30; 8 var MIN_VERSION_TAB_ACTIVATE = 30;
9 9
10 var queryParamsObject = {}; 10 var queryParamsObject = {};
(...skipping 11 matching lines...) Expand all
22 })(); 22 })();
23 23
24 function sendCommand(command, args) { 24 function sendCommand(command, args) {
25 chrome.send(command, Array.prototype.slice.call(arguments, 1)); 25 chrome.send(command, Array.prototype.slice.call(arguments, 1));
26 } 26 }
27 27
28 function sendTargetCommand(command, target) { 28 function sendTargetCommand(command, target) {
29 sendCommand(command, target.source, target.id); 29 sendCommand(command, target.source, target.id);
30 } 30 }
31 31
32 function sendServiceWorkerCommand(action, partition_path, scope) { 32 function sendServiceWorkerCommand(action, worker) {
33 $('serviceworker-internals').contentWindow.postMessage({ 33 $('serviceworker-internals').contentWindow.postMessage({
34 'action': action, 34 'action': action,
35 'partition_path': partition_path, 35 'worker': worker
36 'scope': scope
37 },'chrome://serviceworker-internals'); 36 },'chrome://serviceworker-internals');
38 } 37 }
39 38
40 function removeChildren(element_id) { 39 function removeChildren(element_id) {
41 var element = $(element_id); 40 var element = $(element_id);
42 element.textContent = ''; 41 element.textContent = '';
43 } 42 }
44 43
45 function onload() { 44 function onload() {
46 var tabContents = document.querySelectorAll('#content > div'); 45 var tabContents = document.querySelectorAll('#content > div');
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 list.className = 'list'; 119 list.className = 'list';
121 $('service-workers-list').appendChild(list); 120 $('service-workers-list').appendChild(list);
122 } 121 }
123 for (var i = 0; i < workers.length; i++) { 122 for (var i = 0; i < workers.length; i++) {
124 var worker = workers[i]; 123 var worker = workers[i];
125 worker.hasCustomInspectAction = true; 124 worker.hasCustomInspectAction = true;
126 var row = addTargetToList(worker, list, ['scope', 'url']); 125 var row = addTargetToList(worker, list, ['scope', 'url']);
127 addActionLink( 126 addActionLink(
128 row, 127 row,
129 'inspect', 128 'inspect',
130 sendServiceWorkerCommand.bind(null, 129 sendServiceWorkerCommand.bind(null, 'inspect', worker),
131 'inspect',
132 worker.partition_path,
133 worker.scope),
134 false); 130 false);
135 addActionLink( 131 addActionLink(
136 row, 132 row,
137 'terminate', 133 'terminate',
138 sendServiceWorkerCommand.bind(null, 134 sendServiceWorkerCommand.bind(null, 'stop', worker),
139 'stop',
140 worker.partition_path,
141 worker.scope),
142 false); 135 false);
143 } 136 }
144 } 137 }
145 138
146 function populateTargets(source, data) { 139 function populateTargets(source, data) {
147 if (source == 'renderers') 140 if (source == 'renderers')
148 populateWebContentsTargets(data); 141 populateWebContentsTargets(data);
149 else if (source == 'workers') 142 else if (source == 'workers')
150 populateWorkerTargets(data); 143 populateWorkerTargets(data);
151 else if (source == 'adb') 144 else if (source == 'adb')
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 deviceSection.querySelector('.device-ports').textContent = ''; 926 deviceSection.querySelector('.device-ports').textContent = '';
934 } 927 }
935 928
936 Array.prototype.forEach.call( 929 Array.prototype.forEach.call(
937 document.querySelectorAll('.device'), clearPorts); 930 document.querySelectorAll('.device'), clearPorts);
938 } 931 }
939 932
940 document.addEventListener('DOMContentLoaded', onload); 933 document.addEventListener('DOMContentLoaded', onload);
941 934
942 window.addEventListener('hashchange', onHashChange); 935 window.addEventListener('hashchange', onHashChange);
OLDNEW
« no previous file with comments | « no previous file | content/browser/resources/service_worker/serviceworker_internals.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698