mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #6216 - Ms2ger:wpt_20150529, r=Manishearth
<!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6216) <!-- Reviewable:end -->
This commit is contained in:
commit
ab1ba0239d
1617 changed files with 57062 additions and 2789 deletions
|
@ -1,6 +1,5 @@
|
|||
[2d.path.arcTo.shape.curve1.html]
|
||||
type: testharness
|
||||
[arcTo() curves in the right kind of shape]
|
||||
expected:
|
||||
FAIL
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
[2d.path.arcTo.shape.curve2.html]
|
||||
type: testharness
|
||||
[arcTo() curves in the right kind of shape]
|
||||
expected:
|
||||
FAIL
|
||||
expected: FAIL
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,5 @@
|
|||
[NodeIterator.html]
|
||||
type: testharness
|
||||
|
||||
[Propagate exception from filter function]
|
||||
expected: FAIL
|
||||
|
||||
|
||||
|
|
|
@ -5,3 +5,4 @@
|
|||
|
||||
[editable elements are focusable]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
5b47db447d3151df5c84f2d5042680b32cccf1a8
|
||||
0756a1f3b4c192a6794c70c6dc1f28f1e689f19e
|
|
@ -2,3 +2,4 @@
|
|||
type: testharness
|
||||
[ scheduler: adding async attribute at runtime]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
type: testharness
|
||||
[scheduler: altering the type attribute and adding/removing external script with async=false ]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
type: testharness
|
||||
[scheduler: altering the type attribute and changing script data external script async=false ]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -3,3 +3,4 @@
|
|||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get closed]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[W3C WebSocket API - Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be closed]
|
||||
expected: NOTRUN
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Create-Secure-valid-url-array-protocols.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and array of protocol strings - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and array of protocol strings - Connection should be closed]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - wsocket.binaryType should be set to 'blob' after connection is established - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[W3C WebSocket API - Create Secure WebSocket - wsocket.binaryType should be set to 'blob' after connection is established - Connection should be closed]
|
||||
expected: NOTRUN
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and protocol string - protocol should be set correctly - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and protocol string - Connection should be closed]
|
||||
expected: NOTRUN
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Create-Secure-valid-url-protocol-string.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Check readyState is 1]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and protocol string - Connection should be closed]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Create-Secure-valid-url.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Pass a valid URL - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Create Secure WebSocket - Pass a valid URL - Connection should be closed]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[Create-Secure-verify-url-set-non-default-port.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
|
@ -1,6 +0,0 @@
|
|||
[Secure-Close-0.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(0) - INVALID_ACCESS_ERR is thrown]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Close-1000-reason.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000, reason) - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Close-1000-verify-code.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000, reason) - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000, reason) - event.code == 1000 and event.reason = 'Clean Close']
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Close-1000.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000) - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Close-1005-verify-code.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close() - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close() - return close code is 1005 - Connection should be closed]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
[Secure-Close-1005.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1005) - see '7.1.5. The WebSocket Connection Close Code' in http://www.ietf.org/rfc/rfc6455.txt]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[Secure-Close-2999-reason.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(2999, reason) - INVALID_ACCESS_ERR is thrown]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Close-3000-reason.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Close-3000-verify-code.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - verify return code is 3000 - Connection should be closed]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Close-4999-reason.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(4999, reason) - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(4999, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
[Secure-Close-NaN.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create WebSocket - Close the Connection - close(NaN) - INVALID_ACCESS_ERR is thrown]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[Secure-Close-Reason-124Bytes.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(code, 'reason more than 123 bytes') - SYNTAX_ERR is thrown]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Close-Reason-Unpaired-surrogates.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get closed]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
[Secure-Close-null.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create WebSocket - Close the Connection - close(null) - INVALID_ACCESS_ERR is thrown]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[Secure-Close-onlyReason.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(only reason) - INVALID_ACCESS_ERR is thrown]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Close-readyState-Closed.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
[Secure-Close-readyState-Closing.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Close the Connection - readyState should be in CLOSING state just before onclose is called]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Close-server-initiated-close.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create Secure WebSocket - Server initiated Close - Client sends back a CLOSE - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Create Secure WebSocket - Server initiated Close - Client sends back a CLOSE - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
[Secure-Close-string.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Create WebSocket - Close the Connection - close(string) - INVALID_ACCESS_ERR is thrown]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
[Secure-Close-undefined.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Close Secure WebSocket - Code is undefined]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Send 65K data on a Secure WebSocket - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[W3C WebSocket API - Send 65K data on a Secure WebSocket - Message should be received]
|
||||
expected: NOTRUN
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Send 65K binary data on a Secure WebSocket - ArrayBuffer - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[W3C WebSocket API - Send 65K binary data on a Secure WebSocket - ArrayBuffer - Message should be received]
|
||||
expected: NOTRUN
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Send binary data on a Secure WebSocket - ArrayBuffer - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[W3C WebSocket API - Send binary data on a Secure WebSocket - ArrayBuffer - Message should be received]
|
||||
expected: NOTRUN
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Send-binary-arraybufferview-float64.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float64Array - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float64Array - Message should be received]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Send-binary-arraybufferview-int32.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int32Array - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int32Array - Message should be received]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Send-binary-arraybufferview-uint16-offset-length.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint16Array with offset and length - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint16Array with offset and length - Message should be received]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Send-binary-arraybufferview-uint32-offset.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint32Array with offset - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint32Array with offset - Message should be received]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Send-binary-arraybufferview-uint8-offset-length.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset and length - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset and length - Message should be received]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Send-binary-arraybufferview-uint8-offset.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset - Message should be received]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Send-binary-blob.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Send binary data on a Secure WebSocket - Blob - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Send binary data on a Secure WebSocket - Blob - Message should be received]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Send data on a Secure WebSocket - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[W3C WebSocket API - Send data on a Secure WebSocket - Message should be received]
|
||||
expected: NOTRUN
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Send-null.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Send null data on a Secure WebSocket - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Send null data on a Secure WebSocket - Message should be received]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Send paired surrogates data on a Secure WebSocket - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[W3C WebSocket API - Send paired surrogates data on a Secure WebSocket - Message should be received]
|
||||
expected: NOTRUN
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Send unicode data on a Secure WebSocket - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[W3C WebSocket API - Send unicode data on a Secure WebSocket - Message should be received]
|
||||
expected: NOTRUN
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
[Secure-Send-unpaired-surrogates.htm]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Send unpaired surrogates on a Secure WebSocket - Connection should be opened]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Send unpaired surrogates on a Secure WebSocket - Message should be received]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -3,5 +3,7 @@
|
|||
expected: TIMEOUT
|
||||
[W3C WebSocket API - Send unpaired surrogates on a WebSocket - Message should be received]
|
||||
expected: NOTRUN
|
||||
|
||||
[W3C WebSocket API - Send unpaired surrogates on a WebSocket - Connection should be closed]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
type: testharness
|
||||
[WebSockets: converting first arguments]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -3,3 +3,4 @@
|
|||
expected: TIMEOUT
|
||||
[WebSockets: send() with unpaired surrogate when readyState is OPEN]
|
||||
expected: TIMEOUT
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ should_throw(-0.5)
|
|||
should_throw(0)
|
||||
should_throw(0.5)
|
||||
should_throw(0.8)
|
||||
should_throw(0x20000000000000)
|
||||
should_throw(0x20000000000000) // Number.MAX_SAFE_INTEGER + 1
|
||||
should_throw(NaN)
|
||||
should_throw(Infinity)
|
||||
should_throw(-Infinity)
|
||||
|
@ -43,10 +43,12 @@ should_throw({
|
|||
valueOf: function() { return {}; },
|
||||
}, 'object (third)')
|
||||
|
||||
|
||||
/* Valid */
|
||||
|
||||
function should_work(val) {
|
||||
var t = async_test("Calling open() with version argument 1.5 should not throw.")
|
||||
var name = format_value(val);
|
||||
var t = async_test("Calling open() with version argument " + name + " should not throw.")
|
||||
var rq = createdb(t, val)
|
||||
rq.onupgradeneeded = function() {
|
||||
t.done()
|
||||
|
@ -54,6 +56,7 @@ function should_work(val) {
|
|||
}
|
||||
|
||||
should_work(1.5)
|
||||
should_work(Number.MAX_SAFE_INTEGER) // 0x20000000000000 - 1
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
importScripts("/resources/testharness.js");
|
||||
importScripts("/resources/testharnessreport.js");
|
||||
importScripts("send-usp.js");
|
||||
run_test();
|
||||
done();
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
"external_host": null,
|
||||
"ports":{"http":[8000, "auto"],
|
||||
"https":[8443],
|
||||
"ws":["auto"]},
|
||||
"ws":["auto"],
|
||||
"wss":["auto"]},
|
||||
"check_subdomains": true,
|
||||
"log_level":"debug",
|
||||
"bind_hostname": true,
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
(function () {
|
||||
scriptsrc1.step(function() { assert_unreached('Unsafe inline script ran.') });
|
||||
})();
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>default-src should cascade to img-src directive</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
<script src='../support/siblingPath.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>default-src should cascade to img-src directive</h1>
|
||||
<div id='log'></div>
|
||||
|
||||
<script>
|
||||
var imgsrc = async_test("Verify cascading of default-src to img-src policy");
|
||||
var onerrorFired = false;
|
||||
</script>
|
||||
|
||||
<img id='imgfail' src=''
|
||||
onload='imgsrc.step(function() { assert_unreached("Image load was not blocked."); });'
|
||||
onerror='onerrorFired = true;'>
|
||||
<img src='../support/pass.png'
|
||||
onload='imgsrc.step(function() { assert_true(true, "Image load was blocked."); });'>
|
||||
|
||||
<script>
|
||||
document.getElementById('imgfail').src = buildSiblingPath('www1', '../support/fail.png');
|
||||
onload = function() {
|
||||
imgsrc.step(function() { assert_true(onerrorFired, "onerror handler for blocked img didn't fire");});
|
||||
imgsrc.done();
|
||||
}
|
||||
</script>
|
||||
|
||||
<script async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=default-src%20%27self%27%20%27unsafe-inline%27'></script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
||||
Cache-Control: no-store, no-cache, must-revalidate
|
||||
Cache-Control: post-check=0, pre-check=0, false
|
||||
Pragma: no-cache
|
||||
Set-Cookie: generic-0_1-img-src={{$id:uuid()}}; Path=/content-security-policy/generic/
|
||||
Content-Security-Policy: default-src 'self' 'unsafe-inline'; report-uri ../support/report.py?op=put&reportID={{$id}}
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>default-src should cascade to script-src directive</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
<script src='../support/siblingPath.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>default-src should cascade to script-src directive</h1>
|
||||
<div id='log'></div>
|
||||
|
||||
<script>
|
||||
var scriptsrc1 = async_test("Verify cascading of default-src to script-src policy: block");
|
||||
var scriptsrc2 = async_test("Verify cascading of default-src to script-src policy: allow");
|
||||
var allowedScriptRan = false;
|
||||
</script>
|
||||
|
||||
<script src='pass-0_1.js'></script>
|
||||
|
||||
<script>
|
||||
var inlineScript = document.createElement('script');
|
||||
inlineScript.src = buildSiblingPath('www1', 'fail-0_1.js');
|
||||
document.getElementById('log').appendChild(inlineScript);
|
||||
onload = function() {
|
||||
scriptsrc1.done();
|
||||
scriptsrc2.step( function() { assert_true(allowedScriptRan, "allowed script didn't run") });
|
||||
scriptsrc2.done();
|
||||
}
|
||||
</script>
|
||||
|
||||
<script async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=default-src%20%27self%27%20%27unsafe-inline%27'></script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
||||
Cache-Control: no-store, no-cache, must-revalidate
|
||||
Cache-Control: post-check=0, pre-check=0, false
|
||||
Pragma: no-cache
|
||||
Set-Cookie: generic-0_1-script-src={{$id:uuid()}}; Path=/content-security-policy/generic/
|
||||
Content-Security-Policy: default-src 'self' 'unsafe-inline'; report-uri ../support/report.py?op=put&reportID={{$id}}
|
|
@ -0,0 +1,3 @@
|
|||
(function () {
|
||||
allowedScriptRan = true;
|
||||
})();
|
|
@ -7,7 +7,7 @@
|
|||
<script src='inlineTests.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Inline script should not run without 'unsafe-inline' script-src directive.</h1>
|
||||
<h1>Inline script should not run without 'unsafe-inline' script-src directive, even for script-src 'self'.</h1>
|
||||
<div id='log'></div>
|
||||
|
||||
<script>
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Inline script should not run without 'unsafe-inline' script-src directive.</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
<script src='inlineTests.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Inline script should not run without 'unsafe-inline' script-src directive, even for script-src *.</h1>
|
||||
<div id='log'></div>
|
||||
|
||||
<script>
|
||||
t1.step(function() {assert_unreached('Unsafe inline script ran.');});
|
||||
</script>
|
||||
|
||||
<img src='doesnotexist.jpg' onerror='t2.step(function() { assert_unreached("Unsafe inline event handler ran.") });'>
|
||||
|
||||
<script async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=script-src%20%27self%27'></script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
||||
Cache-Control: no-store, no-cache, must-revalidate
|
||||
Cache-Control: post-check=0, pre-check=0, false
|
||||
Pragma: no-cache
|
||||
Set-Cookie: script-src-1_2={{$id:uuid()}}; Path=/content-security-policy/script-src/
|
||||
Content-Security-Policy: script-src *; report-uri ../support/report.py?op=put&reportID={{$id}}
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>setTimeout() and setInterval() should not run without 'unsafe-eval' script-src directive.</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>setTimeout() and setInterval() should not run without 'unsafe-eval' script-src directive.</h1>
|
||||
<div id='log'></div>
|
||||
|
||||
<script>
|
||||
var t1 = async_test("window.setTimeout()");
|
||||
var t2 = async_test("window.setInterval()");
|
||||
|
||||
onload = function() {t1.done(); t2.done()}
|
||||
|
||||
window.setTimeout('t1.step(function() {assert_unreached("window.setTimeout() ran without unsafe-eval.")})',0);
|
||||
window.setInterval('t2.step(function() {assert_unreached("window.setInterval() ran without unsafe-eval.")})',0);
|
||||
|
||||
</script>
|
||||
|
||||
<script async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=script-src%20%27self%27+%27unsafe-eval%27'></script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
||||
Cache-Control: no-store, no-cache, must-revalidate
|
||||
Cache-Control: post-check=0, pre-check=0, false
|
||||
Pragma: no-cache
|
||||
Set-Cookie: script-src-1_4_1={{$id:uuid()}}; Path=/content-security-policy/script-src/
|
||||
Content-Security-Policy: script-src 'self' 'unsafe-inline'; report-uri ../support/report.py?op=put&reportID={{$id}}
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Function() called as a constructor should throw without 'unsafe-eval' script-src directive.</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Function() called as a constructor should throw without 'unsafe-eval' script-src directive.</h1>
|
||||
<div id='log'></div>
|
||||
|
||||
<script>
|
||||
|
||||
test(function() {
|
||||
assert_throws(
|
||||
new EvalError(),
|
||||
function() {
|
||||
var funq = new Function('');
|
||||
funq();
|
||||
})}, "Unsafe eval ran in Function() constructor.");
|
||||
|
||||
</script>
|
||||
|
||||
<script async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=script-src%20%27self%27+%27unsafe-inline%27'></script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
||||
Cache-Control: no-store, no-cache, must-revalidate
|
||||
Cache-Control: post-check=0, pre-check=0, false
|
||||
Pragma: no-cache
|
||||
Set-Cookie: script-src-1_4_2={{$id:uuid()}}; Path=/content-security-policy/script-src/
|
||||
Content-Security-Policy: script-src 'self' 'unsafe-inline'; report-uri ../support/report.py?op=put&reportID={{$id}}
|
|
@ -0,0 +1,5 @@
|
|||
buildSiblingPath = function(hostPrefix, relativePath, newPort) {
|
||||
var port = newPort ? newPort : document.location.port;
|
||||
var path = document.location.pathname.substring(0, document.location.pathname.lastIndexOf('/') + 1);
|
||||
return (document.location.protocol + '//' + hostPrefix + "." + document.location.hostname + ':' + port + path + relativePath);
|
||||
};
|
|
@ -0,0 +1,73 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>CharacterData.data</title>
|
||||
<link rel=help href="https://dom.spec.whatwg.org/#dom-characterdata-data">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
function testNode(create, type) {
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
assert_equals(node.length, 4)
|
||||
}, type + ".data initial value")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.data = null;
|
||||
assert_equals(node.data, "")
|
||||
assert_equals(node.length, 0)
|
||||
}, type + ".data = null")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.data = undefined;
|
||||
assert_equals(node.data, "undefined")
|
||||
assert_equals(node.length, 9)
|
||||
}, type + ".data = undefined")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.data = 0;
|
||||
assert_equals(node.data, "0")
|
||||
assert_equals(node.length, 1)
|
||||
}, type + ".data = 0")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.data = "";
|
||||
assert_equals(node.data, "")
|
||||
assert_equals(node.length, 0)
|
||||
}, type + ".data = ''")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.data = "--";
|
||||
assert_equals(node.data, "--")
|
||||
assert_equals(node.length, 2)
|
||||
}, type + ".data = '--'")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.data = "資料";
|
||||
assert_equals(node.data, "資料")
|
||||
assert_equals(node.length, 2)
|
||||
}, type + ".data = '資料'")
|
||||
}
|
||||
|
||||
testNode(function() { return document.createTextNode("test") }, "Text")
|
||||
testNode(function() { return document.createComment("test") }, "Comment")
|
||||
</script>
|
|
@ -7,24 +7,147 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
function testNode(node) {
|
||||
function testNode(create, type) {
|
||||
// Step 2.
|
||||
test(function() {
|
||||
assert_throws("INDEX_SIZE_ERR", function() { node.replaceData(5, 1, "x") })
|
||||
assert_throws("INDEX_SIZE_ERR", function() { node.replaceData(5, 0, "") })
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
assert_throws("IndexSizeError", function() { node.replaceData(5, 1, "x") })
|
||||
assert_throws("IndexSizeError", function() { node.replaceData(5, 0, "") })
|
||||
assert_throws("IndexSizeError", function() { node.replaceData(-1, 1, "x") })
|
||||
assert_throws("IndexSizeError", function() { node.replaceData(-1, 0, "") })
|
||||
assert_equals(node.data, "test")
|
||||
}, type + ".replaceData() with invalid offset")
|
||||
|
||||
// Step 3.
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(2, 10, "yo")
|
||||
assert_equals(node.data, "teyo")
|
||||
})
|
||||
}, type + ".replaceData() with clamped count")
|
||||
|
||||
test(function() {
|
||||
node.data = "test"
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(2, -1, "yo")
|
||||
assert_equals(node.data, "teyo")
|
||||
}, type + ".replaceData() with negative clamped count")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(0, 0, "yo")
|
||||
assert_equals(node.data, "yotest")
|
||||
}, type + ".replaceData() before the start")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(0, 2, "y")
|
||||
assert_equals(node.data, "yst")
|
||||
}, type + ".replaceData() at the start (shorter)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(0, 2, "yo")
|
||||
assert_equals(node.data, "yost")
|
||||
}, type + ".replaceData() at the start (equal length)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(0, 2, "yoa")
|
||||
assert_equals(node.data, "yoast")
|
||||
}, type + ".replaceData() at the start (longer)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(1, 2, "o")
|
||||
assert_equals(node.data, "tot")
|
||||
}, type + ".replaceData() in the middle (shorter)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(1, 2, "yo")
|
||||
assert_equals(node.data, "tyot")
|
||||
}, type + ".replaceData() in the middle (equal length)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(1, 1, "waddup")
|
||||
assert_equals(node.data, "twaddupst")
|
||||
node.replaceData(1, 1, "yup")
|
||||
assert_equals(node.data, "tyupaddupst")
|
||||
})
|
||||
}, type + ".replaceData() in the middle (longer)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(1, 20, "yo")
|
||||
assert_equals(node.data, "tyo")
|
||||
}, type + ".replaceData() at the end (shorter)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(2, 20, "yo")
|
||||
assert_equals(node.data, "teyo")
|
||||
}, type + ".replaceData() at the end (same length)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(4, 20, "yo")
|
||||
assert_equals(node.data, "testyo")
|
||||
}, type + ".replaceData() at the end (longer)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(0, 4, "quux")
|
||||
assert_equals(node.data, "quux")
|
||||
}, type + ".replaceData() the whole string")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(0, 4, "")
|
||||
assert_equals(node.data, "")
|
||||
}, type + ".replaceData() with the empty string")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.data = "This is the character data test, append 資料,更多資料";
|
||||
|
||||
node.replaceData(33, 6, "other");
|
||||
assert_equals(node.data, "This is the character data test, other 資料,更多資料");
|
||||
node.replaceData(44, 2, "文字");
|
||||
assert_equals(node.data, "This is the character data test, other 資料,更多文字");
|
||||
}, type + ".replaceData() with non-ASCII data")
|
||||
}
|
||||
test(function() {
|
||||
testNode(document.createTextNode("test"))
|
||||
testNode(document.createComment("test"))
|
||||
})
|
||||
|
||||
testNode(function() { return document.createTextNode("test") }, "Text")
|
||||
testNode(function() { return document.createComment("test") }, "Comment")
|
||||
</script>
|
||||
|
|
|
@ -27,6 +27,22 @@
|
|||
assert_equals(document.getElementById(""), null);
|
||||
}, "Calling document.getElementById with an empty string argument.");
|
||||
|
||||
test(function() {
|
||||
var element = document.createElement("div");
|
||||
element.setAttribute("id", "null");
|
||||
document.body.appendChild(element);
|
||||
this.add_cleanup(function() { document.body.removeChild(element) });
|
||||
assert_equals(document.getElementById(null), element);
|
||||
}, "Calling document.getElementById with a null argument.");
|
||||
|
||||
test(function() {
|
||||
var element = document.createElement("div");
|
||||
element.setAttribute("id", "undefined");
|
||||
document.body.appendChild(element);
|
||||
this.add_cleanup(function() { document.body.removeChild(element) });
|
||||
assert_equals(document.getElementById(undefined), element);
|
||||
}, "Calling document.getElementById with an undefined argument.");
|
||||
|
||||
|
||||
test(function() {
|
||||
var bar = document.getElementById("test1");
|
||||
|
|
|
@ -39,20 +39,20 @@ typedef EventHandlerNonNull? EventHandler;
|
|||
"use strict";
|
||||
var idlArray;
|
||||
setup(function() {
|
||||
idlArray = new IdlArray();
|
||||
[].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) {
|
||||
if (node.className == "untested") {
|
||||
idlArray.add_untested_idls(node.textContent);
|
||||
} else {
|
||||
idlArray.add_idls(node.textContent);
|
||||
}
|
||||
});
|
||||
idlArray = new IdlArray();
|
||||
[].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) {
|
||||
if (node.className == "untested") {
|
||||
idlArray.add_untested_idls(node.textContent);
|
||||
} else {
|
||||
idlArray.add_idls(node.textContent);
|
||||
}
|
||||
});
|
||||
}, {explicit_done:true});
|
||||
window.onload = function() {
|
||||
idlArray.add_objects({
|
||||
EventSource: ['new EventSource("http://foo")'],
|
||||
});
|
||||
idlArray.test();
|
||||
done();
|
||||
idlArray.add_objects({
|
||||
EventSource: ['new EventSource("http://foo")'],
|
||||
});
|
||||
idlArray.test();
|
||||
done();
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@charset "utf-8";
|
||||
.test div.ýäè {
|
||||
width: 100px;
|
||||
}
|
||||
width: 100px;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@charset "utf-8";
|
||||
.test div#box.ÜÀÚ {
|
||||
width: 100px;
|
||||
}
|
||||
width: 100px;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@charset "utf-8";
|
||||
.test div.ÜÀÚ {
|
||||
width: 100px;
|
||||
}
|
||||
width: 100px;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@charset "utf-8";
|
||||
.test div.ýäè {
|
||||
width: 100px;
|
||||
}
|
||||
width: 100px;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ function mark_diffs(expected, actual) {
|
|||
var max_length = Math.max(expected_lines.length, actual_lines.length);
|
||||
|
||||
var expected_diff = ["code", {}];
|
||||
var actual_diff = ["code", {}];
|
||||
var actual_diff = ["code", {}];
|
||||
|
||||
for (var i=0; i<max_length; i++) {
|
||||
if (expected_lines[i] === actual_lines[i]) {
|
||||
|
@ -13,12 +13,12 @@ function mark_diffs(expected, actual) {
|
|||
actual_diff.push(actual_lines[i] + "\n");
|
||||
} else {
|
||||
if (expected_lines[i]) {
|
||||
expected_diff.push(["span", {style:"color:red"}, expected_lines[i] + "\n"]);
|
||||
expected_diff.push(["span", {style:"color:red"}, expected_lines[i] + "\n"]);
|
||||
}
|
||||
if (actual_lines[i]) {
|
||||
actual_diff.push(["span", {style:"color:red"}, actual_lines[i] + "\n"]);
|
||||
if (actual_lines[i]) {
|
||||
actual_diff.push(["span", {style:"color:red"}, actual_lines[i] + "\n"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return [expected_diff, actual_diff];
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -8,29 +8,29 @@
|
|||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=named-character-references-data.js></script>
|
||||
<script>
|
||||
(function() {
|
||||
(function() {
|
||||
|
||||
function pad(string, totalCharacters) {
|
||||
return totalCharacters < string.length ? string : (Array(totalCharacters + 1).join('0') + string).slice(-totalCharacters);
|
||||
}
|
||||
function pad(string, totalCharacters) {
|
||||
return totalCharacters < string.length ? string : (Array(totalCharacters + 1).join('0') + string).slice(-totalCharacters);
|
||||
}
|
||||
|
||||
var dummy = document.createElement('p');
|
||||
var dummy = document.createElement('p');
|
||||
|
||||
Object.keys(data).forEach(function(entity) {
|
||||
var object = data[entity];
|
||||
dummy.innerHTML = entity;
|
||||
test(
|
||||
function() {
|
||||
assert_equals(
|
||||
dummy.textContent,
|
||||
object.characters
|
||||
);
|
||||
},
|
||||
entity + ' should match ' + object.codepoints.map(function(codePoint) {
|
||||
return 'U+' + pad(codePoint.toString(16).toUpperCase(), 5);
|
||||
}).join(' ')
|
||||
);
|
||||
});
|
||||
Object.keys(data).forEach(function(entity) {
|
||||
var object = data[entity];
|
||||
dummy.innerHTML = entity;
|
||||
test(
|
||||
function() {
|
||||
assert_equals(
|
||||
dummy.textContent,
|
||||
object.characters
|
||||
);
|
||||
},
|
||||
entity + ' should match ' + object.codepoints.map(function(codePoint) {
|
||||
return 'U+' + pad(codePoint.toString(16).toUpperCase(), 5);
|
||||
}).join(' ')
|
||||
);
|
||||
});
|
||||
|
||||
}());
|
||||
</script>
|
||||
}());
|
||||
</script>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
var namespaces = {
|
||||
"html":"http://www.w3.org/1999/xhtml",
|
||||
"mathml":"http://www.w3.org/1998/Math/MathML",
|
||||
"svg":"http://www.w3.org/2000/svg",
|
||||
"xlink":"http://www.w3.org/1999/xlink",
|
||||
"xml":"http://www.w3.org/XML/1998/namespace",
|
||||
"xmlns":"http://www.w3.org/2000/xmlns/"
|
||||
"html":"http://www.w3.org/1999/xhtml",
|
||||
"mathml":"http://www.w3.org/1998/Math/MathML",
|
||||
"svg":"http://www.w3.org/2000/svg",
|
||||
"xlink":"http://www.w3.org/1999/xlink",
|
||||
"xml":"http://www.w3.org/XML/1998/namespace",
|
||||
"xmlns":"http://www.w3.org/2000/xmlns/"
|
||||
};
|
||||
|
||||
var prefixes = {};
|
||||
|
@ -73,24 +73,24 @@ function test_serializer(element) {
|
|||
lines.push(format("|%s<%s>", indent_spaces, name));
|
||||
|
||||
var attributes = Array.prototype.map.call(
|
||||
element.attributes,
|
||||
function(attr) {
|
||||
var name = (attr.namespaceURI ? prefixes[attr.namespaceURI] + " " : "") +
|
||||
attr.localName;
|
||||
return [name, attr.value];
|
||||
});
|
||||
element.attributes,
|
||||
function(attr) {
|
||||
var name = (attr.namespaceURI ? prefixes[attr.namespaceURI] + " " : "") +
|
||||
attr.localName;
|
||||
return [name, attr.value];
|
||||
});
|
||||
attributes.sort(function (a, b) {
|
||||
var x = a[0];
|
||||
var y = b[0];
|
||||
if (x === y) {
|
||||
return 0;
|
||||
}
|
||||
return x > y ? 1 : -1;
|
||||
});
|
||||
var x = a[0];
|
||||
var y = b[0];
|
||||
if (x === y) {
|
||||
return 0;
|
||||
}
|
||||
return x > y ? 1 : -1;
|
||||
});
|
||||
|
||||
attributes.forEach(
|
||||
function(attr) {
|
||||
var indent_spaces = (new Array(indent + 2)).join(" ");
|
||||
var indent_spaces = (new Array(indent + 2)).join(" ");
|
||||
lines.push(format("|%s%s=\"%s\"", indent_spaces, attr[0], attr[1]));
|
||||
}
|
||||
);
|
||||
|
|
|
@ -13,9 +13,7 @@ INDENT TABS: conformance-checkers/*
|
|||
INDENT TABS: content-security-policy/*
|
||||
INDENT TABS: custom-elements/*
|
||||
INDENT TABS: DOMEvents/*
|
||||
INDENT TABS: eventsource/*
|
||||
INDENT TABS: html/editing/dnd/*
|
||||
INDENT TABS: html/syntax/*
|
||||
INDENT TABS: media-source/*
|
||||
INDENT TABS: old-tests/*
|
||||
INDENT TABS: pointerlock/*
|
||||
|
@ -101,3 +99,6 @@ PARSE-FAILED:ext-xhtml-pubid/the-xhtml-syntax/parsing-xhtml-documents/xhtml-pubi
|
|||
|
||||
# Test generation files containing print statements
|
||||
PRINT STATEMENT:dom/nodes/Document-createElement-namespace-tests/generate.py
|
||||
|
||||
# Should probably be fixed.
|
||||
W3C-TEST.ORG:subresource-integrity/refresh-header.js.headers
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>Referrer-Policy Web Platform Tests - README</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
TODO(burnik): Instructions on how to write tests for Referrer-Policy.
|
||||
</p>
|
||||
</body>
|
245
tests/wpt/web-platform-tests/referrer-policy/README.md
Normal file
245
tests/wpt/web-platform-tests/referrer-policy/README.md
Normal file
|
@ -0,0 +1,245 @@
|
|||
# Referrer-Policy Web Platform Tests
|
||||
|
||||
The Referrer-Policy tests are designed for testing browser implementations and conformance to the [W3 Referrer-Policy Specification](http://w3c.github.io/webappsec/specs/referrer-policy/).
|
||||
|
||||
## Project structure
|
||||
|
||||
The project contains tools, templates and a seed (```spec.src.json```) for generating tests. The main assertion logic resides in JS files in the root of the ```./generic/``` directory.
|
||||
|
||||
This is the overview of the project structure:
|
||||
|
||||
```
|
||||
.
|
||||
└── generic
|
||||
├── subresource - documents being served as sub-resources (python scripts)
|
||||
├── subresource-test - sanity checking tests for resource invocation
|
||||
├── template - the test files template used for generating the tests
|
||||
└── tools - for generating and maintaining the test suite
|
||||
└── (genereated_tests_for_a_specification_1)
|
||||
└── (genereated_tests_for_a_specification_2)
|
||||
└── ...
|
||||
└── (genereated_tests_for_a_specification_N)
|
||||
```
|
||||
|
||||
## The spec JSON
|
||||
|
||||
The ```spec.src.json``` defines all the test scenarios for the referrer policy.
|
||||
|
||||
Invoking ```./generic/tools/generate.py``` will parse the spec JSON and determine which tests to generate (or skip) while using templates.
|
||||
|
||||
|
||||
The spec can be validated by running ```./generic/tools/spec_validator.py```. This is specially important when you're making changes to ```spec.src.json```. Make sure it's a valid JSON (no comments or trailing commas). The validator should be informative and very specific on any issues.
|
||||
|
||||
For details about the spec JSON, see **Overview of the spec JSON** below.
|
||||
|
||||
|
||||
## Generating and running the tests
|
||||
|
||||
The repository already contains generated tests, so if you're making changes,
|
||||
see the **Removing all generated tests** section below, on how to remove them before you start generating tests which include your changes.
|
||||
|
||||
Start from the command line:
|
||||
|
||||
```bash
|
||||
|
||||
# Chdir into the tests directory.
|
||||
cd ~/web-platform-tests/referrer-policy
|
||||
|
||||
# Generate the test resources.
|
||||
./generic/tools/generate.py
|
||||
|
||||
# Add all generated tests to the repo.
|
||||
git add * && git commit -m "Add generated tests"
|
||||
|
||||
# Regenerate the manifest.
|
||||
../manifest
|
||||
|
||||
```
|
||||
|
||||
Navigate to [http://web-platform.test:8000/tools/runner/index.html](http://web-platform.test:8000/tools/runner/index.html).
|
||||
|
||||
Run tests under path: ```/referrer-policy```.
|
||||
|
||||
Click start.
|
||||
|
||||
|
||||
## Options for generating tests
|
||||
|
||||
The generator script ```./generic/tools/generate.py``` has two targets: ```release``` and ```debug```.
|
||||
|
||||
* Using **release** for the target will produce tests using a template for optimizing size and performance. The release template is intended for the official web-platform-tests and possibly other test suites. No sanity checking is done in release mode. Use this option whenever you're checking into web-platform-tests.
|
||||
|
||||
* When generating for ```debug```, the produced tests will contain more verbosity and sanity checks. Use this target to identify problems with the test suite when making changes locally. Make sure you don't check in tests generated with the debug target.
|
||||
|
||||
Note that **release** is the default target when invoking ```generate.py```.
|
||||
|
||||
|
||||
## Removing all generated tests
|
||||
|
||||
```bash
|
||||
# Chdir into the tests directory.
|
||||
cd ~/web-platform-tests/referrer-policy
|
||||
|
||||
# Remove all generated tests.
|
||||
./generic/tools/clean.py
|
||||
|
||||
# Remove all generated tests to the repo.
|
||||
git add * && git commit -m "Remove generated tests"
|
||||
|
||||
# Regenerate the manifest.
|
||||
../manifest
|
||||
```
|
||||
|
||||
**Important:**
|
||||
The ```./generic/tools/clean.py``` utility will only work if there is a valid ```spec.src.json``` and previously generated directories match the specification requirement names. So make sure you run ```clean.py``` before you alter the specification section of the spec JSON.
|
||||
|
||||
|
||||
## Updating the tests
|
||||
|
||||
The main test logic lives in ```./generic/referrer-policy-test-case.js``` with helper functions defined in ```./generic/common.js``` so you should probably start there.
|
||||
|
||||
For updating the test suite you will most likely do **a subset** of the following:
|
||||
|
||||
* Add a new sub-resource python script to ```./generic/subresource/```,
|
||||
and update the reference to it in ```spec.src.json```.
|
||||
|
||||
* Add a sanity check test for a sub-resource to ```./generic/subresource-test/```.
|
||||
|
||||
* Implement new or update existing assertions in ```./generic/referrer-policy-test-case.js```.
|
||||
|
||||
* Exclude or add some tests by updating ```spec.src.json``` test expansions.
|
||||
|
||||
* Update the template files living in ```./generic/template/```.
|
||||
|
||||
* Implement a new delivery method via HTTP headers or as part of the test template in ```./generic/tools/generate.py```
|
||||
|
||||
* Update the spec schema by editing ```spec.src.json``` while updating the
|
||||
```./generic/tools/spec_validator.py``` and ```./generic/tools/generate.py```
|
||||
and making sure both still work after the change (by running them).
|
||||
|
||||
* Regenerate the tests and MANIFEST.json
|
||||
|
||||
|
||||
## Updating the spec and regenerating
|
||||
|
||||
When updating the ```spec.src.json```, e.g. by adding a test expansion pattern to the ```excluded_tests``` section or when removing an expansion in the ```specification``` section, make sure to remove all previously generated files which would still get picked up by ```MANIFEST.json``` in the web-platform-tests root. As long as you don't change the specification requirements' names or remove them, you can easily regenerate the tests via command line:
|
||||
|
||||
```bash
|
||||
|
||||
# Chdir into the tests directory.
|
||||
cd ~/web-platform-tests/referrer-policy
|
||||
|
||||
# Regenerate the test resources.
|
||||
./generic/tools/regenerate
|
||||
|
||||
# Add all the tests to the repo.
|
||||
git add * && git commit -m "Update generated tests"
|
||||
|
||||
# Regenerate the manifest.
|
||||
../manifest
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Overview of the spec JSON
|
||||
|
||||
**Main sections:**
|
||||
|
||||
* **specification**
|
||||
|
||||
Top level requirements with description fields and a ```test_expansion``` rule.
|
||||
This is closely mimicking the [Referrer Policy specification](http://w3c.github.io/webappsec/specs/referrer-policy/) structure.
|
||||
|
||||
* **excluded_tests**
|
||||
|
||||
List of ```test_expansion``` patterns expanding into selections which get skipped when generating the tests (aka. blacklisting/suppressing)
|
||||
|
||||
* **referrer_policy_schema**
|
||||
|
||||
The schema to validate fields which define the ```referrer_policy``` elsewhere in the JSON.
|
||||
A value for a referrer_policy can only be one specified in the referrer_policy_schema.
|
||||
|
||||
* **test_expansion_schema**
|
||||
|
||||
The schema used to check if a ```test_expansion``` is valid.
|
||||
Each test expansion can only contain fields defined by this schema.
|
||||
|
||||
* **subresource_path**
|
||||
|
||||
A 1:1 mapping of a **subresource type** to the URL path of the sub-resource.
|
||||
When adding a new sub-resource, a path to an existing file for it also must be specified.
|
||||
|
||||
|
||||
### Test Expansion Patterns
|
||||
|
||||
Each field in a test expansion can be in one of the following formats:
|
||||
|
||||
* Single match: ```"value"```
|
||||
|
||||
* Match any of: ```["value1", "value2", ...]```
|
||||
|
||||
* Match all: ```"*"```
|
||||
|
||||
#### Example: test expansion in a requirement specification
|
||||
|
||||
The following example shows how to restrict the expansion of ```referrer_url``` to ```origin``` and allow rest of the arrangement to expand (permute) to all possible values. The name field will be the prefix of a generated HTML file name for the test.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "origin-only",
|
||||
"title": "Referrer Policy is set to 'origin-only'",
|
||||
"description": "Check that all sub-resources in all cases get only the origin portion of the referrer URL.",
|
||||
"specification_url": "https://w3c.github.io/webappsec/specs/referrer-policy/#referrer-policy-state-origin",
|
||||
"referrer_policy": "origin",
|
||||
"test_expansion": [
|
||||
{
|
||||
"name": "generic",
|
||||
"expansion": "default",
|
||||
"source_protocol": "*",
|
||||
"target_protocol": "*",
|
||||
"delivery_method": "*",
|
||||
"redirection": "*",
|
||||
"origin": "*",
|
||||
"subresource": "*",
|
||||
"referrer_url": "origin"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**NOTE:** An expansion is always constructive (inclusive), there isn't a negation operator for explicit exclusion. Be aware that using an empty list ```[]``` matches (expands into) exactly nothing. Tests which are to be excluded should be defined in the ```excluded_tests``` section instead.
|
||||
|
||||
A single test expansion pattern, be it a requirement or a suppressed pattern, gets expanded into a list of **selections** as follows:
|
||||
|
||||
* Expand each field's pattern (single, any of, or all) to list of allowed values (defined by the ```test_expansion_schema```)
|
||||
|
||||
* Permute - Recursively enumerate all **selections** accross all fields
|
||||
|
||||
Be aware that if there is more than one pattern expanding into a same selection (which also shares the same ```name``` field), the pattern appearing later in the spec JSON will overwrite a previously generated selection. To make sure this is not undetected when generating, set the value of the ```expansion``` field to ```default``` for an expansion appearing earlier and ```override``` for the one appearing later.
|
||||
|
||||
A **selection** is a single **test instance** (scenario) with explicit values, for example:
|
||||
|
||||
```javascript
|
||||
var scenario = {
|
||||
"referrer_policy": "origin-when-crossorigin",
|
||||
"delivery_method": "meta-referrer",
|
||||
"redirection": "no-redirect",
|
||||
"origin": "cross-origin",
|
||||
"source_protocol": "http",
|
||||
"target_protocol": "http",
|
||||
"subresource": "iframe-tag",
|
||||
"subresource_path": "/referrer-policy/generic/subresource/document.py",
|
||||
"referrer_url": "origin"
|
||||
};
|
||||
```
|
||||
|
||||
Essentially, this is what gets generated and defines a single test. The scenario is then evaluated by the ```ReferrerPolicyTestCase``` in JS. For the rest of the arranging part, see the ```./generic/template/``` directory and examine ```./generic/tools/generate.py``` to see how the values for the templates are produced.
|
||||
|
||||
|
||||
Taking the spec JSON, the generator follows this algorithm:
|
||||
|
||||
* Expand all ```excluded_tests``` to create a blacklist of selections
|
||||
|
||||
* For each specification requirement: Expand the ```test_expansion``` pattern into selections and check each against the blacklist, if not marked as suppresed, generate the test resources for the selection
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
// NOTE: This method only strips the fragment and is not in accordance to the
|
||||
// recommended draft specification:
|
||||
// https://w3c.github.io/webappsec/specs/referrer-policy/#null
|
||||
// TODO(burnik): Implement this helper as defined by spec once added scenarios
|
||||
// for URLs containing username/password/etc.
|
||||
// TODO(kristijanburnik): Implement this helper as defined by spec once added
|
||||
// scenarios for URLs containing username/password/etc.
|
||||
function stripUrlForUseAsReferrer(url) {
|
||||
return url.replace(/#.*$/, "");
|
||||
}
|
||||
|
@ -26,3 +26,177 @@ function appendIframeToBody(url) {
|
|||
|
||||
return iframe;
|
||||
}
|
||||
|
||||
function loadImage(src, callback) {
|
||||
var image = new Image();
|
||||
image.crossOrigin = "Anonymous";
|
||||
image.onload = function() {
|
||||
callback(image);
|
||||
}
|
||||
image.src = src;
|
||||
document.body.appendChild(image)
|
||||
}
|
||||
|
||||
function decodeImageData(rgba) {
|
||||
var rgb = new Uint8ClampedArray(rgba.length);
|
||||
|
||||
// RGBA -> RGB.
|
||||
var rgb_length = 0;
|
||||
for (var i = 0; i < rgba.length; ++i) {
|
||||
// Skip alpha component.
|
||||
if (i % 4 == 3)
|
||||
continue;
|
||||
|
||||
// Zero is the string terminator.
|
||||
if (rgba[i] == 0)
|
||||
break;
|
||||
|
||||
rgb[rgb_length++] = rgba[i];
|
||||
}
|
||||
|
||||
// Remove trailing nulls from data.
|
||||
rgb = rgb.subarray(0, rgb_length);
|
||||
var string_data = (new TextDecoder("ascii")).decode(rgb);
|
||||
|
||||
return JSON.parse(string_data);
|
||||
}
|
||||
|
||||
function decodeImage(url, callback) {
|
||||
loadImage(url, function(img) {
|
||||
var canvas = document.createElement("canvas");
|
||||
var context = canvas.getContext('2d');
|
||||
context.drawImage(img, 0, 0);
|
||||
var imgData = context.getImageData(0, 0, img.clientWidth, img.clientHeight);
|
||||
callback(decodeImageData(imgData.data))
|
||||
});
|
||||
}
|
||||
|
||||
function normalizePort(targetPort) {
|
||||
var defaultPorts = [80, 443];
|
||||
var isDefaultPortForProtocol = (defaultPorts.indexOf(targetPort) >= 0);
|
||||
|
||||
return (targetPort == "" || isDefaultPortForProtocol) ?
|
||||
"" : ":" + targetPort;
|
||||
}
|
||||
|
||||
function wrapResult(url, server_data) {
|
||||
return {
|
||||
location: url,
|
||||
referrer: server_data.headers.referer,
|
||||
headers: server_data.headers
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function queryIframe(url, callback) {
|
||||
var iframe = appendIframeToBody(url);
|
||||
var listener = function(event) {
|
||||
if (event.source != iframe.contentWindow)
|
||||
return;
|
||||
|
||||
callback(event.data, url);
|
||||
window.removeEventListener("message", listener);
|
||||
}
|
||||
window.addEventListener("message", listener);
|
||||
}
|
||||
|
||||
function queryImage(url, callback) {
|
||||
decodeImage(url, function(server_data) {
|
||||
callback(wrapResult(url, server_data), url);
|
||||
})
|
||||
}
|
||||
|
||||
function queryXhr(url, callback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url, true);
|
||||
xhr.onreadystatechange = function(e) {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
var server_data = JSON.parse(this.responseText);
|
||||
callback(wrapResult(url, server_data), url);
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function queryWorker(url, callback) {
|
||||
var worker = new Worker(url);
|
||||
worker.onmessage = function(event) {
|
||||
var server_data = event.data;
|
||||
callback(wrapResult(url, server_data), url);
|
||||
};
|
||||
}
|
||||
|
||||
function queryFetch(url, callback) {
|
||||
fetch(url).then(function(response) {
|
||||
response.json().then(function(server_data) {
|
||||
callback(wrapResult(url, server_data), url);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function queryNavigable(element, url, callback, attributes) {
|
||||
var navigable = element
|
||||
navigable.href = url;
|
||||
navigable.target = "helper-iframe";
|
||||
|
||||
var helperIframe = document.createElement("iframe")
|
||||
helperIframe.name = "helper-iframe"
|
||||
document.body.appendChild(helperIframe)
|
||||
|
||||
// Extend element with attributes. (E.g. "referrer_policy" or "rel")
|
||||
if (attributes) {
|
||||
for (var attr in attributes) {
|
||||
navigable[attr] = attributes[attr];
|
||||
}
|
||||
}
|
||||
|
||||
var listener = function(event) {
|
||||
if (event.source != helperIframe.contentWindow)
|
||||
return;
|
||||
|
||||
callback(event.data, url);
|
||||
window.removeEventListener("message", listener);
|
||||
}
|
||||
window.addEventListener("message", listener);
|
||||
|
||||
navigable.click();
|
||||
}
|
||||
|
||||
function queryLink(url, callback, referrer_policy) {
|
||||
var a = document.createElement("a");
|
||||
a.innerHTML = "Link to subresource";
|
||||
document.body.appendChild(a);
|
||||
queryNavigable(a, url, callback, referrer_policy)
|
||||
}
|
||||
|
||||
function queryAreaLink(url, callback, referrer_policy) {
|
||||
var area = document.createElement("area");
|
||||
// TODO(kristijanburnik): Append to map and add image.
|
||||
document.body.appendChild(area);
|
||||
queryNavigable(area, url, callback, referrer_policy)
|
||||
}
|
||||
|
||||
function queryScript(url, callback) {
|
||||
var script = document.createElement("script");
|
||||
script.src = url;
|
||||
|
||||
var listener = function(event) {
|
||||
var server_data = event.data;
|
||||
callback(wrapResult(url, server_data), url);
|
||||
window.removeEventListener("message", listener);
|
||||
}
|
||||
window.addEventListener("message", listener);
|
||||
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
|
||||
// SanityChecker does nothing in release mode.
|
||||
function SanityChecker() {}
|
||||
SanityChecker.prototype.checkScenario = function() {};
|
||||
SanityChecker.prototype.checkSubresourceResult = function() {};
|
||||
|
||||
// TODO(kristijanburnik): document.origin is supported since Chrome 41,
|
||||
// other browsers still don't support it. Remove once they do.
|
||||
document.origin = document.origin || (location.protocol + "//" + location.host);
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
function ReferrerPolicyTestCase(scenario, testDescription, sanityChecker) {
|
||||
// Pass and skip rest of the test if browser does not support fetch.
|
||||
if (scenario.subresource == "fetch-request" && !window.fetch) {
|
||||
// TODO(kristijanburnik): This should be refactored.
|
||||
return {
|
||||
start: function() {
|
||||
test(function() { assert_true(true); },
|
||||
"[ReferrerPolicyTestCase] Skipping test: Fetch is not supported.");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// This check is A NOOP in release.
|
||||
sanityChecker.checkScenario(scenario);
|
||||
|
||||
var subresourceInvoker = {
|
||||
"a-tag": queryLink,
|
||||
"area-tag": queryAreaLink,
|
||||
"fetch-request": queryFetch,
|
||||
"iframe-tag": queryIframe,
|
||||
"img-tag": queryImage,
|
||||
"script-tag": queryScript,
|
||||
"worker-request": queryWorker,
|
||||
"xhr-request": queryXhr
|
||||
};
|
||||
|
||||
var referrerUrlResolver = {
|
||||
"omitted": function() {
|
||||
return undefined;
|
||||
},
|
||||
"origin": function() {
|
||||
return document.origin + "/";
|
||||
},
|
||||
"stripped-referrer": function() {
|
||||
return stripUrlForUseAsReferrer(location.toString());
|
||||
}
|
||||
};
|
||||
|
||||
var t = {
|
||||
_scenario: scenario,
|
||||
_testDescription: testDescription,
|
||||
_subresourceUrl: null,
|
||||
_expectedReferrerUrl: null,
|
||||
_constructSubresourceUrl: function() {
|
||||
// TODO(kristijanburnik): We should assert that these two domains are
|
||||
// different. E.g. If someone runs the tets over www, this would fail.
|
||||
var domainForOrigin = {
|
||||
"cross-origin":"{{domains[www1]}}",
|
||||
"same-origin": location.hostname
|
||||
};
|
||||
|
||||
// Values obtained and replaced by the wptserve pipeline:
|
||||
// http://wptserve.readthedocs.org/en/latest/pipes.html#built-in-pipes
|
||||
var portForProtocol = {
|
||||
"http": parseInt("{{ports[http][0]}}"),
|
||||
"https": parseInt("{{ports[https][0]}}")
|
||||
}
|
||||
|
||||
var targetPort = portForProtocol[t._scenario.target_protocol];
|
||||
|
||||
t._subresourceUrl = t._scenario.target_protocol + "://" +
|
||||
domainForOrigin[t._scenario.origin] +
|
||||
normalizePort(targetPort) +
|
||||
t._scenario["subresource_path"] +
|
||||
"?redirection=" + t._scenario["redirection"] +
|
||||
"&cache_destroyer=" + (new Date()).getTime();
|
||||
},
|
||||
|
||||
_constructExpectedReferrerUrl: function() {
|
||||
t._expectedReferrerUrl = referrerUrlResolver[t._scenario.referrer_url]();
|
||||
},
|
||||
|
||||
_invokeSubresource: function(callback) {
|
||||
var invoker = subresourceInvoker[t._scenario.subresource];
|
||||
|
||||
// Depending on the delivery method, extend the subresource element with
|
||||
// these attributes.
|
||||
var elementAttributesForDeliveryMethod = {
|
||||
"attr-referrer": {referrer: t._scenario.referrer_policy},
|
||||
"rel-noreferrer": {rel: "noreferrer"}
|
||||
};
|
||||
|
||||
var delivery_method = t._scenario.delivery_method;
|
||||
|
||||
if (delivery_method in elementAttributesForDeliveryMethod) {
|
||||
invoker(t._subresourceUrl,
|
||||
callback,
|
||||
elementAttributesForDeliveryMethod[delivery_method]);
|
||||
} else {
|
||||
invoker(t._subresourceUrl, callback);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
start: function() {
|
||||
t._constructSubresourceUrl();
|
||||
t._constructExpectedReferrerUrl();
|
||||
|
||||
var test = async_test(t._testDescription);
|
||||
|
||||
t._invokeSubresource(function(result) {
|
||||
// Check if the result is in valid format. NOOP in release.
|
||||
sanityChecker.checkSubresourceResult(
|
||||
test, t._scenario, t._subresourceUrl, result);
|
||||
|
||||
// Check the reported URL.
|
||||
test.step(function() {
|
||||
assert_equals(result.referrer,
|
||||
t._expectedReferrerUrl,
|
||||
"Reported Referrer URL is '" +
|
||||
t._scenario.referrer_url + "'.");
|
||||
assert_equals(result.headers.referer,
|
||||
t._expectedReferrerUrl,
|
||||
"Reported Referrer URL from HTTP header is '" +
|
||||
t._expectedReferrerUrl + "'");
|
||||
}, "Reported Referrer URL is as expected: " + t._scenario.referrer_url);
|
||||
|
||||
test.done();
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
// The SanityChecker is used in debug mode to identify problems with the
|
||||
// structure of the testsuite. In release mode it is mocked out to do nothing.
|
||||
|
||||
function SanityChecker() {}
|
||||
|
||||
SanityChecker.prototype.checkScenario = function(scenario) {
|
||||
// Check if scenario is valid.
|
||||
// TODO(kristijanburnik): Move to a sanity-checks.js for debug mode only.
|
||||
test(function() {
|
||||
|
||||
// We extend the exsiting test_expansion_schema not to kill performance by
|
||||
// copying.
|
||||
var expectedFields = SPEC_JSON["test_expansion_schema"];
|
||||
expectedFields["referrer_policy"] = SPEC_JSON["referrer_policy_schema"];
|
||||
|
||||
assert_own_property(scenario, "subresource_path",
|
||||
"Scenario has the path to the subresource.");
|
||||
|
||||
for (var field in expectedFields) {
|
||||
assert_own_property(scenario, field,
|
||||
"The scenario contains field " + field)
|
||||
assert_in_array(scenario[field], expectedFields[field],
|
||||
"Scenario's " + field + " is one of: " +
|
||||
expectedFields[field].join(", ")) + "."
|
||||
}
|
||||
|
||||
// Check if the protocol is matched.
|
||||
assert_equals(scenario["source_protocol"] + ":", location.protocol,
|
||||
"Protocol of the test page should match the scenario.")
|
||||
|
||||
}, "[ReferrerPolicyTestCase] The test scenario is valid.");
|
||||
}
|
||||
|
||||
SanityChecker.prototype.checkSubresourceResult = function(test,
|
||||
scenario,
|
||||
subresourceUrl,
|
||||
result) {
|
||||
test.step(function() {
|
||||
assert_equals(Object.keys(result).length, 3);
|
||||
assert_own_property(result, "location");
|
||||
assert_own_property(result, "referrer");
|
||||
assert_own_property(result, "headers");
|
||||
|
||||
// Skip location check for scripts.
|
||||
if (scenario.subresource == "script-tag")
|
||||
return;
|
||||
|
||||
// Sanity check: location of sub-resource matches reported location.
|
||||
assert_equals(result.location, subresourceUrl,
|
||||
"Subresource reported location.");
|
||||
}, "Running a valid test scenario.");
|
||||
};
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Area Link messaging - cross-origin Area Link navigation</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Area Link messaging - cross-origin Area Link navigation</h1>
|
||||
<p>If you can read JSON encoded HTTP request headers of the Area link below,
|
||||
the messaging works as expected.</p>
|
||||
|
||||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var messaging_test = async_test("Area is responding with HTTP headers");
|
||||
var urlPath = '/referrer-policy/generic/subresource/document.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryAreaLink(url, function(message) {
|
||||
var pre = document.getElementById('received_message')
|
||||
var headers = message.headers;
|
||||
pre.innerHTML = "";
|
||||
pre.innerHTML += url + ":\n\n";
|
||||
pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
|
||||
messaging_test.step(function() {
|
||||
assert_own_property(headers, "host")
|
||||
assert_own_property(headers, "connection")
|
||||
});
|
||||
messaging_test.done();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Fetch messaging - same-origin Fetch request</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Fetch messaging - same-origin Fetch request</h1>
|
||||
<p>If you can read JSON encoded HTTP request headers of the Fetch below,
|
||||
the messaging works as expected.</p>
|
||||
|
||||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
test(function() {
|
||||
assert_true(!!window.fetch, "Fetch is not supported by this browser.");
|
||||
}, "Fetch is supported by the browser.");
|
||||
|
||||
(function() {
|
||||
if (!window.fetch)
|
||||
return;
|
||||
|
||||
var fetch_test = async_test("Fetch is responding with HTTP headers");
|
||||
var urlPath = '/referrer-policy/generic/subresource/xhr.py';
|
||||
var url = location.protocol + "//" + location.hostname + ":" +
|
||||
location.port + urlPath;
|
||||
queryFetch(url, function(message) {
|
||||
var pre = document.getElementById('received_message')
|
||||
var headers = message.headers;
|
||||
pre.innerHTML = "";
|
||||
pre.innerHTML += url + ":\n\n";
|
||||
pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n";
|
||||
fetch_test.step(function() {
|
||||
assert_own_property(headers, "host")
|
||||
assert_own_property(headers, "connection")
|
||||
});
|
||||
fetch_test.done();
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Iframe messaging - cross-origin iframe request</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Iframe messaging - cross-origin iframe request</h1>
|
||||
<p>If you can read JSON encoded HTTP request headers of the iframe below,
|
||||
the messaging works as expected.</p>
|
||||
|
||||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var messaging_test = async_test("Iframe is responding with HTTP headers");
|
||||
var urlPath = '/referrer-policy/generic/subresource/document.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryIframe(url, function(message) {
|
||||
var pre = document.getElementById('received_message')
|
||||
var headers = message.headers;
|
||||
pre.innerHTML = "";
|
||||
pre.innerHTML += url + ":\n\n";
|
||||
pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
|
||||
messaging_test.step(function() {
|
||||
assert_own_property(headers, "host")
|
||||
assert_own_property(headers, "connection")
|
||||
});
|
||||
messaging_test.done();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Image decoding - cross-origin image request</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Image decoding - cross-origin image request</h1>
|
||||
<p>If you can read JSON encoded HTTP headers of the image below,
|
||||
the decoding works as expected.</p>
|
||||
|
||||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var messaging_test = async_test("Image is encoding headers as JSON.");
|
||||
var urlPath = '/referrer-policy/generic/subresource/image.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryImage(url, function(message) {
|
||||
var pre = document.getElementById('received_message')
|
||||
var headers = message.headers;
|
||||
pre.innerHTML = "";
|
||||
pre.innerHTML += url + ":\n\n";
|
||||
pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
|
||||
messaging_test.step(function() {
|
||||
assert_own_property(headers, "host")
|
||||
assert_own_property(headers, "connection")
|
||||
});
|
||||
messaging_test.done();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Link messaging - cross-origin Link navigation</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Link messaging - cross-origin Link navigation</h1>
|
||||
<p>If you can read JSON encoded HTTP request headers of the Link below,
|
||||
the messaging works as expected.</p>
|
||||
|
||||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var messaging_test = async_test("Link is responding with HTTP headers");
|
||||
var urlPath = '/referrer-policy/generic/subresource/document.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryLink(url, function(message) {
|
||||
var pre = document.getElementById('received_message')
|
||||
var headers = message.headers;
|
||||
pre.innerHTML = "";
|
||||
pre.innerHTML += url + ":\n\n";
|
||||
pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
|
||||
messaging_test.step(function() {
|
||||
assert_own_property(headers, "host")
|
||||
assert_own_property(headers, "connection")
|
||||
});
|
||||
messaging_test.done();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Script messaging - cross-origin Script request</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Script messaging - cross-origin Script request</h1>
|
||||
<p>If you can read JSON encoded HTTP request headers of the Script below,
|
||||
the messaging works as expected.</p>
|
||||
|
||||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var messaging_test = async_test("Script is responding with HTTP headers");
|
||||
var urlPath = '/referrer-policy/generic/subresource/script.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryScript(url, function(message) {
|
||||
var pre = document.getElementById('received_message')
|
||||
var headers = message.headers;
|
||||
pre.innerHTML = "";
|
||||
pre.innerHTML += url + ":\n\n";
|
||||
pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
|
||||
messaging_test.step(function() {
|
||||
assert_own_property(headers, "host")
|
||||
assert_own_property(headers, "connection")
|
||||
});
|
||||
messaging_test.done();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Worker messaging - same-origin Worker request</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Worker messaging - same-origin Worker request</h1>
|
||||
<p>If you can read JSON encoded HTTP request headers of the Worker below,
|
||||
the messaging works as expected.</p>
|
||||
|
||||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var messaging_test = async_test("Worker is responding with HTTP headers");
|
||||
var urlPath = '/referrer-policy/generic/subresource/worker.py';
|
||||
var url = location.protocol + "//" + location.hostname + ":" +
|
||||
location.port + urlPath;
|
||||
queryWorker(url, function(message) {
|
||||
var pre = document.getElementById('received_message')
|
||||
var headers = message.headers;
|
||||
pre.innerHTML = "";
|
||||
pre.innerHTML += url + ":\n\n";
|
||||
pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
|
||||
messaging_test.step(function() {
|
||||
assert_own_property(headers, "host")
|
||||
assert_own_property(headers, "connection")
|
||||
});
|
||||
messaging_test.done();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>XHR messaging - cross-origin XHR request</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>XHR messaging - cross-origin XHR request</h1>
|
||||
<p>If you can read JSON encoded HTTP request headers of the XHR below,
|
||||
the messaging works as expected.</p>
|
||||
|
||||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var messaging_test = async_test("XHR is responding with HTTP headers");
|
||||
var urlPath = '/referrer-policy/generic/subresource/xhr.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryXhr(url, function(message) {
|
||||
var pre = document.getElementById('received_message')
|
||||
var headers = message.headers;
|
||||
pre.innerHTML = "";
|
||||
pre.innerHTML += url + ":\n\n";
|
||||
pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
|
||||
messaging_test.step(function() {
|
||||
assert_own_property(headers, "host")
|
||||
assert_own_property(headers, "connection")
|
||||
});
|
||||
messaging_test.done();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
import os, json, sys
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
import subresource
|
||||
|
||||
def generate_payload(server_data):
|
||||
return subresource.get_template("document.html.template") % server_data
|
||||
|
||||
def main(request, response):
|
||||
subresource.respond(request,
|
||||
response,
|
||||
payload_generator = generate_payload)
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue