Author: johnh
Date: Fri May 29 02:16:01 2009
New Revision: 779817
URL: http://svn.apache.org/viewvc?rev=779817&view=rev
Log:
Legacy API cleanups. Fixes transport to gadgets.rpctx.Ifpc when using legacy
protocol. Update to test harness to test legacy IFPC.
Modified:
incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js
incubator/shindig/trunk/javascript/container/rpctest_container.html
incubator/shindig/trunk/javascript/container/rpctest_gadget.html
Modified:
incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js?rev=779817&r1=779816&r2=779817&view=diff
==============================================================================
--- incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js
(original)
+++ incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js
Fri May 29 02:16:01 2009
@@ -398,7 +398,11 @@
isGadget = true;
}
}
- useLegacyProtocol['..'] = !!config.rpc.useLegacyProtocol;
+ var useLegacy = !!config.rpc.useLegacyProtocol;
+ useLegacyProtocol['..'] = useLegacy;
+ if (useLegacy) {
+ transport = gadgets.rpctx.Ifpc;
+ }
}
var requiredConfig = {
@@ -535,7 +539,7 @@
// If we are told to use the legacy format, then we must
// default to IFPC.
if (useLegacyProtocol[targetId]) {
- channel = fallbackTransport;
+ channel = gadgets.rpctx.Ifpc;
}
if (channel.call(targetId, from, rpc) === false) {
Modified: incubator/shindig/trunk/javascript/container/rpctest_container.html
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/container/rpctest_container.html?rev=779817&r1=779816&r2=779817&view=diff
==============================================================================
--- incubator/shindig/trunk/javascript/container/rpctest_container.html
(original)
+++ incubator/shindig/trunk/javascript/container/rpctest_container.html Fri May
29 02:16:01 2009
@@ -47,6 +47,18 @@
<html>
<head>
<title>gadgets.rpc Performance Tests: Container</title>
+ <script>
+ var useLegacy = (window.location.search.indexOf('&uselegacy=1') !== -1);
+ var gadgets = {};
+ gadgets.config = {
+ register: function(rpc, requiredConfig, callback) {
+ // rpc === "rpc", requiredConfig is ignored here.
+ // Just call the callback (function init(...) in rpc.js)
+ // with a dummy config object.
+ callback({ rpc: { parentRelayUrl: "", useLegacyProtocol: useLegacy }
});
+ }
+ };
+ </script>
<script language="JavaScript" type="text/javascript"
src="/gadgets/js/rpc.js?c=1&debug=1"></script>
<script language="JavaScript" type="text/javascript"
src="rpctest_perf.js"></script>
<script>
@@ -63,13 +75,14 @@
function appendGadget() {
var secret = Math.round(Math.random() * 10000000);
var container = document.getElementById("container");
+ var iframeHtml = "<iframe id='gadget' name='gadget' height=400
width=800 src='" + gadgetUrl + "?parent=" + containerRelay + "&uselegacy=" +
(useLegacy ? "1" : "0") + "#rpctoken=" + secret + "'></iframe>";
if (window.location.search.indexOf('&ua=backward') !== -1) {
// incorrect but likely widely used
gadgets.rpc.setAuthToken('gadget', secret);
- container.innerHTML = "<iframe id='gadget' name='gadget' height=400
width=800 src='" + gadgetUrl + "?parent=" + containerRelay + "#rpctoken=" +
secret + "'></iframe>";
+ container.innerHTML = iframeHtml;
} else {
// "correct" way.
- container.innerHTML = "<iframe id='gadget' name='gadget' height=400
width=800 src='" + gadgetUrl + "?parent=" + containerRelay + "#rpctoken=" +
secret + "'></iframe>";
+ container.innerHTML = iframeHtml;
gadgets.rpc.setAuthToken('gadget', secret);
}
}
Modified: incubator/shindig/trunk/javascript/container/rpctest_gadget.html
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/container/rpctest_gadget.html?rev=779817&r1=779816&r2=779817&view=diff
==============================================================================
--- incubator/shindig/trunk/javascript/container/rpctest_gadget.html (original)
+++ incubator/shindig/trunk/javascript/container/rpctest_gadget.html Fri May 29
02:16:01 2009
@@ -21,13 +21,14 @@
<title>gadgets.rpc Performance Tests: Gadget</title>
<script>
// Fake a version of gadgets.config that rpc.js uses for configuration.
+ var useLegacy = (window.location.search.indexOf('&uselegacy=1') !== -1);
var gadgets = {};
gadgets.config = {
register: function(rpc, requiredConfig, callback) {
// rpc === "rpc", requiredConfig is ignored here.
// Just call the callback (function init(...) in rpc.js)
// with a dummy config object.
- callback({ rpc: { parentRelayUrl: "" } });
+ callback({ rpc: { parentRelayUrl: "", useLegacyProtocol: useLegacy }
});
}
};
</script>