diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-23 02:12:34 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-23 02:12:34 +0000 |
commit | 84954ce77558a87d6bd20d5691bbc4ce9bfb6887 (patch) | |
tree | e03a8bd4148aadf4d4880e73912c4f5398ad953c /chrome/test | |
parent | 70853b00ae4f3a0b3c96978cfa4a5caeabacb60b (diff) | |
download | chromium_src-84954ce77558a87d6bd20d5691bbc4ce9bfb6887.zip chromium_src-84954ce77558a87d6bd20d5691bbc4ce9bfb6887.tar.gz chromium_src-84954ce77558a87d6bd20d5691bbc4ce9bfb6887.tar.bz2 |
Page actions that don't specify an icon (ie.
have a spelling error in the manifest, such as
icon instead of icons/default_icon) caused a
crash when they try to display their icon.
We now check when the extension tries to enable
the page action whether there are any icons to
display. If not, we don't proceed and log an
error to the console.
BUG=25562
TEST=Covered by browser test.
Review URL: http://codereview.chromium.org/316018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29861 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
4 files changed, 52 insertions, 0 deletions
diff --git a/chrome/test/data/extensions/browsertest/crash_25562/background.html b/chrome/test/data/extensions/browsertest/crash_25562/background.html new file mode 100644 index 0000000..f27aba8 --- /dev/null +++ b/chrome/test/data/extensions/browsertest/crash_25562/background.html @@ -0,0 +1,28 @@ +<html> +<script> + // The Page Action ID. + var pageActionId = "TestId"; + + // The window this Page Action is associated with. + var windowId = -1; + + // The TabId this Page Action is associated with. + var tabId = -1; + + // The URL of the page on build.chromium.org. + var pageUrl = ""; + + chrome.self.onConnect.addListener(function(port) { + windowId = port.tab.windowId; + tabId = port.tab.id; + pageUrl = port.tab.url; + + port.onMessage.addListener(function(mybool) { + // Let Chrome know that the PageAction needs to be enabled for this tabId + // and for the url of this page. + chrome.pageActions.enableForTab(pageActionId, + {tabId: tabId, url: pageUrl}); + }); + }); +</script> +</html> diff --git a/chrome/test/data/extensions/browsertest/crash_25562/chrome-16.png b/chrome/test/data/extensions/browsertest/crash_25562/chrome-16.png Binary files differnew file mode 100644 index 0000000..a3a4f3a --- /dev/null +++ b/chrome/test/data/extensions/browsertest/crash_25562/chrome-16.png diff --git a/chrome/test/data/extensions/browsertest/crash_25562/manifest.json b/chrome/test/data/extensions/browsertest/crash_25562/manifest.json new file mode 100644 index 0000000..9d9e8fb --- /dev/null +++ b/chrome/test/data/extensions/browsertest/crash_25562/manifest.json @@ -0,0 +1,17 @@ +{ + "background_page": "background.html", + "content_scripts": [ { + "js": [ "script.js" ], + "matches": [ "http://*/*" ] + } ], + "description": "A page action with incorrect icon specification", + "name": "Test extension", + "page_actions": [ { + "icon": "chrome-16.png", + "id": "TestId", + "name": "Page action name", + "tooltip": "Page action tooltip" + } ], + "permissions": [ "http://*/*" ], + "version": "1.0" +} diff --git a/chrome/test/data/extensions/browsertest/crash_25562/script.js b/chrome/test/data/extensions/browsertest/crash_25562/script.js new file mode 100644 index 0000000..b602eb8 --- /dev/null +++ b/chrome/test/data/extensions/browsertest/crash_25562/script.js @@ -0,0 +1,7 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +if (window == top) { + chrome.extension.connect().postMessage(true); +} |