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

Unified Diff: chrome/test/data/extensions/api_test/cross_origin_xhr/content_script/content_script.js

Issue 7071025: Use WebFrame::setIsolatedWorldSecurityOrigin to allow cross-origin XHRs in content scripts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove isolated worlds when extension is unloaded Created 9 years, 7 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/cross_origin_xhr/content_script/content_script.js
diff --git a/chrome/test/data/extensions/api_test/cross_origin_xhr/content_script/content_script.js b/chrome/test/data/extensions/api_test/cross_origin_xhr/content_script/content_script.js
new file mode 100644
index 0000000000000000000000000000000000000000..c30c8dddf9ab45569b8f28afd44688350e07913a
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/cross_origin_xhr/content_script/content_script.js
@@ -0,0 +1,29 @@
+// Copyright (c) 2011 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.
+
+chrome.extension.onRequest.addListener(
+ function(url, sender, sendResponse) {
+ var req = new XMLHttpRequest();
+ console.log('Requesting url: ' + url);
+ req.open('GET', url, true);
+
+ req.onload = function() {
+ sendResponse({
+ 'event': 'load',
+ 'status': req.status,
+ 'text': req.responseText
+ });
+ };
+ req.onerror = function() {
+ sendResponse({
+ 'event': 'error',
+ 'status': req.status,
+ 'text': req.responseText
+ });
+ };
+
+ req.send(null);
+ });
+
+chrome.extension.sendRequest('injected');

Powered by Google App Engine
This is Rietveld 408576698