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