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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 if (target) { | 133 if (target) { |
134 chrome.debugger.attach({targetId: target.id}, protocolVersion, | 134 chrome.debugger.attach({targetId: target.id}, protocolVersion, |
135 fail(SILENT_FLAG_REQUIRED)); | 135 fail(SILENT_FLAG_REQUIRED)); |
136 } else { | 136 } else { |
137 chrome.test.succeed(); | 137 chrome.test.succeed(); |
138 } | 138 } |
139 }); | 139 }); |
140 }, | 140 }, |
141 | 141 |
142 function createAndDiscoverTab() { | 142 function createAndDiscoverTab() { |
143 function onUpdated(tabId) { | 143 function onUpdated(tabId, changeInfo) { |
| 144 if (changeInfo.status == 'loading') |
| 145 return; |
144 chrome.tabs.onUpdated.removeListener(onUpdated); | 146 chrome.tabs.onUpdated.removeListener(onUpdated); |
145 chrome.debugger.getTargets(function(targets) { | 147 chrome.debugger.getTargets(function(targets) { |
146 var page = targets.filter( | 148 var page = targets.filter( |
147 function(t) { | 149 function(t) { |
148 return t.type == 'page' && | 150 return t.type == 'page' && |
149 t.tabId == tabId && | 151 t.tabId == tabId && |
150 t.title == 'Test page'; | 152 t.title == 'Test page'; |
151 })[0]; | 153 })[0]; |
152 if (page) { | 154 if (page) { |
153 chrome.debugger.attach( | 155 chrome.debugger.attach( |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 function onAttach() { | 200 function onAttach() { |
199 chrome.debugger.sendCommand(debuggee, "Page.enable"); | 201 chrome.debugger.sendCommand(debuggee, "Page.enable"); |
200 chrome.debugger.sendCommand( | 202 chrome.debugger.sendCommand( |
201 debuggee, "Page.navigate", {url:"about:blank"}, onNavigateDone); | 203 debuggee, "Page.navigate", {url:"about:blank"}, onNavigateDone); |
202 } | 204 } |
203 | 205 |
204 chrome.debugger.attach(debuggee, protocolVersion, onAttach); | 206 chrome.debugger.attach(debuggee, protocolVersion, onAttach); |
205 }); | 207 }); |
206 } | 208 } |
207 ]); | 209 ]); |
OLD | NEW |