From 71008d816d071d840c80a63c2cd7fc26afaaff5b Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 9 Apr 2015 13:39:50 +0200 Subject: [PATCH] Update web-platform-tests. --- .../2d.shadow.canvas.transparent.2.html.ini | 1 + .../2d.shadow.image.transparent.2.html.ini | 1 + tests/wpt/metadata/MANIFEST.json | 111 ++++++++++++------ .../getresponseheader-chunked-trailer.htm.ini | 5 - .../XMLHttpRequest/timeout-cors-async.htm.ini | 1 - .../CharacterData-substringData.html.ini | 3 + .../dom/nodes/Node-properties.html.ini | 1 + .../frameElement.sub.html.ini | 1 - .../disabledElement.html.ini | 1 + .../srcset/parse-a-srcset-attribute.html.ini | 3 + .../location/members.html.ini | 1 + .../IndexedDB/key_valid.html | 1 + tests/wpt/web-platform-tests/README.md | 12 +- .../XMLHttpRequest/resources/chunked.py | 2 +- .../media-src/media-src-7_1.html | 1 + .../media-src/media-src-7_1_2.html | 1 + .../media-src/media-src-7_2.html | 1 + .../media-src/media-src-7_2_2.html | 1 + .../media-src/media-src-7_3.html | 1 + .../media-src/media-src-7_3_2.html | 1 + .../object-src/object-src-2_1.html | 25 ++-- .../object-src/object-src-2_2.html | 25 ++-- .../support/checkReport.sub.js | 3 +- .../content-security-policy/support/report.py | 33 +++--- .../dom/nodes/CharacterData-appendData.html | 57 +++++++-- .../nodes/CharacterData-substringData.html | 108 +++++++++++++++++ .../dom/nodes/attributes.html | 9 ++ .../fetch/nosniff/image.html | 29 +++++ .../fetch/nosniff/importscripts.html | 14 +++ .../fetch/nosniff/importscripts.js | 17 +++ .../fetch/nosniff/parsing-nosniff.html | 28 +++++ .../fetch/nosniff/resources/css.py | 15 +++ .../fetch/nosniff/resources/image.py | 16 +++ .../fetch/nosniff/resources/js.py | 17 +++ .../nosniff/resources/nosniff-first.asis | 7 ++ .../fetch/nosniff/resources/nosniff-last.asis | 7 ++ .../fetch/nosniff/resources/nosniff-no-x.asis | 6 + .../resources/nosniff-quoted-single.asis | 6 + .../nosniff/resources/nosniff-quoted.asis | 6 + .../nosniff/resources/nosniff-uppercase.asis | 6 + .../fetch/nosniff/resources/worker.py | 16 +++ .../fetch/nosniff/script.html | 32 +++++ .../fetch/nosniff/stylesheet.html | 34 ++++++ .../fetch/nosniff/worker.html | 28 +++++ .../srcset/parse-a-srcset-attribute.html | 5 +- tests/wpt/web-platform-tests/manifest | 4 +- .../web-platform-tests/resources/docs/api.md | 36 ++++++ .../resources/testharness.js | 68 +++++++++++ tests/wpt/web-platform-tests/tools/.gitignore | 6 + .../tools/manifest/update.py | 26 +++- .../web-platform-tests/tools/manifest/vcs.py | 8 +- .../websockets/Close-undefined.htm | 4 +- .../websockets/Secure-Close-undefined.htm | 4 +- .../websockets/cookies/001.html | 6 +- .../websockets/cookies/002.html | 6 +- .../websockets/cookies/003.html | 27 ++--- .../websockets/cookies/004.html | 13 +- .../websockets/cookies/005.html | 12 +- .../websockets/cookies/006.html | 8 +- .../websockets/cookies/007.html | 8 +- .../interfaces/WebSocket/events/013.html | 6 +- .../websockets/websocket.js | 2 +- 62 files changed, 793 insertions(+), 150 deletions(-) delete mode 100644 tests/wpt/metadata/XMLHttpRequest/getresponseheader-chunked-trailer.htm.ini create mode 100644 tests/wpt/metadata/dom/nodes/CharacterData-substringData.html.ini create mode 100644 tests/wpt/web-platform-tests/dom/nodes/CharacterData-substringData.html create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/image.html create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/importscripts.html create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/importscripts.js create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/parsing-nosniff.html create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/resources/css.py create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/resources/image.py create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/resources/js.py create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-first.asis create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-last.asis create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-no-x.asis create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-quoted-single.asis create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-quoted.asis create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-uppercase.asis create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/resources/worker.py create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/script.html create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/stylesheet.html create mode 100644 tests/wpt/web-platform-tests/fetch/nosniff/worker.html create mode 100644 tests/wpt/web-platform-tests/tools/.gitignore diff --git a/tests/wpt/metadata/2dcontext/shadows/2d.shadow.canvas.transparent.2.html.ini b/tests/wpt/metadata/2dcontext/shadows/2d.shadow.canvas.transparent.2.html.ini index f0485ad1623..b3623a00589 100644 --- a/tests/wpt/metadata/2dcontext/shadows/2d.shadow.canvas.transparent.2.html.ini +++ b/tests/wpt/metadata/2dcontext/shadows/2d.shadow.canvas.transparent.2.html.ini @@ -2,3 +2,4 @@ type: testharness [Shadows are not drawn for transparent parts of canvases] expected: FAIL + diff --git a/tests/wpt/metadata/2dcontext/shadows/2d.shadow.image.transparent.2.html.ini b/tests/wpt/metadata/2dcontext/shadows/2d.shadow.image.transparent.2.html.ini index c4f70567f88..4b5b797c037 100644 --- a/tests/wpt/metadata/2dcontext/shadows/2d.shadow.image.transparent.2.html.ini +++ b/tests/wpt/metadata/2dcontext/shadows/2d.shadow.image.transparent.2.html.ini @@ -2,3 +2,4 @@ type: testharness [Shadows are not drawn for transparent parts of images] expected: FAIL + diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 77a963fdaee..0c4dc0c1164 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -8955,10 +8955,6 @@ "path": "IndexedDB/key_invalid.htm", "url": "/IndexedDB/key_invalid.htm" }, - { - "path": "IndexedDB/key_valid.html", - "url": "/IndexedDB/key_valid.html" - }, { "path": "IndexedDB/keygenerator-constrainterror.htm", "url": "/IndexedDB/keygenerator-constrainterror.htm" @@ -9819,38 +9815,6 @@ "path": "content-security-policy/img-src/img-src-4_1.html", "url": "/content-security-policy/img-src/img-src-4_1.html" }, - { - "path": "content-security-policy/media-src/media-src-7_1.html", - "url": "/content-security-policy/media-src/media-src-7_1.html" - }, - { - "path": "content-security-policy/media-src/media-src-7_1_2.html", - "url": "/content-security-policy/media-src/media-src-7_1_2.html" - }, - { - "path": "content-security-policy/media-src/media-src-7_2.html", - "url": "/content-security-policy/media-src/media-src-7_2.html" - }, - { - "path": "content-security-policy/media-src/media-src-7_2_2.html", - "url": "/content-security-policy/media-src/media-src-7_2_2.html" - }, - { - "path": "content-security-policy/media-src/media-src-7_3.html", - "url": "/content-security-policy/media-src/media-src-7_3.html" - }, - { - "path": "content-security-policy/media-src/media-src-7_3_2.html", - "url": "/content-security-policy/media-src/media-src-7_3_2.html" - }, - { - "path": "content-security-policy/object-src/object-src-2_1.html", - "url": "/content-security-policy/object-src/object-src-2_1.html" - }, - { - "path": "content-security-policy/object-src/object-src-2_2.html", - "url": "/content-security-policy/object-src/object-src-2_2.html" - }, { "path": "content-security-policy/script-src/script-src-1_1.html", "url": "/content-security-policy/script-src/script-src-1_1.html" @@ -10311,6 +10275,10 @@ "path": "dom/nodes/CharacterData-replaceData.html", "url": "/dom/nodes/CharacterData-replaceData.html" }, + { + "path": "dom/nodes/CharacterData-substringData.html", + "url": "/dom/nodes/CharacterData-substringData.html" + }, { "path": "dom/nodes/Comment-constructor.html", "url": "/dom/nodes/Comment-constructor.html" @@ -11271,6 +11239,30 @@ "path": "ext-xhtml-pubid/the-xhtml-syntax/parsing-xhtml-documents/xhtml-pubid-1.html", "url": "/ext-xhtml-pubid/the-xhtml-syntax/parsing-xhtml-documents/xhtml-pubid-1.html" }, + { + "path": "fetch/nosniff/image.html", + "url": "/fetch/nosniff/image.html" + }, + { + "path": "fetch/nosniff/importscripts.html", + "url": "/fetch/nosniff/importscripts.html" + }, + { + "path": "fetch/nosniff/parsing-nosniff.html", + "url": "/fetch/nosniff/parsing-nosniff.html" + }, + { + "path": "fetch/nosniff/script.html", + "url": "/fetch/nosniff/script.html" + }, + { + "path": "fetch/nosniff/stylesheet.html", + "url": "/fetch/nosniff/stylesheet.html" + }, + { + "path": "fetch/nosniff/worker.html", + "url": "/fetch/nosniff/worker.html" + }, { "path": "gamepad/idlharness.html", "url": "/gamepad/idlharness.html" @@ -18798,6 +18790,11 @@ "timeout": "long", "url": "/IndexedDB/idbobjectstore_createIndex8-valid_keys.htm" }, + { + "path": "IndexedDB/key_valid.html", + "timeout": "long", + "url": "/IndexedDB/key_valid.html" + }, { "path": "IndexedDB/keypath_maxsize.htm", "timeout": "long", @@ -18823,6 +18820,46 @@ "timeout": "long", "url": "/ambient-light/AmbientLight_tests.html" }, + { + "path": "content-security-policy/media-src/media-src-7_1.html", + "timeout": "long", + "url": "/content-security-policy/media-src/media-src-7_1.html" + }, + { + "path": "content-security-policy/media-src/media-src-7_1_2.html", + "timeout": "long", + "url": "/content-security-policy/media-src/media-src-7_1_2.html" + }, + { + "path": "content-security-policy/media-src/media-src-7_2.html", + "timeout": "long", + "url": "/content-security-policy/media-src/media-src-7_2.html" + }, + { + "path": "content-security-policy/media-src/media-src-7_2_2.html", + "timeout": "long", + "url": "/content-security-policy/media-src/media-src-7_2_2.html" + }, + { + "path": "content-security-policy/media-src/media-src-7_3.html", + "timeout": "long", + "url": "/content-security-policy/media-src/media-src-7_3.html" + }, + { + "path": "content-security-policy/media-src/media-src-7_3_2.html", + "timeout": "long", + "url": "/content-security-policy/media-src/media-src-7_3_2.html" + }, + { + "path": "content-security-policy/object-src/object-src-2_1.html", + "timeout": "long", + "url": "/content-security-policy/object-src/object-src-2_1.html" + }, + { + "path": "content-security-policy/object-src/object-src-2_2.html", + "timeout": "long", + "url": "/content-security-policy/object-src/object-src-2_2.html" + }, { "path": "cors/status-async.htm", "timeout": "long", @@ -25034,7 +25071,7 @@ } ] }, - "rev": "0d318188757a9c996e20b82db201fd04de5aa255", + "rev": "2a9fd810bb18610b422dbc3998ab74aa1bffae95", "url_base": "/", "version": 2 } \ No newline at end of file diff --git a/tests/wpt/metadata/XMLHttpRequest/getresponseheader-chunked-trailer.htm.ini b/tests/wpt/metadata/XMLHttpRequest/getresponseheader-chunked-trailer.htm.ini deleted file mode 100644 index 0ee1ddfee54..00000000000 --- a/tests/wpt/metadata/XMLHttpRequest/getresponseheader-chunked-trailer.htm.ini +++ /dev/null @@ -1,5 +0,0 @@ -[getresponseheader-chunked-trailer.htm] - type: testharness - [XMLHttpRequest: getResponseHeader() and HTTP trailer] - expected: FAIL - diff --git a/tests/wpt/metadata/XMLHttpRequest/timeout-cors-async.htm.ini b/tests/wpt/metadata/XMLHttpRequest/timeout-cors-async.htm.ini index 4d37d487bfb..39ed4516c79 100644 --- a/tests/wpt/metadata/XMLHttpRequest/timeout-cors-async.htm.ini +++ b/tests/wpt/metadata/XMLHttpRequest/timeout-cors-async.htm.ini @@ -1,6 +1,5 @@ [timeout-cors-async.htm] type: testharness - expected: OK [XMLHttpRequest: timeout event and cross-origin request] expected: FAIL diff --git a/tests/wpt/metadata/dom/nodes/CharacterData-substringData.html.ini b/tests/wpt/metadata/dom/nodes/CharacterData-substringData.html.ini new file mode 100644 index 00000000000..236aa95dfa3 --- /dev/null +++ b/tests/wpt/metadata/dom/nodes/CharacterData-substringData.html.ini @@ -0,0 +1,3 @@ +[CharacterData-substringData.html] + type: testharness + expected: CRASH diff --git a/tests/wpt/metadata/dom/nodes/Node-properties.html.ini b/tests/wpt/metadata/dom/nodes/Node-properties.html.ini index 41bd3f2f43f..4f0913ec1a4 100644 --- a/tests/wpt/metadata/dom/nodes/Node-properties.html.ini +++ b/tests/wpt/metadata/dom/nodes/Node-properties.html.ini @@ -89,3 +89,4 @@ [paras[4\].nextElementSibling] expected: FAIL + diff --git a/tests/wpt/metadata/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html.ini b/tests/wpt/metadata/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html.ini index 974579d1009..922f8a7b076 100644 --- a/tests/wpt/metadata/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html.ini +++ b/tests/wpt/metadata/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html.ini @@ -1,6 +1,5 @@ [frameElement.sub.html] type: testharness - expected: OK [The window\'s frameElement attribute must return its container element if it is a nested browsing context] expected: FAIL diff --git a/tests/wpt/metadata/html/semantics/disabled-elements/disabledElement.html.ini b/tests/wpt/metadata/html/semantics/disabled-elements/disabledElement.html.ini index f381b21bccb..52c221a1e49 100644 --- a/tests/wpt/metadata/html/semantics/disabled-elements/disabledElement.html.ini +++ b/tests/wpt/metadata/html/semantics/disabled-elements/disabledElement.html.ini @@ -20,3 +20,4 @@ [A disabled should not be focusable] expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html.ini index af450694b73..0f0eaf8d6f4 100644 --- a/tests/wpt/metadata/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html.ini +++ b/tests/wpt/metadata/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html.ini @@ -705,3 +705,6 @@ ["data:,a 1w \\x011h" (leading U+0001)] expected: FAIL + ["data:,a 1w"] + expected: FAIL + diff --git a/tests/wpt/metadata/workers/interfaces/WorkerGlobalScope/location/members.html.ini b/tests/wpt/metadata/workers/interfaces/WorkerGlobalScope/location/members.html.ini index 71d4aa447ea..d708f6da6f9 100644 --- a/tests/wpt/metadata/workers/interfaces/WorkerGlobalScope/location/members.html.ini +++ b/tests/wpt/metadata/workers/interfaces/WorkerGlobalScope/location/members.html.ini @@ -2,3 +2,4 @@ type: testharness [members of WorkerLocation] expected: FAIL + diff --git a/tests/wpt/web-platform-tests/IndexedDB/key_valid.html b/tests/wpt/web-platform-tests/IndexedDB/key_valid.html index e695d14c4cd..f45d4a903e3 100644 --- a/tests/wpt/web-platform-tests/IndexedDB/key_valid.html +++ b/tests/wpt/web-platform-tests/IndexedDB/key_valid.html @@ -1,6 +1,7 @@ + Valid key diff --git a/tests/wpt/web-platform-tests/README.md b/tests/wpt/web-platform-tests/README.md index 0c1c7165ca5..dbf82da9785 100644 --- a/tests/wpt/web-platform-tests/README.md +++ b/tests/wpt/web-platform-tests/README.md @@ -1,8 +1,16 @@ The Web Platform Tests Project [![IRC chat](https://goo.gl/6nCIks)](http://irc.w3.org/?channels=testing) ============================== -These are test suites for 60+ Web-platform specifications, along -with test-infrastructure code for running the tests. +The Web Platform Tests Project is a W3C-coordinated attempt to build a +cross-browser testsuite for the Web-platform stack. Writing tests in a +way that allows them to be run in all browsers gives browser projects +confidence that they are shipping software that is compatible with other +implementations, and that later implementations will be compatible with +their implementations. This in turn gives Web authors/developers +confidence that they can actually rely on the Web platform to deliver on +the promise of working across browsers and devices without needing extra +layers of abstraction to paper over the gaps left by specification +editors and implementors. Running the Tests ================= diff --git a/tests/wpt/web-platform-tests/XMLHttpRequest/resources/chunked.py b/tests/wpt/web-platform-tests/XMLHttpRequest/resources/chunked.py index 7adabbfd7f4..7e8433bd869 100644 --- a/tests/wpt/web-platform-tests/XMLHttpRequest/resources/chunked.py +++ b/tests/wpt/web-platform-tests/XMLHttpRequest/resources/chunked.py @@ -10,7 +10,7 @@ def main(request, response): response.write_status_headers() for value in chunks: - response.writer.write("%d\r\n" % len(value)) + response.writer.write("%x\r\n" % len(value)) response.writer.write(value) response.writer.write("\r\n") response.writer.write("0\r\n") diff --git a/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_1.html b/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_1.html index d912b86bb8b..bf6d32cf83e 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_1.html +++ b/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_1.html @@ -2,6 +2,7 @@ Video element src attribute must match src list - positive test + diff --git a/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_1_2.html b/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_1_2.html index c1b9f72f48d..61d4b142579 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_1_2.html +++ b/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_1_2.html @@ -2,6 +2,7 @@ Video element src attribute must match src list - negative test + diff --git a/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_2.html b/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_2.html index 7509d7b051a..771e389c8f2 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_2.html +++ b/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_2.html @@ -2,6 +2,7 @@ Audio element src attribute must match src list - positive test + diff --git a/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_2_2.html b/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_2_2.html index 573b5389e2a..9b613429620 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_2_2.html +++ b/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_2_2.html @@ -2,6 +2,7 @@ Audio element src attribute must match src list - negative test + diff --git a/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_3.html b/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_3.html index 32187708239..c645d9bec83 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_3.html +++ b/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_3.html @@ -2,6 +2,7 @@ Video track src attribute must match src list - positive test + diff --git a/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_3_2.html b/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_3_2.html index 7ead63f88e8..f4488bb4475 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_3_2.html +++ b/tests/wpt/web-platform-tests/content-security-policy/media-src/media-src-7_3_2.html @@ -2,6 +2,7 @@ Video track src attribute must match src list - negative test + diff --git a/tests/wpt/web-platform-tests/content-security-policy/object-src/object-src-2_1.html b/tests/wpt/web-platform-tests/content-security-policy/object-src/object-src-2_1.html index aaf67bf740a..a6cc8d49df0 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/object-src/object-src-2_1.html +++ b/tests/wpt/web-platform-tests/content-security-policy/object-src/object-src-2_1.html @@ -2,6 +2,7 @@ Objects loaded using data attribute of <object> tag are blocked unless their host is listed as an allowed source in the object-src directive + @@ -34,19 +35,19 @@ function object_loaded() { var elem = document.getElementById("flashObject"); - var is_loaded = false; - try { - - var pct_loaded = elem.PercentLoaded(); - is_loaded = true; - } catch (e) {} + var is_loaded = false; + try { + + var pct_loaded = elem.PercentLoaded(); + is_loaded = true; + } catch (e) {} - if (hasMimeType) { - test1.step(function() {assert_false(is_loaded, "External object loaded.")}); - } else { - test1.step(function() {assert_true(hasMimeType, "No Flash Player, cannot run test.")}); - } - test1.done(); + if (hasMimeType) { + test1.step(function() {assert_false(is_loaded, "External object loaded.")}); + } else { + test1.step(function() {assert_true(hasMimeType, "No Flash Player, cannot run test.")}); + } + test1.done(); } diff --git a/tests/wpt/web-platform-tests/content-security-policy/object-src/object-src-2_2.html b/tests/wpt/web-platform-tests/content-security-policy/object-src/object-src-2_2.html index 63b85604f5e..5ad75f99b80 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/object-src/object-src-2_2.html +++ b/tests/wpt/web-platform-tests/content-security-policy/object-src/object-src-2_2.html @@ -2,6 +2,7 @@ Objects loaded using src attribute of <embed> tag are blocked unless their host is listed as an allowed source in the object-src directive + @@ -34,19 +35,19 @@ function object_loaded() { var elem = document.getElementById("flashObject"); - var is_loaded = false; - try { - - var pct_loaded = elem.PercentLoaded(); - is_loaded = true; - } catch (e) {} + var is_loaded = false; + try { + + var pct_loaded = elem.PercentLoaded(); + is_loaded = true; + } catch (e) {} - if (hasMimeType) { - test1.step(function() {assert_false(is_loaded, "External object loaded.")}); - } else { - test1.step(function() {assert_true(hasMimeType, "No Flash Player, cannot run test.")}); - } - test1.done(); + if (hasMimeType) { + test1.step(function() {assert_false(is_loaded, "External object loaded.")}); + } else { + test1.step(function() {assert_true(hasMimeType, "No Flash Player, cannot run test.")}); + } + test1.done(); } diff --git a/tests/wpt/web-platform-tests/content-security-policy/support/checkReport.sub.js b/tests/wpt/web-platform-tests/content-security-policy/support/checkReport.sub.js index dfaec7ac54d..023ce471910 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/support/checkReport.sub.js +++ b/tests/wpt/web-platform-tests/content-security-policy/support/checkReport.sub.js @@ -31,7 +31,8 @@ } } - var reportLocation = location.protocol + "//" + location.host + "/content-security-policy/support/report.py?op=take&timeout=5&reportID=" + reportID; + var timeout = document.querySelector("meta[name=timeout][content=long]") ? 50 : 5; + var reportLocation = location.protocol + "//" + location.host + "/content-security-policy/support/report.py?op=take&timeout=" + timeout + "&reportID=" + reportID; var reportTest = async_test("Violation report status OK."); reportTest.step(function () { diff --git a/tests/wpt/web-platform-tests/content-security-policy/support/report.py b/tests/wpt/web-platform-tests/content-security-policy/support/report.py index f8c0c463c03..455d46c6d1d 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/support/report.py +++ b/tests/wpt/web-platform-tests/content-security-policy/support/report.py @@ -2,25 +2,22 @@ import time import json def main(request, response): - op = request.GET.first("op"); key = request.GET.first("reportID") if op == "take": - timeout = float(request.GET.first("timeout")) - value = request.server.stash.take(key=key) - if value is not None: - return [("Content-Type", "application/json")], value - else: - time.sleep(timeout) - value = request.server.stash.take(key=key) - if value is not None: - return [("Content-Type", "application/json")], value - else: - return [("Content-Type", "application/json")], json.dumps({'error': 'No such report.' , 'guid' : key}) - else: - report = request.body - report.rstrip() - request.server.stash.take(key=key) - request.server.stash.put(key=key, value=report) - return [("Content-Type", "text/plain")], "Recorded report " + report \ No newline at end of file + timeout = float(request.GET.first("timeout")) + t0 = time.time() + while time.time() - t0 < timeout: + time.sleep(0.5) + value = request.server.stash.take(key=key) + if value is not None: + return [("Content-Type", "application/json")], value + + return [("Content-Type", "application/json")], json.dumps({'error': 'No such report.' , 'guid' : key}) + + report = request.body + report.rstrip() + request.server.stash.take(key=key) + request.server.stash.put(key=key, value=report) + return [("Content-Type", "text/plain")], "Recorded report " + report diff --git a/tests/wpt/web-platform-tests/dom/nodes/CharacterData-appendData.html b/tests/wpt/web-platform-tests/dom/nodes/CharacterData-appendData.html index 5e84e970551..464a119a03d 100644 --- a/tests/wpt/web-platform-tests/dom/nodes/CharacterData-appendData.html +++ b/tests/wpt/web-platform-tests/dom/nodes/CharacterData-appendData.html @@ -7,15 +7,56 @@
diff --git a/tests/wpt/web-platform-tests/dom/nodes/CharacterData-substringData.html b/tests/wpt/web-platform-tests/dom/nodes/CharacterData-substringData.html new file mode 100644 index 00000000000..1d7288ab3f1 --- /dev/null +++ b/tests/wpt/web-platform-tests/dom/nodes/CharacterData-substringData.html @@ -0,0 +1,108 @@ + + +CharacterData.substringData + + + + +
+ diff --git a/tests/wpt/web-platform-tests/dom/nodes/attributes.html b/tests/wpt/web-platform-tests/dom/nodes/attributes.html index f4a993a252f..34be42a0a0d 100644 --- a/tests/wpt/web-platform-tests/dom/nodes/attributes.html +++ b/tests/wpt/web-platform-tests/dom/nodes/attributes.html @@ -385,4 +385,13 @@ test(function() { el.removeAttributeNS(null, "pre:fix") assert_equals(el.attributes[0], unprefixed) }, "Attribute with prefix in local name") + +test(function() { + var el = document.createElement("div") + el.setAttribute("foo", "bar") + var attr = el.attributes[0] + assert_equals(attr.ownerElement, el) + el.removeAttribute("foo") + assert_equals(attr.ownerElement, null) +}, "Attribute loses its owner when removed") diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/image.html b/tests/wpt/web-platform-tests/fetch/nosniff/image.html new file mode 100644 index 00000000000..e5869d94e60 --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/image.html @@ -0,0 +1,29 @@ + + +
+ diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/importscripts.html b/tests/wpt/web-platform-tests/fetch/nosniff/importscripts.html new file mode 100644 index 00000000000..920b6bdd409 --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/importscripts.html @@ -0,0 +1,14 @@ + + +
+ diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/importscripts.js b/tests/wpt/web-platform-tests/fetch/nosniff/importscripts.js new file mode 100644 index 00000000000..aeb6154870b --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/importscripts.js @@ -0,0 +1,17 @@ +// Testing importScripts() +function log(w) { this.postMessage(w) } +function f() { log("FAIL") } +function p() { log("PASS") } + +["", "?type=", "?type=x", "?type=x/x"].forEach(function(urlpart) { + try { + importScripts("resources/js.py" + urlpart) + } catch(e) { + (e.name == "NetworkError") ? p() : log("FAIL (no NetworkError exception): " + urlpart) + } + +}) +importScripts("resources/js.py?type=text/javascript&outcome=p") +importScripts("resources/js.py?type=text/ecmascript&outcome=p") +importScripts("resources/js.py?type=text/ecmascript;blah&outcome=p") +log("END") diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/parsing-nosniff.html b/tests/wpt/web-platform-tests/fetch/nosniff/parsing-nosniff.html new file mode 100644 index 00000000000..10c5cadfcaa --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/parsing-nosniff.html @@ -0,0 +1,28 @@ + + +
+ diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/resources/css.py b/tests/wpt/web-platform-tests/fetch/nosniff/resources/css.py new file mode 100644 index 00000000000..7c4c63b596a --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/resources/css.py @@ -0,0 +1,15 @@ +def main(request, response): + outcome = request.GET.first("outcome", "f") + type = request.GET.first("type", None) + + content = "/* nothing to see here */" + + response.add_required_headers = False + response.writer.write_status(200) + response.writer.write_header("x-content-type-options", "nosniff") + response.writer.write_header("content-length", len(content)) + if(type != None): + response.writer.write_header("content-type", type) + response.writer.end_headers() + + response.writer.write(content) diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/resources/image.py b/tests/wpt/web-platform-tests/fetch/nosniff/resources/image.py new file mode 100644 index 00000000000..32a07c197df --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/resources/image.py @@ -0,0 +1,16 @@ +import os.path + +def main(request, response): + type = request.GET.first("type", None) + + body = open(os.path.join(os.path.dirname(__file__), "../../../images/blue96x96.png")).read() + + response.add_required_headers = False + response.writer.write_status(200) + response.writer.write_header("x-content-type-options", "nosniff") + response.writer.write_header("content-length", len(body)) + if(type != None): + response.writer.write_header("content-type", type) + response.writer.end_headers() + + response.writer.write(body) diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/resources/js.py b/tests/wpt/web-platform-tests/fetch/nosniff/resources/js.py new file mode 100644 index 00000000000..0c06d9cd2e4 --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/resources/js.py @@ -0,0 +1,17 @@ +def main(request, response): + outcome = request.GET.first("outcome", "f") + type = request.GET.first("type", "Content-Type missing") + + content = "// nothing to see here" + content += "\n" + content += "log('FAIL: " + type + "')" if (outcome == "f") else "p()" + + response.add_required_headers = False + response.writer.write_status(200) + response.writer.write_header("x-content-type-options", "nosniff") + response.writer.write_header("content-length", len(content)) + if(type != "Content-Type missing"): + response.writer.write_header("content-type", type) + response.writer.end_headers() + + response.writer.write(content) diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-first.asis b/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-first.asis new file mode 100644 index 00000000000..bccc53eef8a --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-first.asis @@ -0,0 +1,7 @@ +HTTP/1.1 200 YOU HAVE NO POWER HERE +Content-Length: 22 +Content-Type: x/x +X-Content-Type-options: nosniff +X-Content-Type-Options: no + +// nothing to see here diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-last.asis b/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-last.asis new file mode 100644 index 00000000000..e3de0733e4f --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-last.asis @@ -0,0 +1,7 @@ +HTTP/1.1 200 YOU HAVE NO POWER HERE +Content-Length: 22 +Content-Type: x/x +X-Content-Type-Options: no +X-Content-Type-options: nosniff + +// nothing to see here diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-no-x.asis b/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-no-x.asis new file mode 100644 index 00000000000..329d0f72143 --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-no-x.asis @@ -0,0 +1,6 @@ +HTTP/1.1 200 YOU HAVE NO POWER HERE +Content-Length: 22 +Content-Type: x/x +Content-Type-Options: nosniff + +// nothing to see here diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-quoted-single.asis b/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-quoted-single.asis new file mode 100644 index 00000000000..501f18999d0 --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-quoted-single.asis @@ -0,0 +1,6 @@ +HTTP/1.1 200 YOU HAVE NO POWER HERE +Content-Length: 22 +Content-Type: x/x +X-Content-Type-Options: 'NosniFF' + +// nothing to see here diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-quoted.asis b/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-quoted.asis new file mode 100644 index 00000000000..c6de62b689e --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-quoted.asis @@ -0,0 +1,6 @@ +HTTP/1.1 200 YOU HAVE NO POWER HERE +Content-Length: 22 +Content-Type: x/x +X-Content-Type-Options: "nosniFF" + +// nothing to see here diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-uppercase.asis b/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-uppercase.asis new file mode 100644 index 00000000000..8097fddce10 --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/resources/nosniff-uppercase.asis @@ -0,0 +1,6 @@ +HTTP/1.1 200 YOU HAVE NO POWER HERE +Content-Length: 22 +Content-Type: x/x +X-Content-Type-Options: NOSNIFF + +// nothing to see here diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/resources/worker.py b/tests/wpt/web-platform-tests/fetch/nosniff/resources/worker.py new file mode 100644 index 00000000000..3903ba34947 --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/resources/worker.py @@ -0,0 +1,16 @@ +def main(request, response): + type = request.GET.first("type", None) + + content = "// nothing to see here" + content += "\n" + content += "this.postMessage('hi')" + + response.add_required_headers = False + response.writer.write_status(200) + response.writer.write_header("x-content-type-options", "nosniff") + response.writer.write_header("content-length", len(content)) + if(type != None): + response.writer.write_header("content-type", type) + response.writer.end_headers() + + response.writer.write(content) diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/script.html b/tests/wpt/web-platform-tests/fetch/nosniff/script.html new file mode 100644 index 00000000000..667f3c99a6c --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/script.html @@ -0,0 +1,32 @@ + + +
+ diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/stylesheet.html b/tests/wpt/web-platform-tests/fetch/nosniff/stylesheet.html new file mode 100644 index 00000000000..07de819f8af --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/stylesheet.html @@ -0,0 +1,34 @@ + + + +
+ diff --git a/tests/wpt/web-platform-tests/fetch/nosniff/worker.html b/tests/wpt/web-platform-tests/fetch/nosniff/worker.html new file mode 100644 index 00000000000..466b2075e97 --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/nosniff/worker.html @@ -0,0 +1,28 @@ + + +
+ diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html index 2ff9886e036..ce1e4cebe5f 100644 --- a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html +++ b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html @@ -58,12 +58,13 @@ - - + + + diff --git a/tests/wpt/web-platform-tests/manifest b/tests/wpt/web-platform-tests/manifest index f5b0c9bade7..edebae62695 100755 --- a/tests/wpt/web-platform-tests/manifest +++ b/tests/wpt/web-platform-tests/manifest @@ -1,6 +1,8 @@ #!/usr/bin/env python +import os import sys from tools.manifest import update -update.main() +update.main(default_tests_root= + os.path.abspath(os.path.dirname(__file__))) diff --git a/tests/wpt/web-platform-tests/resources/docs/api.md b/tests/wpt/web-platform-tests/resources/docs/api.md index 4598a9b15a9..78c00a957a1 100644 --- a/tests/wpt/web-platform-tests/resources/docs/api.md +++ b/tests/wpt/web-platform-tests/resources/docs/api.md @@ -147,6 +147,42 @@ with a TypeError: return promise_rejects(t, new TypeError(), bar); }, "Another example"); +`EventWatcher` is a constructor function that allows DOM events to be handled +using Promises, which can make it a lot easier to test a very specific series +of events, including ensuring that unexpected events are not fired at any point. + +Here's an example of how to use `EventWatcher`: + + var t = async_test("Event order on animation start"); + + var animation = watchedNode.getAnimations()[0]; + var eventWatcher = new EventWatcher(watchedNode, ['animationstart', + 'animationiteration', + 'animationend']); + + eventWatcher.wait_for(t, 'animationstart').then(t.step_func(function() { + assertExpectedStateAtStartOfAnimation(); + animation.currentTime = END_TIME; // skip to end + // We expect two animationiteration events then an animationend event on + // skipping to the end of the animation. + return eventWatcher.wait_for(['animationiteration', + 'animationiteration', + 'animationend']); + })).then(t.step_func(function() { + assertExpectedStateAtEndOfAnimation(); + test.done(); + })); + +`wait_for` either takes the name of a single event and returns a Promise that +will resolve after that event is fired at the watched node, or else it takes an +array of the names of a series of events and returns a Promise that will +resolve after that specific series of events has been fired at the watched node. + +`EventWatcher` will assert if an event occurs while there is no `wait_for`() +created Promise waiting to be fulfilled, or if the event is of a different type +to the type currently expected. This ensures that only the events that are +expected occur, in the correct order, and with the correct timing. + ## Single Page Tests ## Sometimes, particularly when dealing with asynchronous behaviour, diff --git a/tests/wpt/web-platform-tests/resources/testharness.js b/tests/wpt/web-platform-tests/resources/testharness.js index ab88e541fcb..748010306c1 100644 --- a/tests/wpt/web-platform-tests/resources/testharness.js +++ b/tests/wpt/web-platform-tests/resources/testharness.js @@ -470,6 +470,74 @@ policies and contribution forms [3]. }); } + /** + * This constructor helper allows DOM events to be handled using Promises, + * which can make it a lot easier to test a very specific series of events, + * including ensuring that unexpected events are not fired at any point. + */ + function EventWatcher(test, watchedNode, eventTypes) + { + if (typeof eventTypes == 'string') { + eventTypes = [eventTypes]; + } + + var waitingFor = null; + + var eventHandler = test.step_func(function(evt) { + assert_true(!!waitingFor, + 'Not expecting event, but got ' + evt.type + ' event'); + assert_equals(evt.type, waitingFor.types[0], + 'Expected ' + waitingFor.types[0] + ' event, but got ' + + evt.type + ' event instead'); + if (waitingFor.types.length > 1) { + // Pop first event from array + waitingFor.types.shift(); + return; + } + // We need to null out waitingFor before calling the resolve function + // since the Promise's resolve handlers may call wait_for() which will + // need to set waitingFor. + var resolveFunc = waitingFor.resolve; + waitingFor = null; + resolveFunc(evt); + }); + + for (var i = 0; i < eventTypes.length; i++) { + watchedNode.addEventListener(eventTypes[i], eventHandler); + } + + /** + * Returns a Promise that will resolve after the specified event or + * series of events has occured. + */ + this.wait_for = function(types) { + if (waitingFor) { + return Promise.reject('Already waiting for an event or events'); + } + if (typeof types == 'string') { + types = [types]; + } + return new Promise(function(resolve, reject) { + waitingFor = { + types: types, + resolve: resolve, + reject: reject + }; + }); + }; + + function stop_watching() { + for (var i = 0; i < eventTypes.length; i++) { + watchedNode.removeEventListener(eventTypes[i], eventHandler); + } + }; + + test.add_cleanup(stop_watching); + + return this; + } + expose(EventWatcher, 'EventWatcher'); + function setup(func_or_properties, maybe_properties) { var func = null; diff --git a/tests/wpt/web-platform-tests/tools/.gitignore b/tests/wpt/web-platform-tests/tools/.gitignore new file mode 100644 index 00000000000..7a8ba560c9e --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/.gitignore @@ -0,0 +1,6 @@ +*# +*.py[co] +*.sw[po] +*~ +\#* + diff --git a/tests/wpt/web-platform-tests/tools/manifest/update.py b/tests/wpt/web-platform-tests/tools/manifest/update.py index 054e9ce7ab2..1c08c8850d4 100644 --- a/tests/wpt/web-platform-tests/tools/manifest/update.py +++ b/tests/wpt/web-platform-tests/tools/manifest/update.py @@ -2,6 +2,7 @@ import argparse import imp import os +import sys import manifest import vcs @@ -82,11 +83,32 @@ def create_parser(): return parser -def main(): +def find_top_repo(): + path = here + rv = None + while path != "/": + if vcs.is_git_repo(path): + rv = path + path = os.path.abspath(os.path.join(path, os.pardir)) + + return rv + +def main(default_tests_root=None): opts = create_parser().parse_args() if opts.tests_root is None: - opts.tests_root = vcs.get_repo_root() + tests_root = None + if default_tests_root is not None: + tests_root = default_tests_root + else: + tests_root = find_top_repo() + + if tests_root is None: + print >> sys.stderr, """No git repo found; could not determine test root. +Run again with --test-root""" + sys.exit(1) + + opts.tests_root = tests_root if opts.path is None: opts.path = os.path.join(opts.tests_root, "MANIFEST.json") diff --git a/tests/wpt/web-platform-tests/tools/manifest/vcs.py b/tests/wpt/web-platform-tests/tools/manifest/vcs.py index 7bf37949208..93bd445e1e8 100644 --- a/tests/wpt/web-platform-tests/tools/manifest/vcs.py +++ b/tests/wpt/web-platform-tests/tools/manifest/vcs.py @@ -13,9 +13,13 @@ def is_git_repo(tests_root): _repo_root = None -def get_repo_root(): +def get_repo_root(initial_dir=None): global _repo_root + + if initial_dir is None: + initial_dir = os.path.dirname(__file__) + if _repo_root is None: - git = get_git_func(os.path.dirname(__file__)) + git = get_git_func(initial_dir) _repo_root = git("rev-parse", "--show-toplevel").rstrip() return _repo_root diff --git a/tests/wpt/web-platform-tests/websockets/Close-undefined.htm b/tests/wpt/web-platform-tests/websockets/Close-undefined.htm index 4f67c067e74..3de1656561c 100644 --- a/tests/wpt/web-platform-tests/websockets/Close-undefined.htm +++ b/tests/wpt/web-platform-tests/websockets/Close-undefined.htm @@ -10,13 +10,13 @@
diff --git a/tests/wpt/web-platform-tests/websockets/Secure-Close-undefined.htm b/tests/wpt/web-platform-tests/websockets/Secure-Close-undefined.htm index ef4a874ea75..f6c77ba77ad 100644 --- a/tests/wpt/web-platform-tests/websockets/Secure-Close-undefined.htm +++ b/tests/wpt/web-platform-tests/websockets/Secure-Close-undefined.htm @@ -10,13 +10,13 @@
diff --git a/tests/wpt/web-platform-tests/websockets/cookies/001.html b/tests/wpt/web-platform-tests/websockets/cookies/001.html index b0701d0cd91..ed318456522 100644 --- a/tests/wpt/web-platform-tests/websockets/cookies/001.html +++ b/tests/wpt/web-platform-tests/websockets/cookies/001.html @@ -10,6 +10,10 @@ async_test(function(t) { if (window.WebSocket) { document.cookie = 'ws_test_'+cookie_id+'=test; Path=/'; } + t.add_cleanup(function() { + // remove cookie + document.cookie = 'ws_test_'+cookie_id+'=; Path=/; Expires=Sun, 06 Nov 1994 08:49:37 GMT'; + }); var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo-cookie'); ws.onmessage = t.step_func(function(e) { assert_regexp_match(e.data, new RegExp('ws_test_'+cookie_id+'=test')); @@ -18,6 +22,4 @@ async_test(function(t) { }); ws.onerror = ws.onclose = t.step_func(function(e) {assert_unreached(e.type)}); }); -// remove cookie -document.cookie = 'ws_test_'+cookie_id+'=; Path=/; Expires=Sun, 06 Nov 1994 08:49:37 GMT'; diff --git a/tests/wpt/web-platform-tests/websockets/cookies/002.html b/tests/wpt/web-platform-tests/websockets/cookies/002.html index 1e6a1dbeab2..fd174f2aefb 100644 --- a/tests/wpt/web-platform-tests/websockets/cookies/002.html +++ b/tests/wpt/web-platform-tests/websockets/cookies/002.html @@ -7,11 +7,13 @@ diff --git a/tests/wpt/web-platform-tests/websockets/cookies/004.html b/tests/wpt/web-platform-tests/websockets/cookies/004.html index 894ef2eff89..db6b3c1c214 100644 --- a/tests/wpt/web-platform-tests/websockets/cookies/004.html +++ b/tests/wpt/web-platform-tests/websockets/cookies/004.html @@ -10,6 +10,11 @@ var cookie_id = ((new Date())-0) + '.' + Math.random(); var t = async_test(function(t) { var iframe = document.createElement('iframe'); + t.add_cleanup(function() { + // remove cookie + iframe.src = 'support/set-cookie.py?'+encodeURIComponent('ws_test_'+cookie_id+'=; Path=/; HttpOnly; Expires=Sun, 06 Nov 1994 08:49:37 GMT'); + iframe.onload = done; + }); var url = SCHEME_DOMAIN_PORT+'/set-cookie_http?'+cookie_id; var ws = new WebSocket(url); ws.onopen = t.step_func(function(e) { @@ -17,13 +22,7 @@ var t = async_test(function(t) { assert_false(new RegExp('ws_test_'+cookie_id+'=test').test(document.cookie)); t.done(); }); - ws.onclose = t.step_func(function(e) {assert_unreached()}); - - - add_result_callback(function() { - iframe.src = 'support/set-cookie.py?'+encodeURIComponent('ws_test_'+cookie_id+'=; Path=/; HttpOnly; Expires=Sun, 06 Nov 1994 08:49:37 GMT'); - iframe.onload = done; - }); + ws.onerror = ws.onclose = t.step_func(function(e) {assert_unreached(e.type)}); document.body.appendChild(iframe); }, null, {timeout:9900}) diff --git a/tests/wpt/web-platform-tests/websockets/cookies/005.html b/tests/wpt/web-platform-tests/websockets/cookies/005.html index e7aefd5978e..7b3d80f129c 100644 --- a/tests/wpt/web-platform-tests/websockets/cookies/005.html +++ b/tests/wpt/web-platform-tests/websockets/cookies/005.html @@ -11,6 +11,11 @@ var cookie_id = ((new Date())-0) + '.' + Math.random(); var t = async_test(function(t) { var iframe = document.createElement('iframe'); + t.add_cleanup(function() { + // remove cookie + iframe.src = 'support/set-cookie.py?'+encodeURIComponent('ws_test_'+cookie_id+'=; Path=/; HttpOnly; Expires=Sun, 06 Nov 1994 08:49:37 GMT'); + iframe.onload = done; + }); var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/set-cookie_http?'+cookie_id); ws.onopen = t.step_func(function(e) { var ws2 = new WebSocket(SCHEME_DOMAIN_PORT+'/echo-cookie'); @@ -21,12 +26,7 @@ var t = async_test(function(t) { t.done(); }); }); - ws.onclose = t.step_func(function() {assert_unreached()}); - - add_result_callback(function() { - iframe.src = 'support/set-cookie.py?'+encodeURIComponent('ws_test_'+cookie_id+'=; Path=/; HttpOnly; Expires=Sun, 06 Nov 1994 08:49:37 GMT'); - iframe.onload = done; - }); + ws.onerror = ws.onclose = t.step_func(function(e) {assert_unreached(e.type)}); document.body.appendChild(iframe); }) diff --git a/tests/wpt/web-platform-tests/websockets/cookies/006.html b/tests/wpt/web-platform-tests/websockets/cookies/006.html index 05c848033b1..e14a90f7bdf 100644 --- a/tests/wpt/web-platform-tests/websockets/cookies/006.html +++ b/tests/wpt/web-platform-tests/websockets/cookies/006.html @@ -10,6 +10,10 @@ async_test(function(t) { if (window.WebSocket) { document.cookie = 'ws_test_'+cookie_id+'=test; Path=/; Secure'; } + t.add_cleanup(function() { + // remove cookie + document.cookie = 'ws_test_'+cookie_id+'=; Path=/; Secure; Expires=Sun, 06 Nov 1994 08:49:37 GMT'; + }); var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo-cookie'); ws.onmessage = t.step_func(function(e) { ws.close(); @@ -20,8 +24,6 @@ async_test(function(t) { } t.done(); }) - ws.onclose = t.step_func(function() {assert_unreached()}); + ws.onerror = ws.onclose = t.step_func(function(e) {assert_unreached(e.type)}); }); -// remove cookie -document.cookie = 'ws_test_'+cookie_id+'; Path=/; Secure; Expires=Sun, 06 Nov 1994 08:49:37 GMT'; diff --git a/tests/wpt/web-platform-tests/websockets/cookies/007.html b/tests/wpt/web-platform-tests/websockets/cookies/007.html index efea696a1e9..eba3139645a 100644 --- a/tests/wpt/web-platform-tests/websockets/cookies/007.html +++ b/tests/wpt/web-platform-tests/websockets/cookies/007.html @@ -8,15 +8,17 @@ diff --git a/tests/wpt/web-platform-tests/websockets/websocket.js b/tests/wpt/web-platform-tests/websockets/websocket.js index a7c2e201c4c..196a1b5c6a2 100644 --- a/tests/wpt/web-platform-tests/websockets/websocket.js +++ b/tests/wpt/web-platform-tests/websockets/websocket.js @@ -2,7 +2,7 @@ var __SERVER__NAME = "{{host}}"; var __PORT = {{ports[ws][0]}}; var __SECURE__PORT = null; //{{ports[ws][0]}}; //Should be wss var __NEW__PORT = __PORT; //All ports are non-default for now -var __NEW_SECURE_PORT = __PORT; //All ports are non-default for now +var __NEW__SECURE__PORT = __PORT; //All ports are non-default for now var __PATH = "echo"; var __CONTROLPATH = "control"; var __PROTOCOL = "echo";