Index: chrome/test/data/extensions/api_test/script_badge/basics/background.js |
diff --git a/chrome/test/data/extensions/api_test/script_badge/basics/background.js b/chrome/test/data/extensions/api_test/script_badge/basics/background.js |
index 46497dd57644d2d939957fa436784e4c136f433d..53e79e19025ac3f15b6b8115de0197f9efa4e632 100644 |
--- a/chrome/test/data/extensions/api_test/script_badge/basics/background.js |
+++ b/chrome/test/data/extensions/api_test/script_badge/basics/background.js |
@@ -7,4 +7,22 @@ chrome.scriptBadge.onClicked.addListener(function(windowId) { |
chrome.test.notifyPass(); |
}); |
+chrome.webNavigation.onCompleted.addListener(function(details) { |
+ if (details.url.indexOf("http://") === 0) { |
+ // Executing script causes an icon animation to run. Originally, if |
+ // this animation was still running when the browser shut down, it |
+ // would cause a crash due to the Extension being destroyed on the |
+ // IO thread, and transitively causing a UI-only object to be |
+ // destroyed there. |
+ chrome.tabs.executeScript( |
+ details.tabId, |
+ { |
+ // The setTimeout allows the ScriptBadgeController to |
+ // reliably notice that a content script has run. |
+ "code": ("window.setTimeout(function() {" + |
+ " chrome.test.notifyPass();}, 1)") |
+ }); |
+ } |
+ }); |
+ |
chrome.test.notifyPass(); |