OLD | NEW |
---|---|
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 // Called when the user clicks on the script badge. | 5 // Called when the user clicks on the script badge. |
6 chrome.scriptBadge.onClicked.addListener(function(windowId) { | 6 chrome.scriptBadge.onClicked.addListener(function(windowId) { |
7 chrome.test.notifyPass(); | 7 chrome.test.notifyPass(); |
8 }); | 8 }); |
9 | 9 |
10 chrome.webNavigation.onCompleted.addListener(function(details) { | |
11 if (/^http:/.test(details.url)) { | |
not at google - send to devlin
2012/08/02 14:44:25
details.url.indexOf('http://') === 0
is a common
Jeffrey Yasskin
2012/08/02 15:11:49
Cool. Keep the idioms coming: I don't claim to kno
| |
12 // Executing script causes an icon animation to run. Originally, if | |
13 // this animation was still running when the browser shut down, it | |
14 // would cause a crash due to the Extension being destroyed on the | |
15 // IO thread, and transitively causing a UI-only object to be | |
16 // destroyed there. | |
17 chrome.tabs.executeScript( | |
18 details.tabId, | |
19 { | |
20 // The setTimeout allows the ScriptBadgeController to | |
21 // reliably notice that a content script has run. | |
22 "code": ("window.setTimeout(function() {" + | |
23 " chrome.test.notifyPass();}, 1)") | |
24 }); | |
25 } | |
26 }); | |
27 | |
10 chrome.test.notifyPass(); | 28 chrome.test.notifyPass(); |
OLD | NEW |