Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5169)

Unified Diff: chrome/test/data/extensions/api_test/script_badge/basics/background.js

Issue 10823142: Fix a race condition when an IconAnimation is still running at browser shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
« no previous file with comments | « chrome/common/extensions/extension_action.cc ('k') | chrome/test/data/extensions/api_test/script_badge/basics/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698