[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [flashproxy/master] Move repr to flashproxy.js from flashproxy-test.js.
commit 24fdd3b2d83328a1a0ba5e7991eca657407ec33d
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date: Tue Mar 13 10:29:35 2012 -0700
Move repr to flashproxy.js from flashproxy-test.js.
---
flashproxy-test.js | 31 -------------------------------
flashproxy.js | 31 +++++++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/flashproxy-test.js b/flashproxy-test.js
index 43f23b3..1073bab 100755
--- a/flashproxy-test.js
+++ b/flashproxy-test.js
@@ -29,37 +29,6 @@ function objects_equal(a, b)
return true;
}
-function quote(s)
-{
- return "\"" + s.replace(/([\\\"])/, "\\$1") + "\"";
-}
-
-function maybe_quote(s)
-{
- if (!/^[a-zA-Z_]\w*$/.test(s))
- return quote(s);
- else
- return s;
-}
-
-function repr(x)
-{
- if (x === null) {
- return "null";
- } else if (typeof x == "undefined") {
- return "undefined";
- } else if (typeof x == "object") {
- var elems = [];
- for (var k in x)
- elems.push(maybe_quote(k) + ": " + repr(x[k]));
- return "{ " + elems.join(", ") + " }";
- } else if (typeof x == "string") {
- return quote(x);
- } else {
- return x.toString();
- }
-}
-
var top = true;
function announce(test_name)
{
diff --git a/flashproxy.js b/flashproxy.js
index f45fd1d..263b6e3 100644
--- a/flashproxy.js
+++ b/flashproxy.js
@@ -151,6 +151,37 @@ function DummyFlashProxy()
};
}
+function quote(s)
+{
+ return "\"" + s.replace(/([\\\"])/, "\\$1") + "\"";
+}
+
+function maybe_quote(s)
+{
+ if (!/^[a-zA-Z_]\w*$/.test(s))
+ return quote(s);
+ else
+ return s;
+}
+
+function repr(x)
+{
+ if (x === null) {
+ return "null";
+ } else if (typeof x == "undefined") {
+ return "undefined";
+ } else if (typeof x == "object") {
+ var elems = [];
+ for (var k in x)
+ elems.push(maybe_quote(k) + ": " + repr(x[k]));
+ return "{ " + elems.join(", ") + " }";
+ } else if (typeof x == "string") {
+ return quote(x);
+ } else {
+ return x.toString();
+ }
+}
+
/* Are circumstances such that we should self-disable and not be a
proxy? We take a best-effort guess as to whether this device runs on
a battery or the data transfer might be expensive.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits