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

Side by Side Diff: chrome/test/data/extensions/api_test/debugger/background.js

Issue 13517002: Support shared workers as debug targets for chrome.debugger API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 pass = chrome.test.callbackPass; 5 var pass = chrome.test.callbackPass;
6 var fail = chrome.test.callbackFail; 6 var fail = chrome.test.callbackFail;
7 7
8 var tabId; 8 var tabId;
9 var debuggee; 9 var debuggee;
10 var protocolVersion = "1.0"; 10 var protocolVersion = "1.0";
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 var missingDebuggee = {tabId: -1}; 107 var missingDebuggee = {tabId: -1};
108 chrome.debugger.attach(missingDebuggee, protocolVersion, 108 chrome.debugger.attach(missingDebuggee, protocolVersion,
109 fail("No tab with given id " + missingDebuggee.tabId + ".")); 109 fail("No tab with given id " + missingDebuggee.tabId + "."));
110 }, 110 },
111 111
112 function attachToOwnBackgroundPageWithNoSilentFlag() { 112 function attachToOwnBackgroundPageWithNoSilentFlag() {
113 var ownExtensionId = chrome.extension.getURL('').split('/')[2]; 113 var ownExtensionId = chrome.extension.getURL('').split('/')[2];
114 debuggeeExtension = {extensionId: ownExtensionId}; 114 debuggeeExtension = {extensionId: ownExtensionId};
115 chrome.debugger.attach(debuggeeExtension, protocolVersion, 115 chrome.debugger.attach(debuggeeExtension, protocolVersion,
116 fail(SILENT_FLAG_REQUIRED)); 116 fail(SILENT_FLAG_REQUIRED));
117 },
118
119 function discoverWorkerWithNoSilentFlag() {
120 chrome.test.listenOnce(chrome.tabs.onUpdated, function () {
121 chrome.debugger.getTargets(function(targets) {
122 var page = targets.filter(
123 function(t) { return t.type == 'worker'; })[0];
124 if (page) {
125 chrome.debugger.attach({targetId: page.id}, protocolVersion,
126 fail(SILENT_FLAG_REQUIRED));
127 } else {
128 chrome.test.fail("Cannot discover a newly created worker");
129 }
130 });
131 });
132 chrome.tabs.create({url: "worker.html"});
117 } 133 }
118 ]); 134 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698