Commit d2da820 1 parent 5b47b8e commit d2da820 Copy full SHA for d2da820
File tree 5 files changed +45
-0
lines changed
5 files changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ async_test ( t => {
2
+ const script = document . createElement ( "script" ) ;
3
+ t . add_cleanup ( ( ) => script . remove ( ) ) ;
4
+ script . src = "resources/script-with-0x00-in-header.py" ;
5
+ script . onerror = t . step_func_done ( ) ;
6
+ script . onload = t . unreached_func ( ) ;
7
+ document . body . append ( script ) ;
8
+ } , "Expect network error for script with 0x00 in a header" ) ;
9
+
10
+ async_test ( t => {
11
+ const frame = document . createElement ( "iframe" ) ;
12
+ t . add_cleanup ( ( ) => frame . remove ( ) ) ;
13
+ frame . src = "resources/document-with-0x00-in-header.py" ;
14
+ // If network errors result in load events for frames per
15
+ // https://github.com/whatwg/html/issues/125 and https://github.com/whatwg/html/issues/1230 this
16
+ // should be changed to use the load event instead.
17
+ t . step_timeout ( ( ) => {
18
+ assert_equals ( frame . contentDocument , null ) ;
19
+ t . done ( ) ;
20
+ } , 1000 ) ;
21
+ document . body . append ( frame ) ;
22
+ } , "Expect network error for frame navigation to resource with 0x00 in a header" ) ;
23
+
24
+ async_test ( t => {
25
+ const img = document . createElement ( "img" ) ;
26
+ t . add_cleanup ( ( ) => img . remove ( ) ) ;
27
+ img . src = "resources//blue-with-0x00-in-a-header.asis" ;
28
+ img . onerror = t . step_func_done ( ) ;
29
+ img . onload = t . unreached_func ( ) ;
30
+ document . body . append ( img ) ;
31
+ } , "Expect network error for image with 0x00 in a header" ) ;
Original file line number Diff line number Diff line change
1
+ ` blue-with-0x00-in-a-header.asis ` is a copy from ` ../../images/blue.png ` with the following prepended using Control Pictures to signify actual newlines and 0x00:
2
+ ```
3
+ HTTP/1.1 200 AN IMAGE␍␊
4
+ Content-Type: image/png␍␊
5
+ Custom: ␀␍␊␍␊
6
+ ```
Original file line number Diff line number Diff line change
1
+ def main (request , response ):
2
+ response .headers .set ("Content-Type" , "text/html" )
3
+ response .headers .set ("Custom" , "\0 " )
4
+ return "<!doctype html><b>This is irrelevant.</b>"
Original file line number Diff line number Diff line change
1
+ def main (request , response ):
2
+ response .headers .set ("Content-Type" , "text/javascript" )
3
+ response .headers .set ("Custom" , "\0 " )
4
+ return "var irrelevant = 0"
You can’t perform that action at this time.
0 commit comments