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
3 // found in the LICENSE file.
5 // Called when the user clicks on the script badge.
6 chrome.scriptBadge.onClicked.addListener(function(windowId) {
7 chrome.test.notifyPass();
10 chrome.webNavigation.onCompleted.addListener(function(details) {
11 if (details.url.indexOf("http://") === 0) {
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
17 chrome.tabs.executeScript(
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)")
28 chrome.test.notifyPass();