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

Unified Diff: chrome/test/data/extensions/api_test/content_scripts/other_extensions/victim/test.js

Issue 10863002: Added check to prevent extensions from injecting scrips into other extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added test cases for self injection... and failed injection attempt Created 8 years, 4 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/content_scripts/other_extensions/victim/test.js
diff --git a/chrome/test/data/extensions/api_test/content_scripts/other_extensions/victim/test.js b/chrome/test/data/extensions/api_test/content_scripts/other_extensions/victim/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..24756d352286546f1e6769a6220a079534977a65
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/content_scripts/other_extensions/victim/test.js
@@ -0,0 +1,25 @@
+chrome.test.runTests([
+ function content_test() {
+ window.addEventListener('message', function(event) {
+ var msg = event.data;
+ if (msg == 'original') {
+ console.log('VICTIM: No content changed.');
+ chrome.test.succeed();
+ } else {
+ console.log('VICTIM: Detected injected content - ' + msg);
+ chrome.test.fail('Content changed: ' + msg);
+ }
+ },
+ false);
+
+ chrome.test.getConfig(function(config) {
+ chrome.test.log("Creating tab...");
+ var test_url = ("http://a.com:PORT/files/extensions/api_test" +
+ "/content_scripts/other_extensions/iframe_content.html#" +
+ escape(chrome.extension.getURL("test.html")))
+ .replace(/PORT/, config.testServer.port);
+ console.log('Opening frame: ' + test_url);
+ document.getElementById('content_frame').src = test_url;
+ });
+ }
+]);

Powered by Google App Engine
This is Rietveld 408576698