Commit 72308ecf authored by ukai@chromium.org's avatar ukai@chromium.org

Revert 86573 - Add separate nonce version of connect calls to ChromotingScriptableObject.

It causes PPAPITest.Transport failure on Vista

BUG=none
TEST=manual


Review URL: http://codereview.chromium.org/7042022

TBR=garykac@chromium.org
Review URL: http://codereview.chromium.org/7069005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86575 0039d316-1c4b-4281-b951-d872f2087c98
parent 6e3410ae
...@@ -54,7 +54,8 @@ function registerConnection() { ...@@ -54,7 +54,8 @@ function registerConnection() {
var clientjid = xhr.responseText; var clientjid = xhr.responseText;
chromoting.plugin.sendIq = sendIq; chromoting.plugin.sendIq = sendIq;
chromoting.plugin.connect(chromoting.hostjid, clientjid); // TODO:(jamiewalch): Pass in the correct nonce.
chromoting.plugin.connectSandboxed(clientjid, chromoting.hostjid);
// TODO(ajwong): This should just be feedIq(); // TODO(ajwong): This should just be feedIq();
window.setTimeout(feedIq, 1000); window.setTimeout(feedIq, 1000);
} else { } else {
...@@ -131,8 +132,9 @@ function init() { ...@@ -131,8 +132,9 @@ function init() {
if (chromoting.connectMethod == "sandboxed") { if (chromoting.connectMethod == "sandboxed") {
registerConnection(); registerConnection();
} else { } else {
plugin.connectUnsandboxed(chromoting.hostjid, chromoting.username, // TODO:(jamiewalch): Pass in the correct nonce.
chromoting.talkToken); plugin.connect(chromoting.username, chromoting.hostjid,
chromoting.talkToken, '');
} }
} else { } else {
addToDebugLog('ERROR: chromoting plugin not loaded'); addToDebugLog('ERROR: chromoting plugin not loaded');
......
...@@ -85,8 +85,8 @@ void ChromotingScriptableObject::Init() { ...@@ -85,8 +85,8 @@ void ChromotingScriptableObject::Init() {
AddAttribute(kRoundTripLatencyAttribute, Var()); AddAttribute(kRoundTripLatencyAttribute, Var());
AddMethod("connect", &ChromotingScriptableObject::DoConnect); AddMethod("connect", &ChromotingScriptableObject::DoConnect);
AddMethod("connectUnsandboxed", AddMethod("connectSandboxed",
&ChromotingScriptableObject::DoConnectUnsandboxed); &ChromotingScriptableObject::DoConnectSandboxed);
AddMethod("disconnect", &ChromotingScriptableObject::DoDisconnect); AddMethod("disconnect", &ChromotingScriptableObject::DoDisconnect);
AddMethod("submitLoginInfo", &ChromotingScriptableObject::DoSubmitLogin); AddMethod("submitLoginInfo", &ChromotingScriptableObject::DoSubmitLogin);
AddMethod("setScaleToFit", &ChromotingScriptableObject::DoSetScaleToFit); AddMethod("setScaleToFit", &ChromotingScriptableObject::DoSetScaleToFit);
...@@ -327,100 +327,79 @@ void ChromotingScriptableObject::SendIq(const std::string& message_xml) { ...@@ -327,100 +327,79 @@ void ChromotingScriptableObject::SendIq(const std::string& message_xml) {
cb.Call(Var(), Var(message_xml), &exception); cb.Call(Var(), Var(message_xml), &exception);
if (!exception.is_undefined()) if (!exception.is_undefined())
LogDebugInfo("Exception when invoking sendiq JS callback."); LogDebugInfo("Exception when invoking loginChallenge JS callback.");
} }
Var ChromotingScriptableObject::DoConnect(const std::vector<Var>& args, Var ChromotingScriptableObject::DoConnect(const std::vector<Var>& args,
Var* exception) { Var* exception) {
// Parameter order is: if (args.size() != 4) {
// host_jid *exception = Var("Usage: connect(username, host_jid, auth_token)");
// client_jid
// access_code (optional)
unsigned int arg = 0;
if (!args[arg].is_string()) {
*exception = Var("The host_jid must be a string.");
return Var(); return Var();
} }
std::string host_jid = args[arg++].AsString();
if (!args[arg].is_string()) { ClientConfig config;
*exception = Var("The client_jid must be a string.");
if (!args[0].is_string()) {
*exception = Var("The username must be a string.");
return Var(); return Var();
} }
std::string client_jid = args[arg++].AsString(); config.username = args[0].AsString();
std::string access_code; if (!args[1].is_string()) {
if (args.size() > arg) { *exception = Var("The host_jid must be a string.");
if (!args[arg].is_string()) { return Var();
*exception = Var("The access code must be a string.");
return Var();
}
access_code = args[arg++].AsString();
} }
config.host_jid = args[1].AsString();
if (args.size() != arg) { if (!args[2].is_string()) {
*exception = Var("Too many agruments passed to connect()."); *exception = Var("The auth_token must be a string.");
return Var(); return Var();
} }
config.auth_token = args[2].AsString();
if (!args[3].is_string()) {
*exception = Var("nonce must be a string.");
return Var();
}
config.nonce = args[3].AsString();
LogDebugInfo("Connecting to host."); LogDebugInfo("Connecting to host.");
VLOG(1) << "client_jid: " << client_jid << ", host_jid: " << host_jid instance_->Connect(config);
<< ", access_code: " << access_code;
instance_->ConnectSandboxed(client_jid, host_jid, access_code);
return Var(); return Var();
} }
Var ChromotingScriptableObject::DoConnectUnsandboxed( Var ChromotingScriptableObject::DoConnectSandboxed(
const std::vector<Var>& args, const std::vector<Var>& args, Var* exception) {
Var* exception) { if (args.size() != 3) {
// Parameter order is: *exception = Var("Usage: connectSandboxed(your_jid, host_jid, nonce)");
// host_jid
// username
// xmpp_token
// access_code (optional)
unsigned int arg = 0;
if (!args[arg].is_string()) {
*exception = Var("The host_jid must be a string.");
return Var(); return Var();
} }
std::string host_jid = args[arg++].AsString();
if (!args[arg].is_string()) { std::string your_jid;
*exception = Var("The username must be a string."); if (!args[0].is_string()) {
*exception = Var("your_jid must be a string.");
return Var(); return Var();
} }
std::string username = args[arg++].AsString(); your_jid = args[0].AsString();
if (!args[arg].is_string()) { std::string host_jid;
*exception = Var("The auth_token must be a string."); if (!args[1].is_string()) {
*exception = Var("host_jid must be a string.");
return Var(); return Var();
} }
std::string auth_token = args[arg++].AsString(); host_jid = args[1].AsString();
std::string access_code;
if (args.size() > arg) {
if (!args[arg].is_string()) {
*exception = Var("The access code must be a string.");
return Var();
}
access_code = args[arg++].AsString();
}
if (args.size() != arg) { std::string nonce;
*exception = Var("Too many agruments passed to connect()."); if (!args[2].is_string()) {
*exception = Var("nonce must be a string.");
return Var(); return Var();
} }
nonce = args[2].AsString();
LogDebugInfo("Connecting to host."); VLOG(1) << "your_jid: " << your_jid << ", host_jid: " << host_jid
ClientConfig config; << ", nonce: " << nonce;
config.host_jid = host_jid; instance_->ConnectSandboxed(your_jid, host_jid, nonce);
config.username = username;
config.auth_token = auth_token;
config.nonce = access_code;
VLOG(1) << "host_jid: " << host_jid << ", username: " << username
<< ", access_code: " << access_code;
instance_->Connect(config);
return Var(); return Var();
} }
......
...@@ -74,16 +74,12 @@ ...@@ -74,16 +74,12 @@
// //
// // Methods for establishing a Chromoting connection. // // Methods for establishing a Chromoting connection.
// // // //
// // When using the sandboxed versions, sendIq must be set and responses to // // Either use connect() or connectSandboxed(), not both. If using
// // calls on sendIq must be piped back into onIq(). // // connectSandboxed(), sendIq must be set, and responses to calls on
// void connect(string host_jid, string client_jid, // // sendIq must be piped back into onIq().
// optional string access_code); // void connect(string username, string host_jid, string auth_token,
// // Non-sandboxed version used for debugging/testing. // string nonce);
// // TODO(garykac): Remove this version once we no longer need it. // void connectSandboxed(string your_jid, string host_jid, string nonce);
// void connectUnsandboxed(string host_jid, string username,
// string xmpp_token, optional string access_code);
//
// // Terminating a Chromoting connection.
// void disconnect(); // void disconnect();
// //
// // Method for submitting login information. // // Method for submitting login information.
...@@ -197,8 +193,8 @@ class ChromotingScriptableObject ...@@ -197,8 +193,8 @@ class ChromotingScriptableObject
void SignalDesktopSizeChange(); void SignalDesktopSizeChange();
pp::Var DoConnect(const std::vector<pp::Var>& args, pp::Var* exception); pp::Var DoConnect(const std::vector<pp::Var>& args, pp::Var* exception);
pp::Var DoConnectUnsandboxed(const std::vector<pp::Var>& args, pp::Var DoConnectSandboxed(const std::vector<pp::Var>& args,
pp::Var* exception); pp::Var* exception);
pp::Var DoDisconnect(const std::vector<pp::Var>& args, pp::Var* exception); pp::Var DoDisconnect(const std::vector<pp::Var>& args, pp::Var* exception);
// This method is called by JS to provide login information. // This method is called by JS to provide login information.
......
...@@ -55,8 +55,8 @@ function registerConnection() { ...@@ -55,8 +55,8 @@ function registerConnection() {
var clientjid = xhr.responseText; var clientjid = xhr.responseText;
remoting.plugin.sendIq = sendIq; remoting.plugin.sendIq = sendIq;
remoting.plugin.connect(remoting.hostjid, clientjid, remoting.plugin.connectSandboxed(clientjid, remoting.hostjid,
remoting.accessCode); remoting.accessCode);
// TODO(ajwong): This should just be feedIq(); // TODO(ajwong): This should just be feedIq();
window.setTimeout(feedIq, 1000); window.setTimeout(feedIq, 1000);
} else { } else {
...@@ -123,8 +123,8 @@ function init() { ...@@ -123,8 +123,8 @@ function init() {
if (remoting.connectMethod == 'sandboxed') { if (remoting.connectMethod == 'sandboxed') {
registerConnection(); registerConnection();
} else { } else {
plugin.connectUnsandboxed(remoting.hostjid, remoting.username, plugin.connect(remoting.username, remoting.hostjid,
remoting.xmppAuthToken, remoting.accessCode); remoting.xmppAuthToken, remoting.accessCode);
} }
} else { } else {
addToDebugLog('ERROR: remoting plugin not loaded'); addToDebugLog('ERROR: remoting plugin not loaded');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment