OLD | NEW |
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.1"; | 10 var protocolVersion = "1.1"; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 chrome.debugger.onDetach.addListener(onDetach); | 101 chrome.debugger.onDetach.addListener(onDetach); |
102 chrome.tabs.remove(tab.id); | 102 chrome.tabs.remove(tab.id); |
103 }); | 103 }); |
104 }); | 104 }); |
105 }, | 105 }, |
106 | 106 |
107 function attachToWebUI() { | 107 function attachToWebUI() { |
108 chrome.tabs.create({url:"chrome://version"}, function(tab) { | 108 chrome.tabs.create({url:"chrome://version"}, function(tab) { |
109 var debuggee = {tabId: tab.id}; | 109 var debuggee = {tabId: tab.id}; |
110 chrome.debugger.attach(debuggee, protocolVersion, | 110 chrome.debugger.attach(debuggee, protocolVersion, |
111 fail("Can not attach to the page with the \"chrome://\" scheme.")); | 111 fail("Cannot access a chrome:// URL")); |
112 chrome.tabs.remove(tab.id); | 112 chrome.tabs.remove(tab.id); |
113 }); | 113 }); |
114 }, | 114 }, |
115 | 115 |
116 function attachToMissing() { | 116 function attachToMissing() { |
117 var missingDebuggee = {tabId: -1}; | 117 var missingDebuggee = {tabId: -1}; |
118 chrome.debugger.attach(missingDebuggee, protocolVersion, | 118 chrome.debugger.attach(missingDebuggee, protocolVersion, |
119 fail("No tab with given id " + missingDebuggee.tabId + ".")); | 119 fail("No tab with given id " + missingDebuggee.tabId + ".")); |
120 }, | 120 }, |
121 | 121 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 function onAttach() { | 200 function onAttach() { |
201 chrome.debugger.sendCommand(debuggee, "Page.enable"); | 201 chrome.debugger.sendCommand(debuggee, "Page.enable"); |
202 chrome.debugger.sendCommand( | 202 chrome.debugger.sendCommand( |
203 debuggee, "Page.navigate", {url:"about:blank"}, onNavigateDone); | 203 debuggee, "Page.navigate", {url:"about:blank"}, onNavigateDone); |
204 } | 204 } |
205 | 205 |
206 chrome.debugger.attach(debuggee, protocolVersion, onAttach); | 206 chrome.debugger.attach(debuggee, protocolVersion, onAttach); |
207 }); | 207 }); |
208 } | 208 } |
209 ]); | 209 ]); |
OLD | NEW |