From 719663e4f49853e2a9ff84bc0ac29cca484105d1 Mon Sep 17 00:00:00 2001 From: "aa@chromium.org" Date: Wed, 25 Nov 2009 02:05:39 +0000 Subject: Introduce a new 'all_frames' property to content scripts and default it to false. This should improve performance in sites that use frames and elimiate confusion, since in most cases developers *don't* expect content scripts to match frames. Review URL: http://codereview.chromium.org/412008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33035 0039d316-1c4b-4281-b951-d872f2087c98 --- .../content_script_all_frames/all_frames.js | 1 + .../content_script_all_frames/manifest.json | 18 ++++++++++++ .../api_test/content_script_all_frames/test.html | 34 ++++++++++++++++++++++ .../content_script_all_frames/top_frame_only.js | 1 + .../subscribe_page_action/feed_finder.js | 6 ++-- .../data/extensions/test_file_with_iframe.html | 4 +++ 6 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 chrome/test/data/extensions/api_test/content_script_all_frames/all_frames.js create mode 100644 chrome/test/data/extensions/api_test/content_script_all_frames/manifest.json create mode 100644 chrome/test/data/extensions/api_test/content_script_all_frames/test.html create mode 100644 chrome/test/data/extensions/api_test/content_script_all_frames/top_frame_only.js create mode 100644 chrome/test/data/extensions/test_file_with_iframe.html (limited to 'chrome/test') diff --git a/chrome/test/data/extensions/api_test/content_script_all_frames/all_frames.js b/chrome/test/data/extensions/api_test/content_script_all_frames/all_frames.js new file mode 100644 index 0000000..71d22fd --- /dev/null +++ b/chrome/test/data/extensions/api_test/content_script_all_frames/all_frames.js @@ -0,0 +1 @@ +chrome.extension.sendRequest("all_frames"); diff --git a/chrome/test/data/extensions/api_test/content_script_all_frames/manifest.json b/chrome/test/data/extensions/api_test/content_script_all_frames/manifest.json new file mode 100644 index 0000000..0f73a8f --- /dev/null +++ b/chrome/test/data/extensions/api_test/content_script_all_frames/manifest.json @@ -0,0 +1,18 @@ +{ + "name": "content_script_all_frames", + "version": "1.0", + "description": "Tests the all_frames property of content script declarations.", + "background_page": "test.html", + "permissions": ["tabs"], + "content_scripts": [ + { + "matches": ["http://*/*"], + "js": ["top_frame_only.js"] + }, + { + "matches": ["http://*/*"], + "js": ["all_frames.js"], + "all_frames": true + } + ] +} diff --git a/chrome/test/data/extensions/api_test/content_script_all_frames/test.html b/chrome/test/data/extensions/api_test/content_script_all_frames/test.html new file mode 100644 index 0000000..e8f8088 --- /dev/null +++ b/chrome/test/data/extensions/api_test/content_script_all_frames/test.html @@ -0,0 +1,34 @@ + diff --git a/chrome/test/data/extensions/api_test/content_script_all_frames/top_frame_only.js b/chrome/test/data/extensions/api_test/content_script_all_frames/top_frame_only.js new file mode 100644 index 0000000..76ad923 --- /dev/null +++ b/chrome/test/data/extensions/api_test/content_script_all_frames/top_frame_only.js @@ -0,0 +1 @@ +chrome.extension.sendRequest("top_frame_only"); diff --git a/chrome/test/data/extensions/subscribe_page_action/feed_finder.js b/chrome/test/data/extensions/subscribe_page_action/feed_finder.js index d5c4f2a..5261264 100644 --- a/chrome/test/data/extensions/subscribe_page_action/feed_finder.js +++ b/chrome/test/data/extensions/subscribe_page_action/feed_finder.js @@ -2,10 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -if (window == top) { - findFeeds(); - window.addEventListener("focus", findFeeds); -} +findFeeds(); +window.addEventListener("focus", findFeeds); function findFeeds() { // Find all the RSS link elements. diff --git a/chrome/test/data/extensions/test_file_with_iframe.html b/chrome/test/data/extensions/test_file_with_iframe.html new file mode 100644 index 0000000..8a310c7 --- /dev/null +++ b/chrome/test/data/extensions/test_file_with_iframe.html @@ -0,0 +1,4 @@ + +Test file! + + -- cgit v1.1