[tor-commits] [flashproxy/js] Better handling of null in JS tests.

dcf at torproject.org dcf at torproject.org
Tue Mar 13 17:58:28 UTC 2012


commit 341de85c4475b47bc7d53c4896d9b325792f641a
Author: David Fifield <david at bamsoftware.com>
Date:   Mon Mar 12 22:28:43 2012 -0700

    Better handling of null in JS tests.
    
    I read somewhere that (typeof null) is null, but that seems not to be
    the case (I get "object").
---
 flashproxy-test.js |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/flashproxy-test.js b/flashproxy-test.js
index e4a59b9..ca68f85 100755
--- a/flashproxy-test.js
+++ b/flashproxy-test.js
@@ -10,6 +10,8 @@ load("flashproxy.js");
 
 function objects_equal(a, b)
 {
+    if ((a === null) != (b === null))
+        return false;
     if (typeof a != typeof b)
         return false;
     if (typeof a != "object")
@@ -42,7 +44,7 @@ function maybe_quote(s)
 
 function repr(x)
 {
-    if (typeof x === null) {
+    if (x === null) {
         return "null";
     } else if (typeof x == "undefined") {
         return "undefined";





More information about the tor-commits mailing list