Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r1083 committed - Ask JS for the hostname twice...

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r1083 committed - Ask JS for the hostname twice...


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r1083 committed - Ask JS for the hostname twice...
  • Date: Tue, 17 Jun 2014 20:39:40 +0000

Revision: 1083
Author:

Date: Tue Jun 17 20:39:28 2014 UTC
Log: Ask JS for the hostname twice

Ask twice so that JS has time to do an
AJAX request to find the hostname.


http://code.google.com/p/ndt/source/detail?r=1083

Modified:
/branches/Issue144Staging/flash-client/src/NDTPController.as
/branches/Issue144Staging/flash-client/src/NDTUtils.as

=======================================
--- /branches/Issue144Staging/flash-client/src/NDTPController.as Wed May 28 11:17:18 2014 UTC
+++ /branches/Issue144Staging/flash-client/src/NDTPController.as Tue Jun 17 20:39:28 2014 UTC
@@ -23,6 +23,7 @@
import flash.system.Security;
import flash.utils.Timer;
import mx.resources.ResourceManager;
+ import flash.external.ExternalInterface;

/**
* This class creates (and closes) the Control socket with the server and
@@ -70,6 +71,13 @@
} else {
TestResults.clearResults();
}
+
+ var js_server_hostname:String = NDTUtils.hostnameFromJS();
+ if (js_server_hostname) {
+ Main.server_hostname = js_server_hostname;
+ _hostname = Main.server_hostname;
+ }
+
TestResults.recordStartTime();
TestResults.ndt_test_results::ndtTestFailed = false;
TestResults.ndt_test_results::ndtErrStatus = "Test in progress.";
=======================================
--- /branches/Issue144Staging/flash-client/src/NDTUtils.as Wed May 28 11:17:18 2014 UTC
+++ /branches/Issue144Staging/flash-client/src/NDTUtils.as Tue Jun 17 20:39:28 2014 UTC
@@ -59,6 +59,29 @@
}
}
}
+
+ /**
+ * Function that initializes the NDT server variable.
+ */
+ public static function hostnameFromJS():String {
+ try {
+ var js_server_hostname:String = ExternalInterface.call("getNDTServer");
+ if (js_server_hostname) {
+ TestResults.appendDebugMsg(
+ "Initialized server from JavaScript. Server hostname:"
+ + Main.server_hostname);
+ } else {
+ js_server_hostname = null;
+ }
+ return js_server_hostname;
+ } catch(e:Error) {
+ TestResults.appendDebugMsg("Failed to call getNDTServer(): "
+ + e.toString());
+ return null;
+ }
+ return null;
+ }
+
/**
* Function that reads the HTML parameter tags for the SWF file and
* initializes the variables in the SWF accordingly.
@@ -95,17 +118,9 @@
+ e.toString());
}

- try {
- var js_server_hostname:String = ExternalInterface.call("getNDTServer");
- if (js_server_hostname) {
- Main.server_hostname = js_server_hostname;
- TestResults.appendDebugMsg(
- "Initialized server from JavaScript. Server hostname:"
- + Main.server_hostname);
- }
- } catch(e:Error) {
- TestResults.appendDebugMsg("Failed to call getNDTServer(): "
- + e.toString());
+ var js_server_hostname:String = hostnameFromJS();
+ if (js_server_hostname) {
+ Main.server_hostname = js_server_hostname;
}

try {


  • [ndt-dev] [ndt] r1083 committed - Ask JS for the hostname twice..., ndt, 06/17/2014

Archive powered by MHonArc 2.6.16.

Top of Page