commit 01457476fab19acd8b8c620632469b0830473015 Author: David Fifield david@bamsoftware.com Date: Sun Jun 23 18:41:44 2013 -0700
Allow console.debug even if debug_div is unset.
Part of Arlo's patch for a Node.js port. Debug messages can go to the (system) console without a DOM element to write them to. --- proxy/flashproxy.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/proxy/flashproxy.js b/proxy/flashproxy.js index 8a70c60..cd80c6d 100644 --- a/proxy/flashproxy.js +++ b/proxy/flashproxy.js @@ -94,18 +94,20 @@ if (DEBUG) { }
function puts(s) { - if (debug_div) { - var at_bottom; - + if (DEBUG) { /* This shows up in the Web Console in Firefox and F12 developer tools in Internet Explorer. */ (console.debug || console.log).call(console, s);
- /* http://www.w3.org/TR/cssom-view/#element-scrolling-members */ - at_bottom = (debug_div.scrollTop + debug_div.clientHeight === debug_div.scrollHeight); - debug_div.appendChild(document.createTextNode(s + "\n")); - if (at_bottom) - debug_div.scrollTop = debug_div.scrollHeight; + if (debug_div) { + var at_bottom; + + /* http://www.w3.org/TR/cssom-view/#element-scrolling-members */ + at_bottom = (debug_div.scrollTop + debug_div.clientHeight === debug_div.scrollHeight); + debug_div.appendChild(document.createTextNode(s + "\n")); + if (at_bottom) + debug_div.scrollTop = debug_div.scrollHeight; + } } }
tor-commits@lists.torproject.org