[tor-commits] [snowflake/master] Appease validation warning about "Unsafe assignment to innerHTML"
arlo at torproject.org
arlo at torproject.org
Wed Jun 26 22:35:40 UTC 2019
commit 055d5f18245636ec938a52ed6a2e80b5ce62d92c
Author: Arlo Breault <arlolra at gmail.com>
Date: Wed Jun 26 18:30:24 2019 -0400
Appease validation warning about "Unsafe assignment to innerHTML"
This doesn't apply to the webextension but hasn't been factored out in
the build step yet.
---
proxy/spec/ui.spec.coffee | 5 ++++-
proxy/ui.coffee | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/proxy/spec/ui.spec.coffee b/proxy/spec/ui.spec.coffee
index f1cf4b2..8769b0c 100644
--- a/proxy/spec/ui.spec.coffee
+++ b/proxy/spec/ui.spec.coffee
@@ -4,6 +4,7 @@ jasmine tests for Snowflake UI
document =
getElementById: (id) -> {}
+ createTextNode: (txt) -> txt
describe 'UI', ->
@@ -27,7 +28,9 @@ describe 'UI', ->
it 'sets status message when in debug mode', ->
u = new DebugUI()
- u.$status = { innerHTML: '' }
+ u.$status =
+ innerHTML: ''
+ appendChild: (txt) -> @innerHTML = txt
u.setStatus('test')
expect(u.$status.innerHTML).toEqual 'Status: test'
diff --git a/proxy/ui.coffee b/proxy/ui.coffee
index 4148ea8..505fa45 100644
--- a/proxy/ui.coffee
+++ b/proxy/ui.coffee
@@ -37,7 +37,10 @@ class DebugUI extends UI
# Status bar
setStatus: (msg) ->
- @$status.innerHTML = 'Status: ' + msg
+ txt = document.createTextNode('Status: ' + msg)
+ while @$status.firstChild
+ @$status.removeChild @$status.firstChild
+ @$status.appendChild txt
setActive: (connected) ->
super connected
More information about the tor-commits
mailing list