| 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');
|
|
|