mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1190349 - Update web-platform-tests to revision 2bd8c7dcf2e216e58ece63491f31b5d087ec740e, a=testonly
This commit is contained in:
parent
c69b66877e
commit
d9d5bdcacf
@ -16868,8 +16868,12 @@
|
||||
"url": "/html/semantics/forms/the-fieldset-element/HTMLFieldSetElement.html"
|
||||
},
|
||||
{
|
||||
"path": "html/semantics/forms/the-fieldset-element/disabled.html",
|
||||
"url": "/html/semantics/forms/the-fieldset-element/disabled.html"
|
||||
"path": "html/semantics/forms/the-fieldset-element/disabled-001.html",
|
||||
"url": "/html/semantics/forms/the-fieldset-element/disabled-001.html"
|
||||
},
|
||||
{
|
||||
"path": "html/semantics/forms/the-fieldset-element/disabled-002.xhtml",
|
||||
"url": "/html/semantics/forms/the-fieldset-element/disabled-002.xhtml"
|
||||
},
|
||||
{
|
||||
"path": "html/semantics/forms/the-form-element/form-autocomplete.html",
|
||||
@ -17035,6 +17039,10 @@
|
||||
"path": "html/semantics/forms/the-label-element/labelable-elements.html",
|
||||
"url": "/html/semantics/forms/the-label-element/labelable-elements.html"
|
||||
},
|
||||
{
|
||||
"path": "html/semantics/forms/the-legend-element/legend-form.html",
|
||||
"url": "/html/semantics/forms/the-legend-element/legend-form.html"
|
||||
},
|
||||
{
|
||||
"path": "html/semantics/forms/the-meter-element/meter.html",
|
||||
"url": "/html/semantics/forms/the-meter-element/meter.html"
|
||||
@ -18243,6 +18251,14 @@
|
||||
"path": "mixed-content/allowed/http-csp/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html",
|
||||
"url": "/mixed-content/allowed/http-csp/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/allowed/http-csp/same-host-wss/websocket-request/top-level/keep-scheme-redirect/websocket-allowed.https.html",
|
||||
"url": "/mixed-content/allowed/http-csp/same-host-wss/websocket-request/top-level/keep-scheme-redirect/websocket-allowed.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/allowed/http-csp/same-host-wss/websocket-request/top-level/no-redirect/websocket-allowed.https.html",
|
||||
"url": "/mixed-content/allowed/http-csp/same-host-wss/websocket-request/top-level/no-redirect/websocket-allowed.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/allowed/meta-csp/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html",
|
||||
"url": "/mixed-content/allowed/meta-csp/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html"
|
||||
@ -18295,6 +18311,10 @@
|
||||
"path": "mixed-content/allowed/meta-csp/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html",
|
||||
"url": "/mixed-content/allowed/meta-csp/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/allowed/meta-csp/same-host-wss/websocket-request/top-level/no-redirect/websocket-allowed.https.html",
|
||||
"url": "/mixed-content/allowed/meta-csp/same-host-wss/websocket-request/top-level/no-redirect/websocket-allowed.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/allowed/no-opt-in/same-host-https/audio-tag/top-level/keep-scheme-redirect/allowed.https.html",
|
||||
"url": "/mixed-content/allowed/no-opt-in/same-host-https/audio-tag/top-level/keep-scheme-redirect/allowed.https.html"
|
||||
@ -18399,6 +18419,14 @@
|
||||
"path": "mixed-content/allowed/no-opt-in/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html",
|
||||
"url": "/mixed-content/allowed/no-opt-in/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/allowed/no-opt-in/same-host-wss/websocket-request/top-level/keep-scheme-redirect/websocket-allowed.https.html",
|
||||
"url": "/mixed-content/allowed/no-opt-in/same-host-wss/websocket-request/top-level/keep-scheme-redirect/websocket-allowed.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/allowed/no-opt-in/same-host-wss/websocket-request/top-level/no-redirect/websocket-allowed.https.html",
|
||||
"url": "/mixed-content/allowed/no-opt-in/same-host-wss/websocket-request/top-level/no-redirect/websocket-allowed.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/http-csp/cross-origin-http/fetch-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/http-csp/cross-origin-http/fetch-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html"
|
||||
@ -18507,6 +18535,18 @@
|
||||
"path": "mixed-content/blockable/http-csp/cross-origin-http/xhr-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/http-csp/cross-origin-http/xhr-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/http-csp/cross-origin-ws/websocket-request/top-level/keep-scheme-redirect/ws-downgrade-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/http-csp/cross-origin-ws/websocket-request/top-level/keep-scheme-redirect/ws-downgrade-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/http-csp/cross-origin-ws/websocket-request/top-level/no-redirect/ws-downgrade-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/http-csp/cross-origin-ws/websocket-request/top-level/no-redirect/ws-downgrade-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/http-csp/cross-origin-ws/websocket-request/top-level/swap-scheme-redirect/ws-downgrade-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/http-csp/cross-origin-ws/websocket-request/top-level/swap-scheme-redirect/ws-downgrade-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/http-csp/same-host-http/fetch-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/http-csp/same-host-http/fetch-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html"
|
||||
@ -18615,6 +18655,18 @@
|
||||
"path": "mixed-content/blockable/http-csp/same-host-http/xhr-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/http-csp/same-host-http/xhr-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/http-csp/same-host-ws/websocket-request/top-level/keep-scheme-redirect/ws-downgrade-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/http-csp/same-host-ws/websocket-request/top-level/keep-scheme-redirect/ws-downgrade-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/http-csp/same-host-ws/websocket-request/top-level/no-redirect/ws-downgrade-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/http-csp/same-host-ws/websocket-request/top-level/no-redirect/ws-downgrade-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/http-csp/same-host-ws/websocket-request/top-level/swap-scheme-redirect/ws-downgrade-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/http-csp/same-host-ws/websocket-request/top-level/swap-scheme-redirect/ws-downgrade-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/meta-csp/cross-origin-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/meta-csp/cross-origin-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html"
|
||||
@ -18651,6 +18703,10 @@
|
||||
"path": "mixed-content/blockable/meta-csp/cross-origin-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/meta-csp/cross-origin-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/meta-csp/cross-origin-ws/websocket-request/top-level/no-redirect/ws-downgrade-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/meta-csp/cross-origin-ws/websocket-request/top-level/no-redirect/ws-downgrade-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/meta-csp/same-host-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/meta-csp/same-host-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html"
|
||||
@ -18687,6 +18743,10 @@
|
||||
"path": "mixed-content/blockable/meta-csp/same-host-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/meta-csp/same-host-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/meta-csp/same-host-ws/websocket-request/top-level/no-redirect/ws-downgrade-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/meta-csp/same-host-ws/websocket-request/top-level/no-redirect/ws-downgrade-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/no-opt-in/cross-origin-http/fetch-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/no-opt-in/cross-origin-http/fetch-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html"
|
||||
@ -18795,6 +18855,18 @@
|
||||
"path": "mixed-content/blockable/no-opt-in/cross-origin-http/xhr-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/no-opt-in/cross-origin-http/xhr-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/no-opt-in/cross-origin-ws/websocket-request/top-level/keep-scheme-redirect/ws-downgrade-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/no-opt-in/cross-origin-ws/websocket-request/top-level/keep-scheme-redirect/ws-downgrade-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/no-opt-in/cross-origin-ws/websocket-request/top-level/no-redirect/ws-downgrade-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/no-opt-in/cross-origin-ws/websocket-request/top-level/no-redirect/ws-downgrade-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/no-opt-in/cross-origin-ws/websocket-request/top-level/swap-scheme-redirect/ws-downgrade-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/no-opt-in/cross-origin-ws/websocket-request/top-level/swap-scheme-redirect/ws-downgrade-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/no-opt-in/same-host-http/fetch-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/no-opt-in/same-host-http/fetch-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html"
|
||||
@ -18903,6 +18975,18 @@
|
||||
"path": "mixed-content/blockable/no-opt-in/same-host-http/xhr-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/no-opt-in/same-host-http/xhr-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/no-opt-in/same-host-ws/websocket-request/top-level/keep-scheme-redirect/ws-downgrade-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/no-opt-in/same-host-ws/websocket-request/top-level/keep-scheme-redirect/ws-downgrade-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/no-opt-in/same-host-ws/websocket-request/top-level/no-redirect/ws-downgrade-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/no-opt-in/same-host-ws/websocket-request/top-level/no-redirect/ws-downgrade-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/blockable/no-opt-in/same-host-ws/websocket-request/top-level/swap-scheme-redirect/ws-downgrade-blocks.https.html",
|
||||
"url": "/mixed-content/blockable/no-opt-in/same-host-ws/websocket-request/top-level/swap-scheme-redirect/ws-downgrade-blocks.https.html"
|
||||
},
|
||||
{
|
||||
"path": "mixed-content/optionally-blockable/http-csp/cross-origin-http/audio-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html",
|
||||
"url": "/mixed-content/optionally-blockable/http-csp/cross-origin-http/audio-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html"
|
||||
@ -25699,6 +25783,10 @@
|
||||
"path": "websockets/Close-Reason-124Bytes.htm",
|
||||
"url": "/websockets/Close-Reason-124Bytes.htm"
|
||||
},
|
||||
{
|
||||
"path": "websockets/Close-clamp.htm",
|
||||
"url": "/websockets/Close-clamp.htm"
|
||||
},
|
||||
{
|
||||
"path": "websockets/Close-null.htm",
|
||||
"url": "/websockets/Close-null.htm"
|
||||
@ -34114,7 +34202,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"rev": "4bc69f287365a67585d470300a2ef109689cf465",
|
||||
"rev": "2bd8c7dcf2e216e58ece63491f31b5d087ec740e",
|
||||
"url_base": "/",
|
||||
"version": 2
|
||||
}
|
@ -1 +1 @@
|
||||
757fde6c364d5c1ae56ad135b1ffe15bf455e5ff
|
||||
a5c1cbd20982ee041f870d3833728768ef095b40
|
@ -9,6 +9,5 @@
|
||||
following::ol/li[3] following::ol/li[4]">
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
setup({ explicit_done: true })
|
||||
test_withCredentials(false)
|
||||
</script>
|
||||
|
@ -27,8 +27,7 @@ function test_withCredentials(worker) {
|
||||
}
|
||||
}, "setting on synchronous XHR")
|
||||
|
||||
async_test("setting withCredentials when not in UNSENT, OPENED state").step(function() {
|
||||
this.add_cleanup(done)
|
||||
async_test(function() {
|
||||
var client = new XMLHttpRequest()
|
||||
client.open("GET", "resources/delay.py?ms=1000")
|
||||
client.send()
|
||||
@ -39,5 +38,11 @@ function test_withCredentials(worker) {
|
||||
this.done()
|
||||
}
|
||||
})
|
||||
})
|
||||
}, "setting withCredentials when not in UNSENT, OPENED state (asynchronous)")
|
||||
|
||||
test(function() {
|
||||
var client = new XMLHttpRequest()
|
||||
client.open("GET", "resources/delay.py?ms=1000", false)
|
||||
assert_throws("InvalidStateError", function() { client.withCredentials = true })
|
||||
}, "setting withCredentials when in DONE state (synchronous)")
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
importScripts("/resources/testharness.js")
|
||||
importScripts("XMLHttpRequest-withCredentials.js")
|
||||
test_withCredentials(true);
|
||||
done()
|
||||
|
@ -373,8 +373,8 @@ The assertion should not be:
|
||||
The test assertion is **optional**. It helps the reviewer understand
|
||||
the goal of the test so that he or she can make sure it is being
|
||||
tested correctly. Also, in case a problem is found with the test
|
||||
later, the testing method (e.g. using 'color' to determine pass/fail)
|
||||
can be changed (e.g. to using 'background-color') while preserving
|
||||
later, the testing method (e.g. using `color` to determine pass/fail)
|
||||
can be changed (e.g. to using `background-color`) while preserving
|
||||
the intent of the test (e.g. testing support for ID selectors).
|
||||
|
||||
Examples of good test assertions:
|
||||
|
@ -52,7 +52,7 @@ sheet is applied.</p>
|
||||
Within the test case it is recommended that the case itself indicate
|
||||
the necessary user style sheet that is required.
|
||||
|
||||
Examples: (code for the cascade.css file)
|
||||
Examples: (code for the [`cascade.css`][cascade-css] file)
|
||||
|
||||
``` css
|
||||
#cascade /* ID name should match user style sheet file name */
|
||||
@ -66,7 +66,7 @@ The rule ```#cascade``` in the example above is used by the test
|
||||
page to hide the prerequisite text. The rule name should match the
|
||||
user style sheet CSS file name in order to keep this orderly.
|
||||
|
||||
Examples: (code for the cascade-### XHTML files)
|
||||
Examples: (code for [the `cascade-###.xht` files][cascade-xht])
|
||||
|
||||
``` html
|
||||
<p id="cascade">
|
||||
@ -83,3 +83,6 @@ sheet is properly applied.
|
||||
Please flag test that require user style sheets with the userstyle
|
||||
flag so people running the tests know that a user style sheet is
|
||||
required.
|
||||
|
||||
[cascade-css]: https://github.com/w3c/csswg-test/blob/master/css21/cascade/support/cascade.css
|
||||
[cascade-xht]: https://github.com/w3c/csswg-test/blob/master/css21/cascade/cascade-001.xht
|
||||
|
@ -47,8 +47,8 @@ event firing. In some cases it is necessary to delay the screenshot
|
||||
later than this, for example becase some DOM manipulation is
|
||||
required to set up the desired test conditions. To enable this, the
|
||||
test may have a `class="reftest-wait"` attribute specified on the root
|
||||
element. This will cause the screenshot to be delayed until the load
|
||||
event has fired and the reftest-wait class has been removed from the
|
||||
element. This will cause the screenshot to be delayed until the `load`
|
||||
event has fired and the `reftest-wait` class has been removed from the
|
||||
root element (technical note: the implementation in wptrunner uses
|
||||
mutation observers so the screenshot will be triggered in the
|
||||
microtask checkpoint after the class is removed. Because the harness
|
||||
@ -66,12 +66,12 @@ Multiple references linked from a single file are interpreted as
|
||||
multiple possible renderings for that file. `<link rel=[mis]match>`
|
||||
elements in a reference create further conditions that must be met in
|
||||
order for the test to pass. For example, consider a situation where
|
||||
a.html has `<link rel=match href=b.html>` and `<link rel=match
|
||||
href=c.html>`, b.html has `<link rel=match href=b1.html>` and c.html
|
||||
`a.html` has `<link rel=match href=b.html>` and `<link rel=match
|
||||
href=c.html>`, `b.html` has `<link rel=match href=b1.html>` and `c.html`
|
||||
has `<link rel=mismatch href=c1.html>`. In this case, to pass we must
|
||||
either have a.html, b.html and b1.html all rendering identically, or
|
||||
a.html and c.html rendering identically, but c.html rendering
|
||||
differently from c1.html.
|
||||
either have `a.html`, `b.html` and `b1.html` all rendering identically, or
|
||||
`a.html` and `c.html` rendering identically, but `c.html` rendering
|
||||
differently from `c1.html`.
|
||||
|
||||
## Fuzzy Matching
|
||||
|
||||
|
@ -24,7 +24,7 @@ may also be used as long as the review is clearly linked.
|
||||
### Critic
|
||||
|
||||
[Critic][critic] is a code review tool that is frequently used for
|
||||
reviewing web-platform-tests sumbissions. Although it has a steeper
|
||||
reviewing web-platform-tests submissions. Although it has a steeper
|
||||
learning curve than the GitHub tools, it has more features that aid in
|
||||
conducting non-trivial reviews.
|
||||
|
||||
@ -33,13 +33,13 @@ and log (authentication is via GitHub). On the homepage, click "Add
|
||||
Filter". In the resulting dialog, select the web-platform-tests
|
||||
repository and add the path of the folder(s) where you want to review
|
||||
code, e.g. `/` to review any submissions or `XMLHttpRequest/` to
|
||||
review only submissions in the XHMLHttpRequest directory. Ensure that
|
||||
review only submissions in the `XHMLHttpRequest` directory. Ensure that
|
||||
your email address is added so that you receive notifications of new
|
||||
reviews matching your filters, and activity on existing reviews.
|
||||
|
||||
## Labels
|
||||
|
||||
Pull requests get automatically labelled in the Github repository. Check
|
||||
Pull requests get automatically labelled in the GitHub repository. Check
|
||||
out the [list of labels in Github][issues]
|
||||
to see the open pull requests for a given specification or a given Working Group.
|
||||
|
||||
|
@ -26,7 +26,7 @@ environment, the [wptrunner](http://github.com/w3c/wptrunner) test runner
|
||||
can be used. This is a test runner written in Python and designed to
|
||||
control the browser from the outside using some remote control
|
||||
protocol such as WebDriver. This allows it to handle cases such as the
|
||||
browser crashing that connot be handled by an in-browser harness. It
|
||||
browser crashing that cannot be handled by an in-browser harness. It
|
||||
also has the ability to automatically run both testharness-based tests
|
||||
and reftests.
|
||||
|
||||
|
@ -111,7 +111,7 @@ between attributes will be collapsed to a single space, duplicate
|
||||
attributes will be removed, optional closing tags will be inserted,
|
||||
and invalid markup will be normalized. If these changes should make
|
||||
the test inoperable, for example if the test is testing markup error
|
||||
recovery, add the [flag][requirement-flags] 'asis' to prevent
|
||||
recovery, add the [flag][requirement-flags] `asis` to prevent
|
||||
re-serialization. This flag will also prevent format conversions so it
|
||||
may be necessary to provide alternate versions of the test in other
|
||||
formats (XHTML, HTML, etc.)
|
||||
@ -262,7 +262,7 @@ the `location` dictionary, which has entries matching the
|
||||
{{location[host]}}
|
||||
{% endraw %}
|
||||
|
||||
is replaced by hostname:port for the current request.
|
||||
is replaced by `hostname:port` for the current request.
|
||||
|
||||
### Tests Requiring Special Headers
|
||||
|
||||
|
@ -196,14 +196,14 @@ red to denote failure._
|
||||
|
||||
#### Overlapped text
|
||||
|
||||
Tests of the 'line-height', 'font-size' and similar properties can
|
||||
Tests of the `line-height`, `font-size` and similar properties can
|
||||
sometimes be devised in such a way that a failure will result in the
|
||||
text overlapping.
|
||||
|
||||
#### The word "FAIL"
|
||||
|
||||
Some properties lend themselves well to this kind of test, for
|
||||
example 'quotes' and 'content'. The idea is that if the word "FAIL"
|
||||
example `quotes` and `content`. The idea is that if the word "FAIL"
|
||||
appears anywhere, something must have gone wrong.
|
||||
|
||||
[Example][fail-example]
|
||||
@ -219,7 +219,7 @@ shapes. This font is especially useful for testing font and text
|
||||
properties. Without this font it would be very hard to use the
|
||||
overlapping technique with text.
|
||||
|
||||
The font's em-square is exactly square. It's ascent and descent is
|
||||
The font's em-square is exactly square. Its ascent and descent is
|
||||
exactly the size of the em square. This means that the font's extent
|
||||
is exactly the same as its line-height, meaning that it can be
|
||||
exactly aligned with padding, borders, margins, and so forth.
|
||||
@ -263,9 +263,9 @@ E.g. Good:
|
||||
```
|
||||
|
||||
__If the test uses the Ahem font, make sure the line-height on block
|
||||
elements is specified; avoid 'line-height: normal'__. Also, for
|
||||
elements is specified; avoid `line-height: normal`__. Also, for
|
||||
absolute reliability, the difference between computed line-height
|
||||
and computed font-size should be dividable by 2.
|
||||
and computed font-size should be divisible by 2.
|
||||
|
||||
E.g. Bad:
|
||||
|
||||
@ -273,14 +273,14 @@ E.g. Bad:
|
||||
{font: 1.25em Ahem;} /* computed line-height value is 'normal' */
|
||||
{font: 20px Ahem;} /* computed line-height value is 'normal' */
|
||||
{font-size: 25px; line-height: 50px;} /* the difference between
|
||||
computed line-height and computed font-size is not dividable by 2. */
|
||||
computed line-height and computed font-size is not divisible by 2. */
|
||||
```
|
||||
|
||||
E.g. Good:
|
||||
|
||||
``` css
|
||||
{font-size: 25px; line-height: 51px;} /* the difference between
|
||||
computed line-height and computed font-size is dividable by 2. */
|
||||
computed line-height and computed font-size is divisible by 2. */
|
||||
```
|
||||
|
||||
[Example test using Ahem][ahem-example]
|
||||
@ -347,11 +347,9 @@ In practice, the important thing to decide is when to be methodical
|
||||
and when to simply test, in an ad hoc fashion, a cross section of
|
||||
the possibilities.
|
||||
|
||||
This example is a methodical test of the :not() pseudo-class with
|
||||
each attribute selector in turn, first for long values and then for
|
||||
short values:
|
||||
|
||||
http://www.hixie.ch/tests/adhoc/css/selectors/not/010.xml
|
||||
This is an [example][methodical-test] of a methodical test of the
|
||||
`:not()` pseudo-class with each attribute selector in turn, first
|
||||
for long values and then for short values.
|
||||
|
||||
### Overlapping
|
||||
|
||||
@ -399,7 +397,7 @@ As mentioned many times in this document, red indicates a bug, so
|
||||
nothing should ever be red in a test.
|
||||
|
||||
There is one important exception to this rule... the test for the
|
||||
'red' value for the color properties!
|
||||
`red` value for the color properties!
|
||||
|
||||
### Unobvious tests
|
||||
|
||||
@ -436,3 +434,4 @@ The last [subtest on this page][unobvious-test] shows this problem.
|
||||
[download-ahem]: http://www.w3.org/Style/CSS/Test/Fonts/Ahem/AHEM____.TTF
|
||||
[long-test]: http://www.hixie.ch/tests/evil/mixed/lineheight3.html
|
||||
[unobvious-test]: http://www.w3.org/Style/CSS/Test/CSS1/current/sec525.htm
|
||||
[methodical-test]: http://www.hixie.ch/tests/adhoc/css/selectors/not/010.xml
|
||||
|
@ -106,7 +106,7 @@ function test_after(child, nodeName, innerHTML) {
|
||||
parent.appendChild(document.createTextNode('1'));
|
||||
parent.appendChild(y);
|
||||
child.after(x, '2');
|
||||
var expected = innerHTML + '<x></x>12<y></y>';
|
||||
var expected = innerHTML + '<x></x>21<y></y>';
|
||||
assert_equals(parent.innerHTML, expected);
|
||||
}, nodeName + '.after() with one sibling of child and text as arguments.');
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>File input descendants of disabled fieldsets</title>
|
||||
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-fieldset-disabled" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<form>
|
||||
<fieldset id="fs" disabled="disabled">
|
||||
<input id="myfile" type="file" />
|
||||
</fieldset>
|
||||
</form>
|
||||
<script>
|
||||
test(function () {
|
||||
assert_true(document.getElementById('fs').disabled, "disabled fieldset should be disabled");
|
||||
assert_false(document.getElementById('myfile').willValidate, "form control descendant of disabled fieldset that is not also a descendant of a legend should be disabled");
|
||||
}, "A file input without a disabled attribute that is a descendant of a disabled fieldset should be disabled (modulo legend-related complications that don't apply here)");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTMLLegendElement Test: form</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<div id="log"></div>
|
||||
|
||||
<div style="display:none">
|
||||
<form id="testform">
|
||||
<legend id="testlegend">radio</legend>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
test(function () {
|
||||
var legendEle = document.getElementById("testlegend");
|
||||
assert_equals(legendEle.form, null);
|
||||
}, "Check if legend.form return null when legend has no fieldset element as its parent");
|
||||
|
||||
</script>
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Allowed content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of allowed content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/">
|
||||
<meta name="assert" content="opt_in_method: http-csp
|
||||
origin: same-host-wss
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: keep-scheme-redirect
|
||||
subresource: websocket-request
|
||||
expectation: allowed">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "http-csp",
|
||||
"origin": "same-host-wss",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "keep-scheme-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "allowed"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
Content-Security-Policy: block-all-mixed-content
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Allowed content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of allowed content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/">
|
||||
<meta name="assert" content="opt_in_method: http-csp
|
||||
origin: same-host-wss
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: no-redirect
|
||||
subresource: websocket-request
|
||||
expectation: allowed">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "http-csp",
|
||||
"origin": "same-host-wss",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "no-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "allowed"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
Content-Security-Policy: block-all-mixed-content
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Allowed content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of allowed content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/">
|
||||
<meta name="assert" content="opt_in_method: meta-csp
|
||||
origin: same-host-wss
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: no-redirect
|
||||
subresource: websocket-request
|
||||
expectation: allowed">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "meta-csp",
|
||||
"origin": "same-host-wss",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "no-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "allowed"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Allowed content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of allowed content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/">
|
||||
<meta name="assert" content="opt_in_method: no-opt-in
|
||||
origin: same-host-wss
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: keep-scheme-redirect
|
||||
subresource: websocket-request
|
||||
expectation: allowed">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "no-opt-in",
|
||||
"origin": "same-host-wss",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "keep-scheme-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "allowed"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Allowed content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of allowed content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/">
|
||||
<meta name="assert" content="opt_in_method: no-opt-in
|
||||
origin: same-host-wss
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: no-redirect
|
||||
subresource: websocket-request
|
||||
expectation: allowed">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "no-opt-in",
|
||||
"origin": "same-host-wss",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "no-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "allowed"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Blockable content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of blockable content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
|
||||
<meta name="assert" content="opt_in_method: http-csp
|
||||
origin: cross-origin-ws
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: keep-scheme-redirect
|
||||
subresource: websocket-request
|
||||
expectation: blocked">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "http-csp",
|
||||
"origin": "cross-origin-ws",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "keep-scheme-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "blocked"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
Content-Security-Policy: block-all-mixed-content
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Blockable content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of blockable content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
|
||||
<meta name="assert" content="opt_in_method: http-csp
|
||||
origin: cross-origin-ws
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: no-redirect
|
||||
subresource: websocket-request
|
||||
expectation: blocked">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "http-csp",
|
||||
"origin": "cross-origin-ws",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "no-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "blocked"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
Content-Security-Policy: block-all-mixed-content
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Blockable content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of blockable content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
|
||||
<meta name="assert" content="opt_in_method: http-csp
|
||||
origin: cross-origin-ws
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: swap-scheme-redirect
|
||||
subresource: websocket-request
|
||||
expectation: blocked">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "http-csp",
|
||||
"origin": "cross-origin-ws",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "swap-scheme-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "blocked"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
Content-Security-Policy: block-all-mixed-content
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Blockable content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of blockable content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
|
||||
<meta name="assert" content="opt_in_method: http-csp
|
||||
origin: same-host-ws
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: keep-scheme-redirect
|
||||
subresource: websocket-request
|
||||
expectation: blocked">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "http-csp",
|
||||
"origin": "same-host-ws",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "keep-scheme-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "blocked"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
Content-Security-Policy: block-all-mixed-content
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Blockable content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of blockable content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
|
||||
<meta name="assert" content="opt_in_method: http-csp
|
||||
origin: same-host-ws
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: no-redirect
|
||||
subresource: websocket-request
|
||||
expectation: blocked">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "http-csp",
|
||||
"origin": "same-host-ws",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "no-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "blocked"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
Content-Security-Policy: block-all-mixed-content
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Blockable content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of blockable content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
|
||||
<meta name="assert" content="opt_in_method: http-csp
|
||||
origin: same-host-ws
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: swap-scheme-redirect
|
||||
subresource: websocket-request
|
||||
expectation: blocked">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "http-csp",
|
||||
"origin": "same-host-ws",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "swap-scheme-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "blocked"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
Content-Security-Policy: block-all-mixed-content
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Blockable content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of blockable content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
|
||||
<meta name="assert" content="opt_in_method: meta-csp
|
||||
origin: cross-origin-ws
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: no-redirect
|
||||
subresource: websocket-request
|
||||
expectation: blocked">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "meta-csp",
|
||||
"origin": "cross-origin-ws",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "no-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "blocked"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Blockable content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of blockable content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
|
||||
<meta name="assert" content="opt_in_method: meta-csp
|
||||
origin: same-host-ws
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: no-redirect
|
||||
subresource: websocket-request
|
||||
expectation: blocked">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "meta-csp",
|
||||
"origin": "same-host-ws",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "no-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "blocked"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Blockable content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of blockable content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
|
||||
<meta name="assert" content="opt_in_method: no-opt-in
|
||||
origin: cross-origin-ws
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: keep-scheme-redirect
|
||||
subresource: websocket-request
|
||||
expectation: blocked">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "no-opt-in",
|
||||
"origin": "cross-origin-ws",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "keep-scheme-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "blocked"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Blockable content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of blockable content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
|
||||
<meta name="assert" content="opt_in_method: no-opt-in
|
||||
origin: cross-origin-ws
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: no-redirect
|
||||
subresource: websocket-request
|
||||
expectation: blocked">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "no-opt-in",
|
||||
"origin": "cross-origin-ws",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "no-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "blocked"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Blockable content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of blockable content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
|
||||
<meta name="assert" content="opt_in_method: no-opt-in
|
||||
origin: cross-origin-ws
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: swap-scheme-redirect
|
||||
subresource: websocket-request
|
||||
expectation: blocked">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "no-opt-in",
|
||||
"origin": "cross-origin-ws",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "swap-scheme-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "blocked"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Blockable content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of blockable content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
|
||||
<meta name="assert" content="opt_in_method: no-opt-in
|
||||
origin: same-host-ws
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: keep-scheme-redirect
|
||||
subresource: websocket-request
|
||||
expectation: blocked">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "no-opt-in",
|
||||
"origin": "same-host-ws",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "keep-scheme-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "blocked"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Blockable content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of blockable content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
|
||||
<meta name="assert" content="opt_in_method: no-opt-in
|
||||
origin: same-host-ws
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: no-redirect
|
||||
subresource: websocket-request
|
||||
expectation: blocked">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "no-opt-in",
|
||||
"origin": "same-host-ws",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "no-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "blocked"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Mixed-Content: Blockable content</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="description" content="Test behavior of blockable content.">
|
||||
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
|
||||
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
|
||||
<meta name="assert" content="opt_in_method: no-opt-in
|
||||
origin: same-host-ws
|
||||
source_scheme: https
|
||||
context_nesting: top-level
|
||||
redirection: swap-scheme-redirect
|
||||
subresource: websocket-request
|
||||
expectation: blocked">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mixed-content/generic/common.js"></script>
|
||||
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
MixedContentTestCase(
|
||||
{
|
||||
"opt_in_method": "no-opt-in",
|
||||
"origin": "same-host-ws",
|
||||
"source_scheme": "https",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "swap-scheme-redirect",
|
||||
"subresource": "websocket-request",
|
||||
"expectation": "blocked"
|
||||
},
|
||||
document.querySelector("meta[name=assert]").content,
|
||||
new SanityChecker()
|
||||
).start();
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -354,6 +354,31 @@ function requestViaObject(url) {
|
||||
return createRequestViaElement("object", {"data": url}, document.body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new WebSocket pointing to {@code url} and sends a message string
|
||||
* "echo". The {@code message} and {@code error} events are triggering the
|
||||
* returned promise resolve/reject events.
|
||||
* @param {string} url The URL for WebSocket to connect to.
|
||||
* @return {Promise} The promise for success/error events.
|
||||
*/
|
||||
function requestViaWebSocket(url) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var websocket = new WebSocket(url);
|
||||
|
||||
websocket.addEventListener("message", function(e) {
|
||||
resolve(JSON.parse(e.data));
|
||||
});
|
||||
|
||||
websocket.addEventListener("open", function(e) {
|
||||
websocket.send("echo");
|
||||
});
|
||||
|
||||
websocket.addEventListener("error", function(e) {
|
||||
reject(e)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// SanityChecker does nothing in release mode. See sanity-checker.js for debug
|
||||
// mode.
|
||||
function SanityChecker() {}
|
||||
|
@ -58,14 +58,15 @@ def main(request, response):
|
||||
|
||||
key = request.GET["key"]
|
||||
stash = request.server.stash
|
||||
path = request.GET.get("path", request.url.split('?'))[0]
|
||||
|
||||
if action == "put":
|
||||
value = request.GET["value"]
|
||||
stash.take(key=key)
|
||||
stash.put(key=key, value=value)
|
||||
stash.take(key=key, path=path)
|
||||
stash.put(key=key, value=value, path=path)
|
||||
response_data = json.dumps({"status": "success", "result": key})
|
||||
elif action == "purge":
|
||||
value = stash.take(key=key)
|
||||
value = stash.take(key=key, path=path)
|
||||
if content_type == "image/png":
|
||||
response_data = open(os.path.join(request.doc_root,
|
||||
"images",
|
||||
@ -86,7 +87,7 @@ def main(request, response):
|
||||
else:
|
||||
response_data = "/* purged */"
|
||||
elif action == "take":
|
||||
value = stash.take(key=key)
|
||||
value = stash.take(key=key, path=path)
|
||||
if value is None:
|
||||
status = "allowed"
|
||||
else:
|
||||
|
@ -16,30 +16,43 @@
|
||||
* @return {object} Object wrapping the start method used to run the test.
|
||||
*/
|
||||
function MixedContentTestCase(scenario, description, sanityChecker) {
|
||||
var insecureProtocol = "http";
|
||||
var secureProtocol = "https";
|
||||
var httpProtocol = "http";
|
||||
var httpsProtocol = "https";
|
||||
var wsProtocol = "ws";
|
||||
var wssProtocol = "wss";
|
||||
|
||||
var sameOriginHost = location.hostname;
|
||||
var crossOriginHost = "{{domains[www1]}}";
|
||||
|
||||
// These values can evaluate to either empty strings or a ":port" string.
|
||||
var insecurePort = getNormalizedPort(parseInt("{{ports[http][0]}}", 10));
|
||||
var securePort = getNormalizedPort(parseInt("{{ports[https][0]}}", 10));
|
||||
var httpPort = getNormalizedPort(parseInt("{{ports[http][0]}}", 10));
|
||||
var httpsPort = getNormalizedPort(parseInt("{{ports[https][0]}}", 10));
|
||||
var wsPort = getNormalizedPort(parseInt("{{ports[ws][0]}}", 10));
|
||||
var wssPort = getNormalizedPort(parseInt("{{ports[wss][0]}}", 10));
|
||||
|
||||
var resourcePath = "/mixed-content/generic/expect.py";
|
||||
var wsResourcePath = "/stash_responder";
|
||||
|
||||
// Map all endpoints to scenario for use in the test.
|
||||
var endpoint = {
|
||||
"same-origin":
|
||||
location.origin + resourcePath,
|
||||
"same-host-https":
|
||||
secureProtocol + "://" + sameOriginHost + securePort + resourcePath,
|
||||
httpsProtocol + "://" + sameOriginHost + httpsPort + resourcePath,
|
||||
"same-host-http":
|
||||
insecureProtocol + "://" + sameOriginHost + insecurePort + resourcePath,
|
||||
httpProtocol + "://" + sameOriginHost + httpPort + resourcePath,
|
||||
"cross-origin-https":
|
||||
secureProtocol + "://" + crossOriginHost + securePort + resourcePath,
|
||||
httpsProtocol + "://" + crossOriginHost + httpsPort + resourcePath,
|
||||
"cross-origin-http":
|
||||
insecureProtocol + "://" + crossOriginHost + insecurePort + resourcePath
|
||||
httpProtocol + "://" + crossOriginHost + httpPort + resourcePath,
|
||||
"same-host-wss":
|
||||
wssProtocol + "://" + sameOriginHost + wssPort + wsResourcePath,
|
||||
"same-host-ws":
|
||||
wsProtocol + "://" + sameOriginHost + wsPort + wsResourcePath,
|
||||
"cross-origin-wss":
|
||||
wssProtocol + "://" + crossOriginHost + wssPort + wsResourcePath,
|
||||
"cross-origin-ws":
|
||||
wsProtocol + "://" + crossOriginHost + wsPort + wsResourcePath
|
||||
};
|
||||
|
||||
// Mapping all the resource requesting methods to the scenario.
|
||||
@ -58,7 +71,8 @@ function MixedContentTestCase(scenario, description, sanityChecker) {
|
||||
"picture-tag": requestViaPicture,
|
||||
"object-tag": requestViaObject,
|
||||
"link-css-tag": requestViaLinkStylesheet,
|
||||
"link-prefetch-tag": requestViaLinkPrefetch
|
||||
"link-prefetch-tag": requestViaLinkPrefetch,
|
||||
"websocket-request": requestViaWebSocket
|
||||
};
|
||||
|
||||
sanityChecker.checkScenario(scenario, resourceMap);
|
||||
@ -79,7 +93,8 @@ function MixedContentTestCase(scenario, description, sanityChecker) {
|
||||
"picture-tag": "image/png",
|
||||
"object-tag": "text/html",
|
||||
"link-css-tag": "text/css",
|
||||
"link-prefetch-tag": "text/html"
|
||||
"link-prefetch-tag": "text/html",
|
||||
"websocket-request": "application/json"
|
||||
};
|
||||
|
||||
var mixed_content_test = async_test(description);
|
||||
@ -89,14 +104,18 @@ function MixedContentTestCase(scenario, description, sanityChecker) {
|
||||
|
||||
var key = guid();
|
||||
var value = guid();
|
||||
// We use the same path for both HTTP/S and WS/S stash requests.
|
||||
var stash_path = encodeURIComponent("/mixed-content");
|
||||
var announceResourceRequestUrl = endpoint['same-origin'] +
|
||||
"?action=put&key=" + key +
|
||||
"&value=" + value;
|
||||
"&value=" + value +
|
||||
"&path=" + stash_path;
|
||||
var assertResourceRequestUrl = endpoint['same-origin'] +
|
||||
"?action=take&key=" + key;
|
||||
"?action=take&key=" + key +
|
||||
"&path=" + stash_path;
|
||||
var resourceRequestUrl = endpoint[scenario.origin] + "?redirection=" +
|
||||
scenario.redirection + "&action=purge&key=" +
|
||||
key + "&content_type=" +
|
||||
scenario.redirection + "&action=purge&key=" + key +
|
||||
"&path=" + stash_path + "&content_type=" +
|
||||
contentType[scenario.subresource];
|
||||
|
||||
xhrRequest(announceResourceRequestUrl)
|
||||
|
@ -69,6 +69,20 @@
|
||||
},
|
||||
"origin": ["cross-origin-http", "same-host-http"],
|
||||
"expectation": "blocked"
|
||||
},
|
||||
{
|
||||
"name": "ws-downgrade-blocks",
|
||||
"expansion": "default",
|
||||
"source_scheme": "https",
|
||||
"opt_in_method": ["no-opt-in", "http-csp", "meta-csp"],
|
||||
"context_nesting": "top-level",
|
||||
"redirection": "*",
|
||||
"subresource": {
|
||||
"blockable": "websocket-request",
|
||||
"optionally-blockable": []
|
||||
},
|
||||
"origin": ["cross-origin-ws", "same-host-ws"],
|
||||
"expectation": "blocked"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -91,6 +105,20 @@
|
||||
},
|
||||
"origin": ["same-host-https"],
|
||||
"expectation": "allowed"
|
||||
},
|
||||
{
|
||||
"name": "websocket-allowed",
|
||||
"expansion": "default",
|
||||
"source_scheme": "https",
|
||||
"opt_in_method": "*",
|
||||
"context_nesting": "top-level",
|
||||
"redirection": ["no-redirect", "keep-scheme-redirect"],
|
||||
"subresource": {
|
||||
"blockable": "websocket-request",
|
||||
"optionally-blockable": []
|
||||
},
|
||||
"origin": ["same-host-wss"],
|
||||
"expectation": "allowed"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -98,7 +126,7 @@
|
||||
|
||||
"excluded_tests": [
|
||||
{
|
||||
"name": "TODO-subresources-not-supported",
|
||||
"name": "Redundant-subresources",
|
||||
"expansion": "*",
|
||||
"source_scheme": "*",
|
||||
"opt_in_method": "*",
|
||||
@ -106,14 +134,34 @@
|
||||
"redirection": "*",
|
||||
"subresource": {
|
||||
"blockable": [
|
||||
"a-tag",
|
||||
"websocket-request"
|
||||
"a-tag"
|
||||
],
|
||||
"optionally-blockable": []
|
||||
},
|
||||
"origin": "*",
|
||||
"expectation": "*"
|
||||
},
|
||||
{
|
||||
"name": "Skip-origins-not-applicable-to-websockets",
|
||||
"expansion": "*",
|
||||
"source_scheme": "*",
|
||||
"opt_in_method": "*",
|
||||
"context_nesting": "*",
|
||||
"redirection": "*",
|
||||
"subresource": {
|
||||
"blockable": [
|
||||
"websocket-request"
|
||||
],
|
||||
"optionally-blockable": []
|
||||
},
|
||||
"origin": [
|
||||
"same-host-https",
|
||||
"same-host-http",
|
||||
"cross-origin-https",
|
||||
"cross-origin-http"
|
||||
],
|
||||
"expectation": "*"
|
||||
},
|
||||
{
|
||||
"name": "TODO-opt-in-method-img-cross-origin",
|
||||
"expansion": "*",
|
||||
@ -175,7 +223,11 @@
|
||||
"same-host-https",
|
||||
"same-host-http",
|
||||
"cross-origin-https",
|
||||
"cross-origin-http"
|
||||
"cross-origin-http",
|
||||
"same-host-wss",
|
||||
"same-host-ws",
|
||||
"cross-origin-wss",
|
||||
"cross-origin-ws"
|
||||
],
|
||||
"subresource": {
|
||||
"blockable": [
|
||||
|
@ -24,25 +24,38 @@ policies and contribution forms [3].
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
// These elements does not support creating shadow root.
|
||||
// instead, NotSupportedError should be thrown.
|
||||
// http://w3c.github.io/webcomponents/spec/shadow/#widl-Element-createShadowRoot-ShadowRoot-ShadowRootInit-shadowRootInitDict
|
||||
var BLACK_LISTED_ELEMENTS = [
|
||||
"button",
|
||||
"details",
|
||||
"input",
|
||||
"marquee",
|
||||
"meter",
|
||||
"progress",
|
||||
"select",
|
||||
"textarea",
|
||||
"keygen"
|
||||
];
|
||||
|
||||
function testElement(elementName) {
|
||||
var doc = document.implementation.createHTMLDocument('Test');
|
||||
var element = doc.createElement(elementName);
|
||||
doc.body.appendChild(element);
|
||||
|
||||
var shadowRoot1 = element.createShadowRoot();
|
||||
assert_equals(shadowRoot1.ownerDocument, doc);
|
||||
|
||||
var shadowRoot2 = element.createShadowRoot();
|
||||
assert_equals(shadowRoot2.ownerDocument, doc);
|
||||
var shadowRoot = element.createShadowRoot();
|
||||
assert_equals(shadowRoot.ownerDocument, doc);
|
||||
}
|
||||
|
||||
var testParameters = HTML5_ELEMENT_NAMES.map(function (name) {
|
||||
var testParameters = HTML5_ELEMENT_NAMES.filter(function(name) {
|
||||
return BLACK_LISTED_ELEMENTS.indexOf(name) == -1;
|
||||
}).map(function (name) {
|
||||
return [
|
||||
'Checks whether an element "' + name + '" can create a shadow root.',
|
||||
name
|
||||
];
|
||||
});
|
||||
|
||||
generate_tests(testElement, testParameters);
|
||||
</script>
|
||||
</body>
|
||||
|
@ -61,16 +61,9 @@ function createDocumentFragmentNode() {
|
||||
return node;
|
||||
}
|
||||
|
||||
function createEntityReferenceNode() {
|
||||
var doc = document.implementation.createDocument(XHTML_NAMESPACE, 'html');
|
||||
var node = doc.createEntityReference('entity-reference-node');
|
||||
doc.documentElement.appendChild(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
function createProcessingInstructionNode() {
|
||||
var doc = document.implementation.createDocument(XHTML_NAMESPACE, 'html');
|
||||
var node = doc.createProcessingInstruction('processing-instruction-node');
|
||||
var node = doc.createProcessingInstruction('processing-instruction-node', '');
|
||||
doc.documentElement.appendChild(node);
|
||||
return node;
|
||||
}
|
||||
@ -85,7 +78,6 @@ var factories = [
|
||||
['a CDATA section node', createCDATASectionNode],
|
||||
['an attribute node', createAttributeNode],
|
||||
['a document fragment node', createDocumentFragmentNode],
|
||||
['an entity reference node', createEntityReferenceNode],
|
||||
['a processing instruction node', createProcessingInstructionNode],
|
||||
['a document node', createDocumentNode]
|
||||
];
|
||||
@ -108,29 +100,6 @@ function testNoCreateShadowRoot(factory) {
|
||||
}
|
||||
|
||||
generate_tests(testNoCreateShadowRoot, noCreateShadowRootTestParameters);
|
||||
|
||||
// When createShadowRoot() is called on non-element nodes, it should throw
|
||||
// InvalidNodeTypeError (step 1 of section 10.2.2).
|
||||
function testThrowInvalidNodeTypeError(factory) {
|
||||
var node = factory();
|
||||
node.createShadowRoot = Element.prototype.createShadowRoot;
|
||||
assert_throws('InvalidNodeTypeError',
|
||||
function () { node.createShadowRoot(); });
|
||||
}
|
||||
|
||||
var throwInvalidNodeTypeErrorTestParameters = factories.map(
|
||||
function (nameAndFactory) {
|
||||
var name = nameAndFactory[0];
|
||||
var factory = nameAndFactory[1];
|
||||
return [
|
||||
'When createShadowRoot() is called on ' + name + ', ' +
|
||||
'InvalidNodeTypeError should be thrown.',
|
||||
factory
|
||||
];
|
||||
});
|
||||
|
||||
generate_tests(testThrowInvalidNodeTypeError,
|
||||
throwInvalidNodeTypeErrorTestParameters);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -46,6 +46,10 @@
|
||||
<label for="path" class="col-sm-3 control-label">Run tests under path</label>
|
||||
<div class="col-sm-9">
|
||||
<input value="/" id='path' class='path form-control' disabled>
|
||||
<label>
|
||||
<input type=checkbox id='use_regex'>
|
||||
Use regular expression
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -85,6 +89,7 @@
|
||||
To run a set of
|
||||
<a href="https://github.com/w3c/web-platform-tests/blob/master/README.md">web-platform-tests</a>
|
||||
tests, specify a path value in the <b>Run tests under path</b> field above. Example paths:
|
||||
</p>
|
||||
<ul>
|
||||
<li><code>/</code> - runs all of the tests from the root down</li>
|
||||
<li><code>/websockets</code> - runs all of the
|
||||
@ -94,12 +99,25 @@
|
||||
<li><code>/html/syntax/parsing</code> - runs all of the
|
||||
<a href="http://w3c-test.org/html/syntax/parsing/">html/syntax/parsing</a> tests</li>
|
||||
</ul>
|
||||
<p>
|
||||
Multiple test paths can be specified by separating them with comma or whitespace. For example,
|
||||
<code>/js, /html</code> will run the <a href="http://w3c-test.org/js/">js</a> <em>and</em> <a href="http://w3c-test.org/html/">html</a>
|
||||
tests.
|
||||
</p>
|
||||
<p>
|
||||
<a href="http://www.w3schools.com/jsref/jsref_obj_regexp.asp" target="_blank">Javascript regular expressions</a> are also supported for filtering. When the option is checked,
|
||||
only a test path matching the regex pattern will run. For example, you can specify <code>^/js/|^/html/</code>
|
||||
to run the <a href="http://w3c-test.org/js/">js</a> <em>and</em> <a href="http://w3c-test.org/html/">html</a>
|
||||
tests.
|
||||
</p>
|
||||
<p>
|
||||
If the test runner is run online, the set of tests available to run can be found in the
|
||||
<a href="http://w3c-test.org/">w3c-test.org</a> test repository.
|
||||
</p>
|
||||
<p>
|
||||
Tests will run in a new window. For reftests and manual tests it’s best
|
||||
to put that window side-by-side with this one.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="output">
|
||||
@ -117,20 +135,34 @@
|
||||
<table class='table'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Passed
|
||||
<th>Failed
|
||||
<th>Timeouts
|
||||
<th>Errors
|
||||
<th></th>
|
||||
<th>Passed</th>
|
||||
<th>Failed</th>
|
||||
<th>Timeouts</th>
|
||||
<th>Errors</th>
|
||||
<th>Not Run</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class='PASS'>0
|
||||
<td class='FAIL'>0
|
||||
<td class='TIMEOUT'>0
|
||||
<td class='ERROR'>0
|
||||
<td class='NOTRUN'>0
|
||||
<td></td>
|
||||
<td class='PASS'>0</td>
|
||||
<td class='FAIL'>0</td>
|
||||
<td class='TIMEOUT'>0</td>
|
||||
<td class='ERROR'>0</td>
|
||||
<td class='NOTRUN'>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
Display:
|
||||
</label>
|
||||
</td>
|
||||
<td><input type=checkbox class="result-display-filter" value="PASS" checked></td>
|
||||
<td><input type=checkbox class="result-display-filter" value="FAIL" checked></td>
|
||||
<td><input type=checkbox class="result-display-filter" value="TIMEOUT" checked></td>
|
||||
<td><input type=checkbox class="result-display-filter" value="ERROR" checked></td>
|
||||
<td><input type=checkbox class="result-display-filter" value="NOTRUN" checked></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -56,13 +56,21 @@ Manifest.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
function ManifestIterator(manifest, path, test_types) {
|
||||
function ManifestIterator(manifest, path, test_types, use_regex) {
|
||||
this.manifest = manifest;
|
||||
this.path = path;
|
||||
this.paths = null;
|
||||
this.regex_pattern = null;
|
||||
this.test_types = test_types;
|
||||
this.test_types_index = -1;
|
||||
this.test_list = null;
|
||||
this.test_index = null;
|
||||
|
||||
if (use_regex) {
|
||||
this.regex_pattern = path;
|
||||
} else {
|
||||
// Split paths by either a comma or whitespace, and ignore empty sub-strings.
|
||||
this.paths = path.split(/[,\s]+/).filter(function(s) { return s.length > 0 });
|
||||
}
|
||||
}
|
||||
|
||||
ManifestIterator.prototype = {
|
||||
@ -94,7 +102,13 @@ ManifestIterator.prototype = {
|
||||
},
|
||||
|
||||
matches: function(manifest_item) {
|
||||
return manifest_item.url.indexOf(this.path) === 0;
|
||||
if (this.regex_pattern !== null) {
|
||||
return manifest_item.url.match(this.regex_pattern);
|
||||
} else {
|
||||
return this.paths.some(function(p) {
|
||||
return manifest_item.url.indexOf(p) === 0;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
to_test: function(manifest_item) {
|
||||
@ -138,6 +152,18 @@ function VisualOutput(elem, runner) {
|
||||
this.runner.start_callbacks.push(this.on_start.bind(this));
|
||||
this.runner.result_callbacks.push(this.on_result.bind(this));
|
||||
this.runner.done_callbacks.push(this.on_done.bind(this));
|
||||
|
||||
this.display_filter_state = {};
|
||||
|
||||
var visual_output = this;
|
||||
var display_filter_inputs = this.elem.querySelectorAll(".result-display-filter");
|
||||
for (var i = 0; i < display_filter_inputs.length; ++i) {
|
||||
var display_filter_input = display_filter_inputs[i];
|
||||
this.display_filter_state[display_filter_input.value] = display_filter_input.checked;
|
||||
display_filter_input.addEventListener("change", function(e) {
|
||||
visual_output.apply_display_filter(e.target.value, e.target.checked);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
VisualOutput.prototype = {
|
||||
@ -238,6 +264,7 @@ VisualOutput.prototype = {
|
||||
this.elem.querySelector("td." + status_arr[i]).textContent = this.result_count[status_arr[i]];
|
||||
}
|
||||
|
||||
this.apply_display_filter_to_result_row(row, this.display_filter_state[test_status]);
|
||||
this.results_table.tBodies[0].appendChild(row);
|
||||
this.update_meter(this.runner.progress(), this.runner.results.count(), this.runner.test_count());
|
||||
},
|
||||
@ -295,8 +322,19 @@ VisualOutput.prototype = {
|
||||
this.meter.setAttribute("aria-valuenow", count);
|
||||
this.meter.setAttribute("aria-valuemax", total);
|
||||
this.meter.textContent = this.meter.style.width = (progress * 100).toFixed(1) + "%";
|
||||
}
|
||||
},
|
||||
|
||||
apply_display_filter: function(test_status, display_state) {
|
||||
this.display_filter_state[test_status] = display_state;
|
||||
var result_cells = this.elem.querySelectorAll(".results > table tr td." + test_status);
|
||||
for (var i = 0; i < result_cells.length; ++i) {
|
||||
this.apply_display_filter_to_result_row(result_cells[i].parentNode, display_state)
|
||||
}
|
||||
},
|
||||
|
||||
apply_display_filter_to_result_row: function(result_row, display_state) {
|
||||
result_row.style.display = display_state ? "" : "none";
|
||||
}
|
||||
};
|
||||
|
||||
function ManualUI(elem, runner) {
|
||||
@ -382,6 +420,7 @@ ManualUI.prototype = {
|
||||
function TestControl(elem, runner) {
|
||||
this.elem = elem;
|
||||
this.path_input = this.elem.querySelector(".path");
|
||||
this.use_regex_input = this.elem.querySelector("#use_regex");
|
||||
this.pause_button = this.elem.querySelector("button.togglePause");
|
||||
this.start_button = this.elem.querySelector("button.toggleStart");
|
||||
this.type_checkboxes = Array.prototype.slice.call(
|
||||
@ -412,7 +451,8 @@ TestControl.prototype = {
|
||||
var path = this.get_path();
|
||||
var test_types = this.get_test_types();
|
||||
var settings = this.get_testharness_settings();
|
||||
this.runner.start(path, test_types, settings);
|
||||
var use_regex = this.get_use_regex();
|
||||
this.runner.start(path, test_types, settings, use_regex);
|
||||
this.set_stop();
|
||||
this.set_pause();
|
||||
}.bind(this);
|
||||
@ -466,6 +506,10 @@ TestControl.prototype = {
|
||||
output: this.render_checkbox.checked};
|
||||
},
|
||||
|
||||
get_use_regex: function() {
|
||||
return this.use_regex_input.checked;
|
||||
},
|
||||
|
||||
on_done: function() {
|
||||
this.set_pause();
|
||||
this.set_start();
|
||||
@ -557,14 +601,15 @@ Runner.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
start: function(path, test_types, testharness_settings) {
|
||||
start: function(path, test_types, testharness_settings, use_regex) {
|
||||
this.pause_flag = false;
|
||||
this.stop_flag = false;
|
||||
this.done_flag = false;
|
||||
this.path = path;
|
||||
this.use_regex = use_regex;
|
||||
this.test_types = test_types;
|
||||
window.testharness_properties = testharness_settings;
|
||||
this.manifest_iterator = new ManifestIterator(this.manifest, this.path, this.test_types);
|
||||
this.manifest_iterator = new ManifestIterator(this.manifest, this.path, this.test_types, this.use_regex);
|
||||
this.num_tests = null;
|
||||
|
||||
if (this.manifest.data === null) {
|
||||
@ -709,7 +754,8 @@ function setup() {
|
||||
if (options.autorun === "1") {
|
||||
runner.start(test_control.get_path(),
|
||||
test_control.get_test_types(),
|
||||
test_control.get_testharness_settings());
|
||||
test_control.get_testharness_settings(),
|
||||
test_control.get_use_regex());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import time
|
||||
import traceback
|
||||
import urllib2
|
||||
import uuid
|
||||
from collections import defaultdict
|
||||
from collections import defaultdict, OrderedDict
|
||||
from multiprocessing import Process, Event
|
||||
|
||||
from .. import localpaths
|
||||
@ -50,17 +50,55 @@ subdomains = [u"www",
|
||||
u"天気の良い日",
|
||||
u"élève"]
|
||||
|
||||
def default_routes():
|
||||
return [("GET", "/tools/runner/*", handlers.file_handler),
|
||||
("POST", "/tools/runner/update_manifest.py", handlers.python_script_handler),
|
||||
("*", "/_certs/*", handlers.ErrorHandler(404)),
|
||||
class RoutesBuilder(object):
|
||||
def __init__(self):
|
||||
self.forbidden_override = [("GET", "/tools/runner/*", handlers.file_handler),
|
||||
("POST", "/tools/runner/update_manifest.py",
|
||||
handlers.python_script_handler)]
|
||||
|
||||
self.forbidden = [("*", "/_certs/*", handlers.ErrorHandler(404)),
|
||||
("*", "/tools/*", handlers.ErrorHandler(404)),
|
||||
("*", "{spec}/tools/*", handlers.ErrorHandler(404)),
|
||||
("*", "/serve.py", handlers.ErrorHandler(404)),
|
||||
("*", "*.py", handlers.python_script_handler),
|
||||
("GET", "*.asis", handlers.as_is_handler),
|
||||
("GET", "*.worker", WorkersHandler()),
|
||||
("GET", "*", handlers.file_handler),]
|
||||
("*", "/serve.py", handlers.ErrorHandler(404))]
|
||||
|
||||
self.static = [("GET", "*.worker", WorkersHandler())]
|
||||
|
||||
self.mountpoint_routes = OrderedDict()
|
||||
|
||||
self.add_mount_point("/", None)
|
||||
|
||||
def get_routes(self):
|
||||
routes = self.forbidden_override + self.forbidden + self.static
|
||||
# Using reversed here means that mount points that are added later
|
||||
# get higher priority. This makes sense since / is typically added
|
||||
# first.
|
||||
for item in reversed(self.mountpoint_routes.values()):
|
||||
routes.extend(item)
|
||||
return routes
|
||||
|
||||
def add_static(self, path, format_args, content_type, route):
|
||||
handler = handlers.StaticHandler(path, format_args, content_type)
|
||||
self.static.append((b"GET", str(route), handler))
|
||||
|
||||
def add_mount_point(self, url_base, path):
|
||||
url_base = "/%s/" % url_base.strip("/") if url_base != "/" else "/"
|
||||
|
||||
self.mountpoint_routes[url_base] = []
|
||||
|
||||
routes = [("GET", "*.asis", handlers.AsIsHandler),
|
||||
("*", "*.py", handlers.PythonScriptHandler),
|
||||
("GET", "*", handlers.FileHandler)]
|
||||
|
||||
for (method, suffix, handler_cls) in routes:
|
||||
self.mountpoint_routes[url_base].append(
|
||||
(method,
|
||||
b"%s%s" % (str(url_base) if url_base != "/" else "", str(suffix)),
|
||||
handler_cls(base_path=path, url_base=url_base)))
|
||||
|
||||
|
||||
def default_routes():
|
||||
return RoutesBuilder().get_routes()
|
||||
|
||||
|
||||
def setup_logger(level):
|
||||
import logging
|
||||
|
@ -51,13 +51,17 @@ class DirectoryHandler(object):
|
||||
self.base_path = base_path
|
||||
self.url_base = url_base
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s base_path:%s url_base:%s>" % (self.__class__.__name__, self.base_path, self.url_base)
|
||||
|
||||
def __call__(self, request, response):
|
||||
if not request.url_parts.path.endswith("/"):
|
||||
raise HTTPException(404)
|
||||
|
||||
path = filesystem_path(self.base_path, request, self.url_base)
|
||||
|
||||
assert os.path.isdir(path)
|
||||
if not os.path.isdir(path):
|
||||
raise HTTPException(404, "%s is not a directory" % path)
|
||||
|
||||
response.headers = [("Content-Type", "text/html")]
|
||||
response.content = """<!doctype html>
|
||||
@ -102,7 +106,10 @@ class FileHandler(object):
|
||||
def __init__(self, base_path=None, url_base="/"):
|
||||
self.base_path = base_path
|
||||
self.url_base = url_base
|
||||
self.directory_handler = DirectoryHandler(self.base_path)
|
||||
self.directory_handler = DirectoryHandler(self.base_path, self.url_base)
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s base_path:%s url_base:%s>" % (self.__class__.__name__, self.base_path, self.url_base)
|
||||
|
||||
def __call__(self, request, response):
|
||||
path = filesystem_path(self.base_path, request, self.url_base)
|
||||
@ -209,6 +216,9 @@ class PythonScriptHandler(object):
|
||||
self.base_path = base_path
|
||||
self.url_base = url_base
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s base_path:%s url_base:%s>" % (self.__class__.__name__, self.base_path, self.url_base)
|
||||
|
||||
def __call__(self, request, response):
|
||||
path = filesystem_path(self.base_path, request, self.url_base)
|
||||
|
||||
@ -330,3 +340,29 @@ class ErrorHandler(object):
|
||||
|
||||
def __call__(self, request, response):
|
||||
response.set_error(self.status)
|
||||
|
||||
|
||||
class StaticHandler(object):
|
||||
def __init__(self, path, format_args, content_type, **headers):
|
||||
"""Hander that reads a file from a path and substitutes some fixed data
|
||||
|
||||
:param path: Path to the template file to use
|
||||
:param format_args: Dictionary of values to substitute into the template file
|
||||
:param content_type: Content type header to server the response with
|
||||
:param headers: List of headers to send with responses"""
|
||||
|
||||
with open(path) as f:
|
||||
self.data = f.read() % format_args
|
||||
|
||||
self.resp_headers = [("Content-Type", content_type)]
|
||||
for k, v in headers.iteritems():
|
||||
resp_headers.append((k.replace("_", "-"), v))
|
||||
|
||||
self.handler = handler(self.handle_request)
|
||||
|
||||
def handle_request(self, request, response):
|
||||
return self.resp_headers, self.data
|
||||
|
||||
def __call__(self, request, response):
|
||||
rv = self.handler(request, response)
|
||||
return rv
|
||||
|
@ -57,18 +57,19 @@ def start_server(address=None, authkey=None):
|
||||
#TODO: Consider expiring values after some fixed time for long-running
|
||||
#servers
|
||||
|
||||
# TODO(kristijanburnik): Provide shared Stash support for WebSockets.
|
||||
|
||||
class Stash(object):
|
||||
"""Key-value store for persisting data across HTTP/S requests.
|
||||
"""Key-value store for persisting data across HTTP/S and WS/S requests.
|
||||
|
||||
This data store is specifically designed for persisting data across
|
||||
HTTP and HTTPS requests. The synchronization model is usually done by using
|
||||
the SyncManager from the multiprocessing module.
|
||||
This data store is specifically designed for persisting data across server
|
||||
requests. The synchronization is achieved by using the BaseManager from
|
||||
the multiprocessing module so different processes can acccess the same data.
|
||||
|
||||
Stash can be used interchangeably between HTTP and HTTPS requests as both
|
||||
processes are accessing the same resource (e.g. a Manager.dict).
|
||||
The WS and WSS servers are currently not supported.
|
||||
Stash can be used interchangeably between HTTP, HTTPS, WS and WSS servers.
|
||||
A thing to note about WS/S servers is that they require additional steps in
|
||||
the handlers for accessing the same underlying shared data in the Stash.
|
||||
This can usually be achieved by using load_env_config(). When using Stash
|
||||
interchangeably between HTTP/S and WS/S request, the path part of the key
|
||||
should be expliclitly specified if accessing the same key/value subset.
|
||||
|
||||
The store has several unusual properties. Keys are of the form (path,
|
||||
uuid), where path is, by default, the path in the HTTP request and
|
||||
|
14
testing/web-platform/tests/websockets/Close-clamp.htm
Normal file
14
testing/web-platform/tests/websockets/Close-clamp.htm
Normal file
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<title>WebSocket#close(2**16+1000)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="websocket.js?pipe=sub"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var ws = CreateWebSocket(false, false, false);
|
||||
assert_throws("InvalidAccessError", function () {
|
||||
ws.close(0x10000 + 1000);
|
||||
});
|
||||
});
|
||||
</script>
|
@ -0,0 +1,45 @@
|
||||
#!/usr/bin/python
|
||||
import urlparse, json
|
||||
from mod_pywebsocket import common, msgutil, util
|
||||
from mod_pywebsocket.handshake import hybi
|
||||
from wptserve import stash
|
||||
|
||||
address, authkey = stash.load_env_config()
|
||||
stash = stash.Stash("/stash_responder", address=address, authkey=authkey)
|
||||
|
||||
def web_socket_do_extra_handshake(request):
|
||||
return
|
||||
|
||||
def web_socket_transfer_data(request):
|
||||
while True:
|
||||
line = request.ws_stream.receive_message()
|
||||
if line == "echo":
|
||||
query = request.unparsed_uri.split('?')[1]
|
||||
GET = dict(urlparse.parse_qsl(query))
|
||||
|
||||
# TODO(kristijanburnik): This code should be reused from
|
||||
# /mixed-content/generic/expect.py or implemented more generally
|
||||
# for other tests.
|
||||
path = GET.get("path", request.unparsed_uri.split('?')[0])
|
||||
key = GET["key"]
|
||||
action = GET["action"]
|
||||
|
||||
if action == "put":
|
||||
value = GET["value"]
|
||||
stash.take(key=key, path=path)
|
||||
stash.put(key=key, value=value, path=path)
|
||||
response_data = json.dumps({"status": "success", "result": key})
|
||||
elif action == "purge":
|
||||
value = stash.take(key=key, path=path)
|
||||
response_data = json.dumps({"status": "success", "result": value})
|
||||
elif action == "take":
|
||||
value = stash.take(key=key, path=path)
|
||||
if value is None:
|
||||
status = "allowed"
|
||||
else:
|
||||
status = "blocked"
|
||||
response_data = json.dumps({"status": status, "result": value})
|
||||
|
||||
msgutil.send_message(request, response_data)
|
||||
|
||||
return
|
Loading…
Reference in New Issue
Block a user