Skip to content

Commit

Permalink
An extension of single-byte-decoder.html that tackles CSS (not finished)
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Nov 18, 2014
1 parent 4fda36d commit 02ac3d3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions encoding/resources/single-byte-raw-css-loader.py
@@ -0,0 +1,3 @@
def main(request, response):
response.headers.set("Content-Type", "text/html;charset=utf-8")
response.content = "<!doctype html><link rel=stylesheet href=single-byte-raw-css.py?label=" + request.GET.first("label") + ">"
10 changes: 10 additions & 0 deletions encoding/resources/single-byte-raw-css.py
@@ -0,0 +1,10 @@
def main(request, response):
response.headers.set("Content-Type", "text/css;charset=" + request.GET.first("label"))
bytes = []
for byte in xrange(255):
if byte in [0x0A, 0x0C, 0x0D, 0x22, 0x5C]:
bytes.append(chr(0x5C))
bytes.append(chr(byte))
else:
bytes.append(chr(byte))
response.content = "body::before { content:\"" + "".join(bytes) + "\" }"
11 changes: 11 additions & 0 deletions encoding/single-byte-decoder.html
Expand Up @@ -171,6 +171,17 @@
t.add_cleanup(function() { document.body.removeChild(frame) })
document.body.appendChild(frame)
}, encoding.name + ": " + label + " (document.characterSet)")

async_test(function(t) {
var frame = document.createElement("iframe"),
name = encoding.name
frame.src = "resources/single-byte-raw-css-loader.py?label=" + label
frame.onload = t.step_func_done(function() {
assert_equals(frame.contentWindow.getComputedStyle(frame.contentDocument.body, "::before").content, "x")
})
t.add_cleanup(function() { document.body.removeChild(frame) })
document.body.appendChild(frame)
}, encoding.name + ": " + label + " (CSS)")
}
}
</script>

0 comments on commit 02ac3d3

Please sign in to comment.