| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<!-- |
| 4 |
Copyright 2007 The Closure Library Authors. All Rights Reserved. |
| 5 |
|
| 6 |
Use of this source code is governed by the Apache License, Version 2.0. |
| 7 |
See the COPYING file for details. |
| 8 |
--> |
| 9 |
<!-- |
| 10 |
|
| 11 |
|
| 12 |
In reality, this response comes from a different domain. For simplicity of |
| 13 |
testing, this response is one the same domain, while exercising the same |
| 14 |
functionality. |
| 15 |
--> |
| 16 |
<title>crossdomainrpc test response</title> |
| 17 |
<body> |
| 18 |
<script type="text/javascript" src="../base.js"></script> |
| 19 |
<script type="text/javascript"> |
| 20 |
goog.require('goog.Uri.QueryData'); |
| 21 |
goog.require('goog.dom'); |
| 22 |
goog.require('goog.events.EventTarget'); |
| 23 |
goog.require('goog.json'); |
| 24 |
goog.require('goog.log'); |
| 25 |
goog.require('goog.net.EventType'); |
| 26 |
goog.require('goog.userAgent'); |
| 27 |
</script> |
| 28 |
<script type="text/javascript" src="crossdomainrpc.js"></script> |
| 29 |
<script type="text/javascript"> |
| 30 |
function createPayload(size) { |
| 31 |
var chars = []; |
| 32 |
for (var i = 0; i < size; i++) { |
| 33 |
chars.push('0'); |
| 34 |
} |
| 35 |
return chars.join(''); |
| 36 |
}; |
| 37 |
|
| 38 |
var payload = createPayload(16 * 1024); |
| 39 |
|
| 40 |
var currentDirectory = location.href.substring( |
| 41 |
0, location.href.lastIndexOf('/') |
| 42 |
); |
| 43 |
|
| 44 |
var echo = {}; |
| 45 |
echo[goog.net.CrossDomainRpc.PARAM_ECHO_REQUEST_ID] = 0; |
| 46 |
echo[goog.net.CrossDomainRpc.PARAM_ECHO_DUMMY_URI] = goog.userAgent.EDGE_OR_IE ? |
| 47 |
currentDirectory + '/crossdomainrpc_test.gif' : |
| 48 |
currentDirectory + '/crossdomainrpc_test.css'; |
| 49 |
|
| 50 |
goog.net.CrossDomainRpc.sendResponse( |
| 51 |
'({"result":"' + payload + '"})', |
| 52 |
true, // is JSON |
| 53 |
echo, // parameters to echo back |
| 54 |
123, // response code |
| 55 |
'{"a":1,"b":"2"}' // response headers |
| 56 |
); |
| 57 |
</script> |
| 58 |
</body> |
| 59 |
</html> |