code: protected Object checkUndefined(Object val) {
          if (val instanceof String && ((String) val).equals("undefined")) {
              return null;
          }
          return val;
      }
docs: JSObject will return the String "undefined" at certain times, so we
  need to make sure we're not getting a value that looks valid, but isn't.
  
  @param val The value from Javascript to be checked.
  @return Either null or the value passed in.