Update web-platform-tests to revision 000905d008db2538360020335bc2dbba16d322b5.

This commit is contained in:
Ms2ger 2015-04-16 12:51:35 +02:00
parent 53d2432c90
commit 2d49203b9c
100 changed files with 3807 additions and 201 deletions

View file

@ -709,6 +709,14 @@
"path": "html/semantics/forms/the-input-element/file-manual.html",
"url": "/html/semantics/forms/the-input-element/file-manual.html"
},
{
"path": "html/semantics/forms/the-textarea-element/textarea-select-event-manual.html",
"url": "/html/semantics/forms/the-textarea-element/textarea-select-event-manual.html"
},
{
"path": "html/semantics/forms/the-textarea-element/textarea-select-manual.html",
"url": "/html/semantics/forms/the-textarea-element/textarea-select-manual.html"
},
{
"path": "html/semantics/grouping-content/the-li-element/grouping-li-novalue-manual.html",
"url": "/html/semantics/grouping-content/the-li-element/grouping-li-novalue-manual.html"
@ -8407,10 +8415,6 @@
"path": "IndexedDB/idbdatabase_createObjectStore7.htm",
"url": "/IndexedDB/idbdatabase_createObjectStore7.htm"
},
{
"path": "IndexedDB/idbdatabase_createObjectStore8-parameters.htm",
"url": "/IndexedDB/idbdatabase_createObjectStore8-parameters.htm"
},
{
"path": "IndexedDB/idbdatabase_createObjectStore9-invalidparameters.htm",
"url": "/IndexedDB/idbdatabase_createObjectStore9-invalidparameters.htm"
@ -9623,6 +9627,14 @@
"path": "XMLHttpRequest/send-timeout-events.htm",
"url": "/XMLHttpRequest/send-timeout-events.htm"
},
{
"path": "XMLHttpRequest/send-usp.html",
"url": "/XMLHttpRequest/send-usp.html"
},
{
"path": "XMLHttpRequest/send-usp.worker.js",
"url": "/XMLHttpRequest/send-usp.worker"
},
{
"path": "XMLHttpRequest/setrequestheader-after-send.htm",
"url": "/XMLHttpRequest/setrequestheader-after-send.htm"
@ -9695,58 +9707,6 @@
"path": "XMLHttpRequest/xmlhttprequest-network-error.htm",
"url": "/XMLHttpRequest/xmlhttprequest-network-error.htm"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-aborted.html",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-aborted.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-abortedonmain.html",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-abortedonmain.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-overrides.html",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-overrides.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-overridesexpires.html",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-overridesexpires.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-simple.html",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-simple.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-synconmain.html",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-synconmain.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-twice.html",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-twice.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-worker-aborted.html",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-worker-aborted.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-worker-overrides.html",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-worker-overrides.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-worker-overridesexpires.html",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-worker-overridesexpires.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-worker-simple.html",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-worker-simple.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-worker-synconworker.html",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-worker-synconworker.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-worker-twice.html",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-worker-twice.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-unsent.htm",
"url": "/XMLHttpRequest/xmlhttprequest-unsent.htm"
@ -16139,6 +16099,74 @@
"path": "selectors/attribute-selectors/attribute-case/syntax.html",
"url": "/selectors/attribute-selectors/attribute-case/syntax.html"
},
{
"path": "service-workers/cache-storage/common.https.html",
"url": "/service-workers/cache-storage/common.https.html"
},
{
"path": "service-workers/cache-storage/serviceworker/cache-add.https.html",
"url": "/service-workers/cache-storage/serviceworker/cache-add.https.html"
},
{
"path": "service-workers/cache-storage/serviceworker/cache-delete.https.html",
"url": "/service-workers/cache-storage/serviceworker/cache-delete.https.html"
},
{
"path": "service-workers/cache-storage/serviceworker/cache-storage-keys.https.html",
"url": "/service-workers/cache-storage/serviceworker/cache-storage-keys.https.html"
},
{
"path": "service-workers/cache-storage/serviceworker/cache-storage-match.https.html",
"url": "/service-workers/cache-storage/serviceworker/cache-storage-match.https.html"
},
{
"path": "service-workers/cache-storage/serviceworker/cache-storage.https.html",
"url": "/service-workers/cache-storage/serviceworker/cache-storage.https.html"
},
{
"path": "service-workers/cache-storage/window/cache-add.https.html",
"url": "/service-workers/cache-storage/window/cache-add.https.html"
},
{
"path": "service-workers/cache-storage/window/cache-delete.https.html",
"url": "/service-workers/cache-storage/window/cache-delete.https.html"
},
{
"path": "service-workers/cache-storage/window/cache-storage-keys.https.html",
"url": "/service-workers/cache-storage/window/cache-storage-keys.https.html"
},
{
"path": "service-workers/cache-storage/window/cache-storage-match.https.html",
"url": "/service-workers/cache-storage/window/cache-storage-match.https.html"
},
{
"path": "service-workers/cache-storage/window/cache-storage.https.html",
"url": "/service-workers/cache-storage/window/cache-storage.https.html"
},
{
"path": "service-workers/cache-storage/window/sandboxed-iframes.https.html",
"url": "/service-workers/cache-storage/window/sandboxed-iframes.https.html"
},
{
"path": "service-workers/cache-storage/worker/cache-add.https.html",
"url": "/service-workers/cache-storage/worker/cache-add.https.html"
},
{
"path": "service-workers/cache-storage/worker/cache-delete.https.html",
"url": "/service-workers/cache-storage/worker/cache-delete.https.html"
},
{
"path": "service-workers/cache-storage/worker/cache-storage-keys.https.html",
"url": "/service-workers/cache-storage/worker/cache-storage-keys.https.html"
},
{
"path": "service-workers/cache-storage/worker/cache-storage-match.https.html",
"url": "/service-workers/cache-storage/worker/cache-storage-match.https.html"
},
{
"path": "service-workers/cache-storage/worker/cache-storage.https.html",
"url": "/service-workers/cache-storage/worker/cache-storage.https.html"
},
{
"path": "shadow-dom/elements-and-dom-objects/extensions-to-element-interface/attributes/test-001.html",
"url": "/shadow-dom/elements-and-dom-objects/extensions-to-element-interface/attributes/test-001.html"
@ -18784,6 +18812,11 @@
"timeout": "long",
"url": "/IndexedDB/idbdatabase_createObjectStore10-1000ends.htm"
},
{
"path": "IndexedDB/idbdatabase_createObjectStore8-parameters.htm",
"timeout": "long",
"url": "/IndexedDB/idbdatabase_createObjectStore8-parameters.htm"
},
{
"path": "IndexedDB/idbobjectstore_createIndex3-usable-right-away.htm",
"timeout": "long",
@ -18819,6 +18852,71 @@
"timeout": "long",
"url": "/XMLHttpRequest/send-redirect-bogus.htm"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-aborted.html",
"timeout": "long",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-aborted.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-abortedonmain.html",
"timeout": "long",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-abortedonmain.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-overrides.html",
"timeout": "long",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-overrides.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-overridesexpires.html",
"timeout": "long",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-overridesexpires.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-simple.html",
"timeout": "long",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-simple.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-synconmain.html",
"timeout": "long",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-synconmain.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-twice.html",
"timeout": "long",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-twice.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-worker-aborted.html",
"timeout": "long",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-worker-aborted.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-worker-overrides.html",
"timeout": "long",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-worker-overrides.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-worker-overridesexpires.html",
"timeout": "long",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-worker-overridesexpires.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-worker-simple.html",
"timeout": "long",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-worker-simple.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-worker-synconworker.html",
"timeout": "long",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-worker-synconworker.html"
},
{
"path": "XMLHttpRequest/xmlhttprequest-timeout-worker-twice.html",
"timeout": "long",
"url": "/XMLHttpRequest/xmlhttprequest-timeout-worker-twice.html"
},
{
"path": "ambient-light/AmbientLight_tests.html",
"timeout": "long",
@ -19874,6 +19972,36 @@
"timeout": "long",
"url": "/media-source/mediasource-redundant-seek.html"
},
{
"path": "service-workers/cache-storage/serviceworker/cache-match.https.html",
"timeout": "long",
"url": "/service-workers/cache-storage/serviceworker/cache-match.https.html"
},
{
"path": "service-workers/cache-storage/serviceworker/cache-put.https.html",
"timeout": "long",
"url": "/service-workers/cache-storage/serviceworker/cache-put.https.html"
},
{
"path": "service-workers/cache-storage/window/cache-match.https.html",
"timeout": "long",
"url": "/service-workers/cache-storage/window/cache-match.https.html"
},
{
"path": "service-workers/cache-storage/window/cache-put.https.html",
"timeout": "long",
"url": "/service-workers/cache-storage/window/cache-put.https.html"
},
{
"path": "service-workers/cache-storage/worker/cache-match.https.html",
"timeout": "long",
"url": "/service-workers/cache-storage/worker/cache-match.https.html"
},
{
"path": "service-workers/cache-storage/worker/cache-put.https.html",
"timeout": "long",
"url": "/service-workers/cache-storage/worker/cache-put.https.html"
},
{
"path": "websockets/binary/002.html",
"timeout": "long",
@ -25075,7 +25203,7 @@
}
]
},
"rev": "2a9fd810bb18610b422dbc3998ab74aa1bffae95",
"rev": "000905d008db2538360020335bc2dbba16d322b5",
"url_base": "/",
"version": 2
}

View file

@ -0,0 +1,50 @@
[send-usp.html]
type: testharness
[XMLHttpRequest.send(URLSearchParams) (0)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (1)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (2)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (3)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (4)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (5)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (6)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (7)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (8)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (9)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (10)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (11)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (12)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (13)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (14)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (15)]
expected: FAIL

View file

@ -0,0 +1,50 @@
[send-usp.worker]
type: testharness
[XMLHttpRequest.send(URLSearchParams) (0)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (1)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (2)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (3)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (4)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (5)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (6)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (7)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (8)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (9)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (10)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (11)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (12)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (13)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (14)]
expected: FAIL
[XMLHttpRequest.send(URLSearchParams) (15)]
expected: FAIL

View file

@ -0,0 +1,3 @@
[xmlhttprequest-timeout-worker-aborted.html]
type: testharness
expected: TIMEOUT

View file

@ -1,5 +1,4 @@
[xmlhttprequest-timeout-worker-overrides.html]
type: testharness
[Timeout test: timeout enabled after initially disabled, original timeout at 0, reset at 400 to 1000]
disabled: flaky - https://github.com/w3c/web-platform-tests/issues/1362

View file

@ -1,5 +1,4 @@
[xmlhttprequest-timeout-worker-overridesexpires.html]
type: testharness
[Timeout test: timeout set to expired value before load fires, original timeout at 1000, reset at 400 to 300]
disabled: racy test

View file

@ -0,0 +1,3 @@
[xmlhttprequest-timeout-worker-simple.html]
type: testharness
expected: TIMEOUT

View file

@ -1,5 +1,4 @@
[xmlhttprequest-timeout-worker-twice.html]
type: testharness
[Timeout test: load fires normally with same timeout set twice, original timeout at 1000, reset at 400 to 1000]
disabled: flaky

View file

@ -1,5 +0,0 @@
[getElementsByClassName-31.htm]
type: testharness
[getElementsByClassName across documents]
expected: PASS

View file

@ -2,3 +2,4 @@
type: testharness
[Label for "replacement" should be rejected by API: hz-gb-2312]
expected: FAIL

View file

@ -5,3 +5,4 @@
[UTF encodings are supported for encode and decode: utf-16le]
expected: FAIL

View file

@ -1,14 +1,5 @@
[window-properties.html]
type: testharness
[EventTarget method: addEventListener]
expected: FAIL
[EventTarget method: removeEventListener]
expected: FAIL
[EventTarget method: dispatchEvent]
expected: FAIL
[Window method: close]
expected: FAIL
@ -78,18 +69,12 @@
[Window readonly attribute: history]
expected: FAIL
[Window readonly attribute: parent]
expected: FAIL
[Window readonly attribute: frameElement]
expected: FAIL
[Window readonly attribute: navigator]
expected: FAIL
[Window readonly attribute: external]
expected: FAIL
[Window readonly attribute: applicationCache]
expected: FAIL
@ -99,39 +84,6 @@
[Window readonly attribute: localStorage]
expected: FAIL
[Window readonly attribute: screen]
expected: FAIL
[Window readonly attribute: innerWidth]
expected: FAIL
[Window readonly attribute: innerHeight]
expected: FAIL
[Window readonly attribute: scrollX]
expected: FAIL
[Window readonly attribute: pageXOffset]
expected: FAIL
[Window readonly attribute: scrollY]
expected: FAIL
[Window readonly attribute: pageYOffset]
expected: FAIL
[Window readonly attribute: screenX]
expected: FAIL
[Window readonly attribute: screenY]
expected: FAIL
[Window readonly attribute: outerWidth]
expected: FAIL
[Window readonly attribute: outerHeight]
expected: FAIL
[Window attribute: name]
expected: FAIL
@ -384,3 +336,45 @@
[Window replaceable attribute: length]
expected: FAIL
[Window replaceable attribute: parent]
expected: FAIL
[Window replaceable attribute: external]
expected: FAIL
[Window replaceable attribute: screen]
expected: FAIL
[Window replaceable attribute: scrollX]
expected: FAIL
[Window replaceable attribute: scrollY]
expected: FAIL
[Window replaceable attribute: pageXOffset]
expected: FAIL
[Window replaceable attribute: pageYOffset]
expected: FAIL
[Window replaceable attribute: innerWidth]
expected: FAIL
[Window replaceable attribute: innerHeight]
expected: FAIL
[Window replaceable attribute: screenX]
expected: FAIL
[Window replaceable attribute: screenY]
expected: FAIL
[Window replaceable attribute: outerWidth]
expected: FAIL
[Window replaceable attribute: outerHeight]
expected: FAIL
[Window replaceable attribute: devicePixelRatio]
expected: FAIL

View file

@ -12375,3 +12375,843 @@
[menu.type: IDL set to "TOOLBAR" followed by IDL get]
expected: FAIL
[dialog.dir: typeof IDL attribute]
expected: FAIL
[dialog.dir: IDL get with DOM attribute unset]
expected: FAIL
[dialog.dir: setAttribute() to "" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to undefined followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to 7 followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to 1.5 followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to true followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to false followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to object "[object Object\]" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to NaN followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to Infinity followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to -Infinity followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to "\\0" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to null followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to object "test-toString" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to object "test-valueOf" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to "ltr" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to "xltr" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to "ltr\\0" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to "tr" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to "LTR" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to "rtl" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to "xrtl" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to "rtl\\0" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to "tl" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to "RTL" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to "auto" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to "xauto" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to "auto\\0" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to "uto" followed by IDL get]
expected: FAIL
[dialog.dir: setAttribute() to "AUTO" followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to "" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to undefined followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to undefined followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to 7 followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to 7 followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to 1.5 followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to 1.5 followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to true followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to true followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to false followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to false followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to object "[object Object\]" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to object "[object Object\]" followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to NaN followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to NaN followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to Infinity followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to Infinity followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to -Infinity followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to -Infinity followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to "\\0" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to "\\0" followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to null followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to object "test-toString" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to object "test-toString" followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to object "test-valueOf" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to object "test-valueOf" followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to "ltr" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to "xltr" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to "xltr" followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to "ltr\\0" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to "ltr\\0" followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to "tr" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to "tr" followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to "LTR" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to "LTR" followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to "rtl" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to "xrtl" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to "xrtl" followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to "rtl\\0" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to "rtl\\0" followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to "tl" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to "tl" followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to "RTL" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to "RTL" followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to "auto" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to "xauto" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to "xauto" followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to "auto\\0" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to "auto\\0" followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to "uto" followed by getAttribute()]
expected: FAIL
[dialog.dir: IDL set to "uto" followed by IDL get]
expected: FAIL
[dialog.dir: IDL set to "AUTO" followed by IDL get]
expected: FAIL
[dialog.accessKey: typeof IDL attribute]
expected: FAIL
[dialog.accessKey: IDL get with DOM attribute unset]
expected: FAIL
[dialog.accessKey: setAttribute() to "" followed by IDL get]
expected: FAIL
[dialog.accessKey: setAttribute() to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by IDL get]
expected: FAIL
[dialog.accessKey: setAttribute() to undefined followed by IDL get]
expected: FAIL
[dialog.accessKey: setAttribute() to 7 followed by IDL get]
expected: FAIL
[dialog.accessKey: setAttribute() to 1.5 followed by IDL get]
expected: FAIL
[dialog.accessKey: setAttribute() to true followed by IDL get]
expected: FAIL
[dialog.accessKey: setAttribute() to false followed by IDL get]
expected: FAIL
[dialog.accessKey: setAttribute() to object "[object Object\]" followed by IDL get]
expected: FAIL
[dialog.accessKey: setAttribute() to NaN followed by IDL get]
expected: FAIL
[dialog.accessKey: setAttribute() to Infinity followed by IDL get]
expected: FAIL
[dialog.accessKey: setAttribute() to -Infinity followed by IDL get]
expected: FAIL
[dialog.accessKey: setAttribute() to "\\0" followed by IDL get]
expected: FAIL
[dialog.accessKey: setAttribute() to null followed by IDL get]
expected: FAIL
[dialog.accessKey: setAttribute() to object "test-toString" followed by IDL get]
expected: FAIL
[dialog.accessKey: setAttribute() to object "test-valueOf" followed by IDL get]
expected: FAIL
[dialog.accessKey: IDL set to "" followed by getAttribute()]
expected: FAIL
[dialog.accessKey: IDL set to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by getAttribute()]
expected: FAIL
[dialog.accessKey: IDL set to undefined followed by getAttribute()]
expected: FAIL
[dialog.accessKey: IDL set to undefined followed by IDL get]
expected: FAIL
[dialog.accessKey: IDL set to 7 followed by getAttribute()]
expected: FAIL
[dialog.accessKey: IDL set to 7 followed by IDL get]
expected: FAIL
[dialog.accessKey: IDL set to 1.5 followed by getAttribute()]
expected: FAIL
[dialog.accessKey: IDL set to 1.5 followed by IDL get]
expected: FAIL
[dialog.accessKey: IDL set to true followed by getAttribute()]
expected: FAIL
[dialog.accessKey: IDL set to true followed by IDL get]
expected: FAIL
[dialog.accessKey: IDL set to false followed by getAttribute()]
expected: FAIL
[dialog.accessKey: IDL set to false followed by IDL get]
expected: FAIL
[dialog.accessKey: IDL set to object "[object Object\]" followed by getAttribute()]
expected: FAIL
[dialog.accessKey: IDL set to object "[object Object\]" followed by IDL get]
expected: FAIL
[dialog.accessKey: IDL set to NaN followed by getAttribute()]
expected: FAIL
[dialog.accessKey: IDL set to NaN followed by IDL get]
expected: FAIL
[dialog.accessKey: IDL set to Infinity followed by getAttribute()]
expected: FAIL
[dialog.accessKey: IDL set to Infinity followed by IDL get]
expected: FAIL
[dialog.accessKey: IDL set to -Infinity followed by getAttribute()]
expected: FAIL
[dialog.accessKey: IDL set to -Infinity followed by IDL get]
expected: FAIL
[dialog.accessKey: IDL set to "\\0" followed by getAttribute()]
expected: FAIL
[dialog.accessKey: IDL set to null followed by getAttribute()]
expected: FAIL
[dialog.accessKey: IDL set to null followed by IDL get]
expected: FAIL
[dialog.accessKey: IDL set to object "test-toString" followed by getAttribute()]
expected: FAIL
[dialog.accessKey: IDL set to object "test-toString" followed by IDL get]
expected: FAIL
[dialog.accessKey: IDL set to object "test-valueOf" followed by IDL get]
expected: FAIL
[dialog.tabIndex: typeof IDL attribute]
expected: FAIL
[dialog.tabIndex: setAttribute() to -36 followed by IDL get]
expected: FAIL
[dialog.tabIndex: setAttribute() to -1 followed by IDL get]
expected: FAIL
[dialog.tabIndex: setAttribute() to 0 followed by IDL get]
expected: FAIL
[dialog.tabIndex: setAttribute() to 1 followed by IDL get]
expected: FAIL
[dialog.tabIndex: setAttribute() to 2147483647 followed by IDL get]
expected: FAIL
[dialog.tabIndex: setAttribute() to -2147483648 followed by IDL get]
expected: FAIL
[dialog.tabIndex: setAttribute() to "-1" followed by IDL get]
expected: FAIL
[dialog.tabIndex: setAttribute() to "-0" followed by IDL get]
expected: FAIL
[dialog.tabIndex: setAttribute() to "0" followed by IDL get]
expected: FAIL
[dialog.tabIndex: setAttribute() to "1" followed by IDL get]
expected: FAIL
[dialog.tabIndex: setAttribute() to "\\t7" followed by IDL get]
expected: FAIL
[dialog.tabIndex: setAttribute() to "\\f7" followed by IDL get]
expected: FAIL
[dialog.tabIndex: setAttribute() to " 7" followed by IDL get]
expected: FAIL
[dialog.tabIndex: setAttribute() to "\\n7" followed by IDL get]
expected: FAIL
[dialog.tabIndex: setAttribute() to "\\r7" followed by IDL get]
expected: FAIL
[dialog.tabIndex: setAttribute() to 1.5 followed by IDL get]
expected: FAIL
[dialog.tabIndex: setAttribute() to object "2" followed by IDL get]
expected: FAIL
[dialog.tabIndex: IDL set to -36 followed by getAttribute()]
expected: FAIL
[dialog.tabIndex: IDL set to -1 followed by getAttribute()]
expected: FAIL
[dialog.tabIndex: IDL set to 0 followed by getAttribute()]
expected: FAIL
[dialog.tabIndex: IDL set to 1 followed by getAttribute()]
expected: FAIL
[dialog.tabIndex: IDL set to 2147483647 followed by getAttribute()]
expected: FAIL
[dialog.tabIndex: IDL set to -2147483648 followed by getAttribute()]
expected: FAIL
[dialog.open: typeof IDL attribute]
expected: FAIL
[dialog.open: IDL get with DOM attribute unset]
expected: FAIL
[dialog.open: setAttribute() to "" followed by IDL get]
expected: FAIL
[dialog.open: setAttribute() to " foo " followed by IDL get]
expected: FAIL
[dialog.open: setAttribute() to undefined followed by IDL get]
expected: FAIL
[dialog.open: setAttribute() to null followed by IDL get]
expected: FAIL
[dialog.open: setAttribute() to 7 followed by IDL get]
expected: FAIL
[dialog.open: setAttribute() to 1.5 followed by IDL get]
expected: FAIL
[dialog.open: setAttribute() to true followed by IDL get]
expected: FAIL
[dialog.open: setAttribute() to false followed by IDL get]
expected: FAIL
[dialog.open: setAttribute() to object "[object Object\]" followed by IDL get]
expected: FAIL
[dialog.open: setAttribute() to NaN followed by IDL get]
expected: FAIL
[dialog.open: setAttribute() to Infinity followed by IDL get]
expected: FAIL
[dialog.open: setAttribute() to -Infinity followed by IDL get]
expected: FAIL
[dialog.open: setAttribute() to "\\0" followed by IDL get]
expected: FAIL
[dialog.open: setAttribute() to object "test-toString" followed by IDL get]
expected: FAIL
[dialog.open: setAttribute() to object "test-valueOf" followed by IDL get]
expected: FAIL
[dialog.open: setAttribute() to "open" followed by IDL get]
expected: FAIL
[dialog.open: IDL set to "" followed by hasAttribute()]
expected: FAIL
[dialog.open: IDL set to "" followed by IDL get]
expected: FAIL
[dialog.open: IDL set to " foo " followed by IDL get]
expected: FAIL
[dialog.open: IDL set to undefined followed by hasAttribute()]
expected: FAIL
[dialog.open: IDL set to undefined followed by IDL get]
expected: FAIL
[dialog.open: IDL set to null followed by hasAttribute()]
expected: FAIL
[dialog.open: IDL set to null followed by IDL get]
expected: FAIL
[dialog.open: IDL set to 7 followed by IDL get]
expected: FAIL
[dialog.open: IDL set to 1.5 followed by IDL get]
expected: FAIL
[dialog.open: IDL set to false followed by hasAttribute()]
expected: FAIL
[dialog.open: IDL set to object "[object Object\]" followed by IDL get]
expected: FAIL
[dialog.open: IDL set to NaN followed by hasAttribute()]
expected: FAIL
[dialog.open: IDL set to NaN followed by IDL get]
expected: FAIL
[dialog.open: IDL set to Infinity followed by IDL get]
expected: FAIL
[dialog.open: IDL set to -Infinity followed by IDL get]
expected: FAIL
[dialog.open: IDL set to "\\0" followed by IDL get]
expected: FAIL
[dialog.open: IDL set to object "test-toString" followed by IDL get]
expected: FAIL
[dialog.open: IDL set to object "test-valueOf" followed by IDL get]
expected: FAIL
[dialog.itemScope: typeof IDL attribute]
expected: FAIL
[dialog.itemScope: IDL get with DOM attribute unset]
expected: FAIL
[dialog.itemScope: setAttribute() to "" followed by IDL get]
expected: FAIL
[dialog.itemScope: setAttribute() to " foo " followed by IDL get]
expected: FAIL
[dialog.itemScope: setAttribute() to undefined followed by IDL get]
expected: FAIL
[dialog.itemScope: setAttribute() to null followed by IDL get]
expected: FAIL
[dialog.itemScope: setAttribute() to 7 followed by IDL get]
expected: FAIL
[dialog.itemScope: setAttribute() to 1.5 followed by IDL get]
expected: FAIL
[dialog.itemScope: setAttribute() to true followed by IDL get]
expected: FAIL
[dialog.itemScope: setAttribute() to false followed by IDL get]
expected: FAIL
[dialog.itemScope: setAttribute() to object "[object Object\]" followed by IDL get]
expected: FAIL
[dialog.itemScope: setAttribute() to NaN followed by IDL get]
expected: FAIL
[dialog.itemScope: setAttribute() to Infinity followed by IDL get]
expected: FAIL
[dialog.itemScope: setAttribute() to -Infinity followed by IDL get]
expected: FAIL
[dialog.itemScope: setAttribute() to "\\0" followed by IDL get]
expected: FAIL
[dialog.itemScope: setAttribute() to object "test-toString" followed by IDL get]
expected: FAIL
[dialog.itemScope: setAttribute() to object "test-valueOf" followed by IDL get]
expected: FAIL
[dialog.itemScope: setAttribute() to "itemScope" followed by IDL get]
expected: FAIL
[dialog.itemScope: IDL set to "" followed by hasAttribute()]
expected: FAIL
[dialog.itemScope: IDL set to "" followed by IDL get]
expected: FAIL
[dialog.itemScope: IDL set to " foo " followed by IDL get]
expected: FAIL
[dialog.itemScope: IDL set to undefined followed by hasAttribute()]
expected: FAIL
[dialog.itemScope: IDL set to undefined followed by IDL get]
expected: FAIL
[dialog.itemScope: IDL set to null followed by hasAttribute()]
expected: FAIL
[dialog.itemScope: IDL set to null followed by IDL get]
expected: FAIL
[dialog.itemScope: IDL set to 7 followed by IDL get]
expected: FAIL
[dialog.itemScope: IDL set to 1.5 followed by IDL get]
expected: FAIL
[dialog.itemScope: IDL set to false followed by hasAttribute()]
expected: FAIL
[dialog.itemScope: IDL set to object "[object Object\]" followed by IDL get]
expected: FAIL
[dialog.itemScope: IDL set to NaN followed by hasAttribute()]
expected: FAIL
[dialog.itemScope: IDL set to NaN followed by IDL get]
expected: FAIL
[dialog.itemScope: IDL set to Infinity followed by IDL get]
expected: FAIL
[dialog.itemScope: IDL set to -Infinity followed by IDL get]
expected: FAIL
[dialog.itemScope: IDL set to "\\0" followed by IDL get]
expected: FAIL
[dialog.itemScope: IDL set to object "test-toString" followed by IDL get]
expected: FAIL
[dialog.itemScope: IDL set to object "test-valueOf" followed by IDL get]
expected: FAIL
[dialog.itemId: typeof IDL attribute]
expected: FAIL
[dialog.itemId: IDL get with DOM attribute unset]
expected: FAIL
[dialog.itemId: setAttribute() to "" followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to " foo " followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to "http://site.example/" followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to "//site.example/path???@#l" followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to "\\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f " followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to undefined followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to 7 followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to 1.5 followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to true followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to false followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to object "[object Object\]" followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to NaN followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to Infinity followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to -Infinity followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to "\\0" followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to null followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to object "test-toString" followed by IDL get]
expected: FAIL
[dialog.itemId: setAttribute() to object "test-valueOf" followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to "" followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to "" followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to " foo " followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to " foo " followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to "http://site.example/" followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to "http://site.example/" followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to "//site.example/path???@#l" followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to "//site.example/path???@#l" followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to "\\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f " followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to "\\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f " followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to undefined followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to undefined followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to 7 followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to 7 followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to 1.5 followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to 1.5 followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to true followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to true followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to false followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to false followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to object "[object Object\]" followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to object "[object Object\]" followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to NaN followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to NaN followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to Infinity followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to Infinity followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to -Infinity followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to -Infinity followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to "\\0" followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to "\\0" followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to null followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to null followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to object "test-toString" followed by getAttribute()]
expected: FAIL
[dialog.itemId: IDL set to object "test-toString" followed by IDL get]
expected: FAIL
[dialog.itemId: IDL set to object "test-valueOf" followed by IDL get]
expected: FAIL

View file

@ -2,10 +2,13 @@
type: testharness
[input3 has the attribute autofocus]
expected: FAIL
[tabindex attribute makes the element focusable]
expected: FAIL
[editable elements are focusable]
expected: FAIL
[':focus' matches focussed body with tabindex]
[\':focus\' matches focussed body with tabindex]
expected: FAIL

View file

@ -0,0 +1 @@
53d2432c90ab9ef171dfbef8e22ed3f58fcef8f0

View file

@ -1,5 +0,0 @@
[EventTarget.worker]
type: testharness
[removeEventListener]
expected: FAIL

View file

@ -1,5 +1,6 @@
[propagate-to-window-onerror.html]
type: testharness
expected: TIMEOUT
[onerror, "not handled" with only window.onerror defined]
expected: FAIL
expected: TIMEOUT

View file

@ -2,3 +2,4 @@
type: testharness
[Untitled]
expected: FAIL

View file

@ -2,3 +2,4 @@
type: testharness
[Untitled]
expected: FAIL

View file

@ -1,5 +1,5 @@
[enabled_disabled_selectors.html]
type: testharness
[menuitem initial state]
expected: FAIL

View file

@ -1,5 +1,5 @@
[windowproxy.html]
type: testharness
[Unforgeable location]
expected: FAIL

View file

@ -2,6 +2,7 @@
<meta charset="utf-8">
<title>IDBObjectStoreParameters</title>
<link rel="author" href="mailto:odinho@opera.com" title="Odin Hørthe Omdal">
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support.js"></script>

View file

@ -2,13 +2,13 @@ if (this.document === undefined)
importScripts("xmlhttprequest-timeout.js");
/*
This sets up three requests:
The first request will only be open()ed, not aborted, timeout will be 400 but will never triggered because send() isn't called.
After a 1 second delay, the test asserts that no load/error/timeout/abort events fired
The first request will only be open()ed, not aborted, timeout will be TIME_REGULAR_TIMEOUT but will never triggered because send() isn't called.
After TIME_NORMAL_LOAD, the test asserts that no load/error/timeout/abort events fired
Second request will be aborted immediately after send(), test asserts that abort fired
Third request is set up to call abort() after a 1 second delay, but it also has a 400ms timeout. Asserts that timeout fired.
(abort() is called 600ms later and should not fire an abort event per spec. This is untested!)
Third request is set up to call abort() after TIME_NORMAL_LOAD, but it also has a TIME_REGULAR_TIMEOUT timeout. Asserts that timeout fired.
(abort() is called later and should not fire an abort event per spec. This is untested!)
*/
runTestRequests([ new AbortedRequest(false),
new AbortedRequest(true, -1),

View file

@ -1,7 +1,7 @@
/*
This test sets up two requests:
one that gets abort()ed from a 0ms timeout (0ms will obviously be clamped to whatever the implementation's minimal value is), asserts abort event fires
one that will be aborted after 200ms (TIME_DELAY), (with a timeout at 400ms) asserts abort event fires. Does not assert that the timeout event does *not* fire.
one that will be aborted after TIME_DELAY, (with a timeout at TIME_REGULAR_TIMEOUT) asserts abort event fires. Does not assert that the timeout event does *not* fire.
*/
runTestRequests([ new AbortedRequest(true, 0),

View file

@ -2,9 +2,9 @@ if (this.document === undefined)
importScripts("xmlhttprequest-timeout.js");
/*
Sets up three requests to a resource that will take 0.6 seconds to load:
1) timeout first set to 1000ms, after 400ms timeout is set to 0, asserts load fires
2) timeout first set to 1000ms, after 200ms timeout is set to 400, asserts load fires (race condition..?!?)
3) timeout first set to 0, after 400ms it is set to 1000, asserts load fires
1) timeout first set to TIME_NORMAL_LOAD, after TIME_REGULAR_TIMEOUT timeout is set to 0, asserts load fires
2) timeout first set to TIME_NORMAL_LOAD, after TIME_DELAY timeout is set to TIME_REGULAR_TIMEOUT, asserts load fires (race condition..?!?)
3) timeout first set to 0, after TIME_REGULAR_TIMEOUT it is set to TIME_REGULAR_TIMEOUT * 10, asserts load fires
*/
runTestRequests([ new RequestTracker(true, "timeout disabled after initially set", TIME_NORMAL_LOAD, TIME_REGULAR_TIMEOUT, 0),
new RequestTracker(true, "timeout overrides load after a delay", TIME_NORMAL_LOAD, TIME_DELAY, TIME_REGULAR_TIMEOUT),

View file

@ -2,11 +2,10 @@ if (this.document === undefined)
importScripts("xmlhttprequest-timeout.js");
/*
Starts three requests:
1) XHR to resource which will take a least 600ms with timeout initially set to 1000ms. After 800ms timeout is supposedly reset to 200ms,
1) XHR to resource which will take a least TIME_XHR_LOAD ms with timeout initially set to TIME_NORMAL_LOAD ms. After TIME_LATE_TIMEOUT ms timeout is supposedly reset to TIME_DELAY ms,
but the resource should have finished loading already. Asserts "load" fires.
2) XHR with initial timeout set to 1000, after 400ms sets timeout to 300ms. Asserts "timeout" fires.
(Originally new value was 200ms. Race condition-y. Setting the new timeout to 300ms would be a better test of the "measured from start of fetching" requirement.)
3) XHR with initial timeout set to 200, after 400ms sets timeout to 500ms. Asserts "timeout" fires (the change happens when timeout already fired and the request is done).
2) XHR with initial timeout set to TIME_NORMAL_LOAD, after TIME_REGULAR_TIMEOUT sets timeout to TIME_DELAY+100. Asserts "timeout" fires.
3) XHR with initial timeout set to TIME_DELAY, after TIME_REGULAR_TIMEOUT sets timeout to 500ms. Asserts "timeout" fires (the change happens when timeout already fired and the request is done).
*/
runTestRequests([ new RequestTracker(true, "timeout set to expiring value after load fires", TIME_NORMAL_LOAD, TIME_LATE_TIMEOUT, TIME_DELAY),
new RequestTracker(true, "timeout set to expired value before load fires", TIME_NORMAL_LOAD, TIME_REGULAR_TIMEOUT, TIME_DELAY+100),

View file

@ -1,3 +1,4 @@
function testResultCallbackHandler(event) {
if (event.data == "done") {
done();
@ -16,5 +17,5 @@ function testResultCallbackHandler(event) {
window.addEventListener("message", testResultCallbackHandler);
// Setting up testharness.js
setup({ explicit_done: true, timeout: 30 * 1000 });
setup({ explicit_done: true });

View file

@ -11,12 +11,12 @@
request handlers.
*/
var TIME_NORMAL_LOAD = 1000;
var TIME_LATE_TIMEOUT = 800;
var TIME_XHR_LOAD = 600;
var TIME_REGULAR_TIMEOUT = 400;
var TIME_SYNC_TIMEOUT = 200;
var TIME_DELAY = 200;
var TIME_NORMAL_LOAD = 5000;
var TIME_LATE_TIMEOUT = 4000;
var TIME_XHR_LOAD = 3000;
var TIME_REGULAR_TIMEOUT = 2000;
var TIME_SYNC_TIMEOUT = 1000;
var TIME_DELAY = 1000;
/*
* This should point to a resource that responds with a text/plain resource after a delay of TIME_XHR_LOAD milliseconds.

View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>XMLHttpRequest.send(URLSearchParams)</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="send-usp.js"></script>
<div id="log"></div>
<script>
run_test();
</script>

View file

@ -0,0 +1,39 @@
function encode(n) {
if (n === 0x20) {
return "\x2B";
}
if (n === 0x2A || n === 0x2D || n === 0x2E ||
(0x30 <= n && n <= 0x39) || (0x41 <= n && n <= 0x5A) ||
n === 0x5F || (0x61 <= n && n <= 0x7A)) {
return String.fromCharCode(n);
}
var s = n.toString(16).toUpperCase();
return "%" + (s.length === 2 ? s : '0' + s);
}
function do_test(n) {
async_test(function() {
var x = new XMLHttpRequest();
x.onload = this.step_func_done(function(e) {
assert_equals(x.response, "a=" + encode(n))
});
x.onerror = this.unreached_func();
x.open("POST", "resources/content.py");
var usp = new URLSearchParams();
usp.append("a", String.fromCharCode(n));
x.send(usp)
}, "XMLHttpRequest.send(URLSearchParams) (" + n + ")");
}
function run_test() {
var i = 0;
add_result_callback(function() {
if (++i === 128) {
return;
}
do_test(i);
});
do_test(i);
}

View file

@ -0,0 +1,5 @@
importScripts("/resources/testharness.js");
importScripts("/resources/testharnessreport.js");
importScripts("send-usp.js");
run_test();
done();

View file

@ -12,6 +12,7 @@
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol/li[9]"/>
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
<link rel="stylesheet" href="/resources/testharness.css" />
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/xmlhttprequest-timeout.js"></script>

View file

@ -8,6 +8,7 @@
<link rel="help" href="https://xhr.spec.whatwg.org/#event-xhr-abort" data-tested-assertations="../.." />
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol/li[9]"/>
<link rel="stylesheet" href="/resources/testharness.css" />
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/xmlhttprequest-timeout.js"></script>

View file

@ -8,6 +8,7 @@
<link rel="help" href="https://xhr.spec.whatwg.org/#timeout-error" data-tested-assertations=".."/>
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
<link rel="stylesheet" href="/resources/testharness.css" />
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/xmlhttprequest-timeout.js"></script>

View file

@ -9,6 +9,7 @@
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
<link rel="stylesheet" href="/resources/testharness.css" />
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/xmlhttprequest-timeout.js"></script>

View file

@ -9,6 +9,7 @@
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
<link rel="stylesheet" href="/resources/testharness.css" />
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/xmlhttprequest-timeout.js"></script>

View file

@ -6,6 +6,7 @@
<link rel="help" href="https://xhr.spec.whatwg.org/#the-timeout-attribute" data-tested-assertations="following::ol[1]/li[1]" />
<link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[10]" />
<link rel="stylesheet" href="/resources/testharness.css" />
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/xmlhttprequest-timeout.js"></script>

View file

@ -10,6 +10,7 @@
<link rel="help" href="https://xhr.spec.whatwg.org/#timeout-error" data-tested-assertations=".."/>
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/xmlhttprequest-timeout.js"></script>

View file

@ -12,6 +12,7 @@
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol/li[9]"/>
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
<link rel="stylesheet" href="/resources/testharness.css" />
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/xmlhttprequest-timeout-runner.js"></script>

View file

@ -8,6 +8,7 @@
<link rel="help" href="https://xhr.spec.whatwg.org/#timeout-error" data-tested-assertations=".."/>
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
<link rel="stylesheet" href="/resources/testharness.css" />
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/xmlhttprequest-timeout-runner.js"></script>

View file

@ -9,6 +9,7 @@
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
<link rel="stylesheet" href="/resources/testharness.css" />
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/xmlhttprequest-timeout-runner.js"></script>

View file

@ -9,6 +9,7 @@
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
<link rel="stylesheet" href="/resources/testharness.css" />
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/xmlhttprequest-timeout-runner.js"></script>

View file

@ -9,6 +9,7 @@
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
<link rel="stylesheet" href="/resources/testharness.css" />
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/xmlhttprequest-timeout-runner.js"></script>

View file

@ -9,6 +9,7 @@
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
<link rel="stylesheet" href="/resources/testharness.css" />
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/xmlhttprequest-timeout-runner.js"></script>

View file

@ -1,20 +1,20 @@
(function ()
{
var test = new async_test("test inline worker");
var workerSource = document.getElementById('inlineWorker');
var blob = new Blob([workerSource.textContent]);
// can I create a new script tag like this? ack...
var url = window.URL.createObjectURL(blob);
try {
var worker = new Worker(url);
}
catch (e) {
done();
}
worker.addEventListener('message', function(e) {
test.step(function () {
assert_not_equals(e.data, 'fail', 'inline script ran');
test.done();
})
assert_unreached("script ran");
}, false);
worker.postMessage('');

View file

@ -318,4 +318,17 @@ test(function() {
assert_equals(a.firstChild, c);
assert_equals(c.parentNode, a);
}, "replaceChild should work in the presence of mutation events.")
test(function() {
var TEST_ID = "findme";
var gBody = document.getElementsByTagName("body")[0];
var parent = document.createElement("div");
gBody.appendChild(parent);
var child = document.createElement("div");
parent.appendChild(child);
var df = document.createDocumentFragment();
var fragChild = df.appendChild(document.createElement("div"));
fragChild.setAttribute("id", TEST_ID);
parent.replaceChild(df, child);
assert_equals(document.getElementById(TEST_ID), fragChild, "should not be null");
}, "Replacing an element with a DocumentFragment should allow a child of the DocumentFragment to be found by Id.")
</script>

View file

@ -42,7 +42,7 @@ var unforgeableAttributes = [
"top"
];
var replacableAttributes = [
var replaceableAttributes = [
"self",
"locationbar",
"menubar",
@ -51,7 +51,23 @@ var replacableAttributes = [
"statusbar",
"toolbar",
"frames",
"length"
"parent",
"external",
"length",
// CSSOM-View
"screen",
"scrollX",
"scrollY",
"pageXOffset",
"pageYOffset",
"innerWidth",
"innerHeight",
"screenX",
"screenY",
"outerWidth",
"outerHeight",
"devicePixelRatio",
];
var methods = [
@ -98,10 +114,8 @@ if ("showModalDialog" in window) {
var readonlyAttributes = [
"history",
"parent",
"frameElement",
"navigator",
"external",
"applicationCache",
// WindowSessionStorage
@ -109,19 +123,6 @@ var readonlyAttributes = [
// WindowLocalStorage
"localStorage",
// CSSOM-View
"screen",
"innerWidth",
"innerHeight",
"scrollX",
"pageXOffset",
"scrollY",
"pageYOffset",
"screenX",
"screenY",
"outerWidth",
"outerHeight"
];
var writableAttributes = [
@ -259,8 +260,7 @@ test(function() {
assert_equals(window[id], EventTargetProto[id]);
assert_data_propdesc(Object.getOwnPropertyDescriptor(EventTargetProto, id),
true, true, true);
assert_data_propdesc(Object.getOwnPropertyDescriptor(window, id),
true, true, true);
assert_equals(Object.getOwnPropertyDescriptor(window, id), undefined);
}, "EventTarget method: " + id);
});
}, "EventTarget interface");
@ -303,7 +303,7 @@ test(function() {
id === "location", true, false);
}, "Window unforgeable attribute: " + id);
});
replacableAttributes.forEach(function(id) {
replaceableAttributes.forEach(function(id) {
test(function() {
var WindowProto = Window.prototype;
assert_true(id in window, id + " in window");

View file

@ -50,6 +50,9 @@ var miscElements = {
radiogroup: "string",
"default": "boolean",
},
dialog: {
open: "boolean",
},
// Global attributes should exist even on unknown elements
undefinedelement: {},

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTMLTextAreaElement Test: select event</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<meta name="flags" content="interact">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<p>Select any numberic characters in the text area below</p>
<form id="testForm" name="testForm">
<textarea id="testtextarea">0123456789</textarea>
</form>
<script>
var textarea = document.getElementById("testtextarea");
setup({explicit_done : true});
setup({explicit_timeout : true});
on_event(textarea, "select", function(evt) {
test(function() {
assert_greater_than(textarea.value.substring(textarea.selectionStart, textarea.selectionEnd).length, 0, "Check if select event captured when text selected");
});
done();
});
</script>
<div id="log"></div>

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTMLTextAreaElement Test: select()</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<meta name="flags" content="interact">
<p>Test passes if content of the input area is selected</p>
<textarea id="test_obj">1234567</textarea>
<script>
var textarea = document.querySelector("#test_obj");
textarea.select();
</script>

View file

@ -15,7 +15,7 @@
var script=testlib.addScript('', { src:'scripts/include-1.js?pipe=trickle(d1)&'+Math.random() }, document.getElementsByTagName('head')[0], false );
log('end script #1');
</script>
<script src="scripts/include-2.js?pipe=trickle(d2)"></script>
<script src="scripts/include-2.js?pipe=trickle(d4)"></script>
<script type="text/javascript">
var t = async_test()

View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<title>Cache Storage: Verify that Window and Workers see same storage</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-storage">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/testharness-helpers.js"></script>
<script>
function wait_for_message(worker) {
return new Promise(function(resolve) {
worker.addEventListener('message', function listener(e) {
resolve(e.data);
worker.removeEventListener('message', listener);
});
});
}
promise_test(function(t) {
var cache_name = 'common-test';
return self.caches.delete(cache_name)
.then(function() {
var worker = new Worker('resources/common-worker.js');
worker.postMessage({name: cache_name});
return wait_for_message(worker);
})
.then(function(message) {
return self.caches.open(cache_name);
})
.then(function(cache) {
return Promise.all([
cache.match('https://example.com/a'),
cache.match('https://example.com/b'),
cache.match('https://example.com/c')
]);
})
.then(function(responses) {
return Promise.all(responses.map(
function(response) { return response.text(); }
));
})
.then(function(bodies) {
assert_equals(bodies[0], 'a',
'Body should match response put by worker');
assert_equals(bodies[1], 'b',
'Body should match response put by worker');
assert_equals(bodies[2], 'c',
'Body should match response put by worker');
});
}, 'Window sees cache puts by Worker');
</script>

View file

@ -0,0 +1,2 @@
<!DOCTYPE html>
<title>Empty doc</title>

View file

@ -0,0 +1,15 @@
self.onmessage = function(e) {
var cache_name = e.data.name;
self.caches.open(cache_name)
.then(function(cache) {
return Promise.all([
cache.put('https://example.com/a', new Response('a')),
cache.put('https://example.com/b', new Response('b')),
cache.put('https://example.com/c', new Response('c'))
]);
})
.then(function() {
self.postMessage('ok');
});
};

View file

@ -0,0 +1,2 @@
def main(request, response):
return int(request.GET["status"]), [], ""

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<title>ok</title>
<script>
window.onmessage = function(e) {
var id = e.data.id;
try {
self.caches;
window.parent.postMessage({id: id, result: 'allowed'}, '*');
} catch (e) {
window.parent.postMessage({id: id, result: 'denied', name: e.name, message: e.message}, '*');
}
};
</script>

View file

@ -0,0 +1 @@
a simple text file

View file

@ -0,0 +1,37 @@
(function() {
var next_cache_index = 1;
// Returns a promise that resolves to a newly created Cache object. The
// returned Cache will be destroyed when |test| completes.
function create_temporary_cache(test) {
var uniquifier = String(++next_cache_index);
var cache_name = self.location.pathname + '/' + uniquifier;
test.add_cleanup(function() {
self.caches.delete(cache_name);
});
return self.caches.delete(cache_name)
.then(function() {
return self.caches.open(cache_name);
});
}
self.create_temporary_cache = create_temporary_cache;
})();
// Runs |test_function| with a temporary unique Cache passed in as the only
// argument. The function is run as a part of Promise chain owned by
// promise_test(). As such, it is expected to behave in a manner identical (with
// the exception of the argument) to a function passed into promise_test().
//
// E.g.:
// cache_test(function(cache) {
// // Do something with |cache|, which is a Cache object.
// }, "Some Cache test");
function cache_test(test_function, description) {
promise_test(function(test) {
return create_temporary_cache(test)
.then(test_function);
}, description);
}

View file

@ -0,0 +1,163 @@
/*
* testharness-helpers contains various useful extensions to testharness.js to
* allow them to be used across multiple tests before they have been
* upstreamed. This file is intended to be usable from both document and worker
* environments, so code should for example not rely on the DOM.
*/
// Returns a promise that fulfills after the provided |promise| is fulfilled.
// The |test| succeeds only if |promise| rejects with an exception matching
// |code|. Accepted values for |code| follow those accepted for assert_throws().
// The optional |description| describes the test being performed.
//
// E.g.:
// assert_promise_rejects(
// new Promise(...), // something that should throw an exception.
// 'NotFoundError',
// 'Should throw NotFoundError.');
//
// assert_promise_rejects(
// new Promise(...),
// new TypeError(),
// 'Should throw TypeError');
function assert_promise_rejects(promise, code, description) {
return promise.then(
function() {
throw 'assert_promise_rejects: ' + description + ' Promise did not reject.';
},
function(e) {
if (code !== undefined) {
assert_throws(code, function() { throw e; }, description);
}
});
}
// Asserts that two objects |actual| and |expected| are weakly equal under the
// following definition:
//
// |a| and |b| are weakly equal if any of the following are true:
// 1. If |a| is not an 'object', and |a| === |b|.
// 2. If |a| is an 'object', and all of the following are true:
// 2.1 |a.p| is weakly equal to |b.p| for all own properties |p| of |a|.
// 2.2 Every own property of |b| is an own property of |a|.
//
// This is a replacement for the the version of assert_object_equals() in
// testharness.js. The latter doesn't handle own properties correctly. I.e. if
// |a.p| is not an own property, it still requires that |b.p| be an own
// property.
//
// Note that |actual| must not contain cyclic references.
self.assert_object_equals = function(actual, expected, description) {
var object_stack = [];
function _is_equal(actual, expected, prefix) {
if (typeof actual !== 'object') {
assert_equals(actual, expected, prefix);
return;
}
assert_true(typeof expected === 'object', prefix);
assert_equals(object_stack.indexOf(actual), -1,
prefix + ' must not contain cyclic references.');
object_stack.push(actual);
Object.getOwnPropertyNames(expected).forEach(function(property) {
assert_own_property(actual, property, prefix);
_is_equal(actual[property], expected[property],
prefix + '.' + property);
});
Object.getOwnPropertyNames(actual).forEach(function(property) {
assert_own_property(expected, property, prefix);
});
object_stack.pop();
}
function _brand(object) {
return Object.prototype.toString.call(object).match(/^\[object (.*)\]$/)[1];
}
_is_equal(actual, expected,
(description ? description + ': ' : '') + _brand(expected));
};
// Equivalent to assert_in_array, but uses a weaker equivalence relation
// (assert_object_equals) than '==='.
function assert_object_in_array(actual, expected_array, description) {
assert_true(expected_array.some(function(element) {
try {
assert_object_equals(actual, element);
return true;
} catch (e) {
return false;
}
}), description);
}
// Assert that the two arrays |actual| and |expected| contain the same set of
// elements as determined by assert_object_equals. The order is not significant.
//
// |expected| is assumed to not contain any duplicates as determined by
// assert_object_equals().
function assert_array_equivalent(actual, expected, description) {
assert_true(Array.isArray(actual), description);
assert_equals(actual.length, expected.length, description);
expected.forEach(function(expected_element) {
// assert_in_array treats the first argument as being 'actual', and the
// second as being 'expected array'. We are switching them around because
// we want to be resilient against the |actual| array containing
// duplicates.
assert_object_in_array(expected_element, actual, description);
});
}
// Asserts that two arrays |actual| and |expected| contain the same set of
// elements as determined by assert_object_equals(). The corresponding elements
// must occupy corresponding indices in their respective arrays.
function assert_array_objects_equals(actual, expected, description) {
assert_true(Array.isArray(actual), description);
assert_equals(actual.length, expected.length, description);
actual.forEach(function(value, index) {
assert_object_equals(value, expected[index],
description + ' : object[' + index + ']');
});
}
// Asserts that |object| that is an instance of some interface has the attribute
// |attribute_name| following the conditions specified by WebIDL, but it's
// acceptable that the attribute |attribute_name| is an own property of the
// object because we're in the middle of moving the attribute to a prototype
// chain. Once we complete the transition to prototype chains,
// assert_will_be_idl_attribute must be replaced with assert_idl_attribute
// defined in testharness.js.
//
// FIXME: Remove assert_will_be_idl_attribute once we complete the transition
// of moving the DOM attributes to prototype chains. (http://crbug.com/43394)
function assert_will_be_idl_attribute(object, attribute_name, description) {
assert_true(typeof object === "object", description);
assert_true("hasOwnProperty" in object, description);
// Do not test if |attribute_name| is not an own property because
// |attribute_name| is in the middle of the transition to a prototype
// chain. (http://crbug.com/43394)
assert_true(attribute_name in object, description);
}
// Stringifies a DOM object. This function stringifies not only own properties
// but also DOM attributes which are on a prototype chain. Note that
// JSON.stringify only stringifies own properties.
function stringifyDOMObject(object)
{
function deepCopy(src) {
if (typeof src != "object")
return src;
var dst = Array.isArray(src) ? [] : {};
for (var property in src) {
dst[property] = deepCopy(src[property]);
}
return dst;
}
return JSON.stringify(deepCopy(object));
}

View file

@ -0,0 +1,145 @@
if (self.importScripts) {
importScripts('/resources/testharness.js');
importScripts('../resources/testharness-helpers.js');
importScripts('../resources/test-helpers.js');
}
cache_test(function(cache) {
return assert_promise_rejects(
cache.add(),
new TypeError(),
'Cache.add should throw a TypeError when no arguments are given.');
}, 'Cache.add called with no arguments');
cache_test(function(cache) {
return cache.add('../resources/simple.txt')
.then(function(result) {
assert_equals(result, undefined,
'Cache.add should resolve with undefined on success.');
});
}, 'Cache.add called with relative URL specified as a string');
cache_test(function(cache) {
return assert_promise_rejects(
cache.add('javascript://this-is-not-http-mmkay'),
'NetworkError',
'Cache.add should throw a NetworkError for non-HTTP/HTTPS URLs.');
}, 'Cache.add called with non-HTTP/HTTPS URL');
cache_test(function(cache) {
var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'});
return cache.add(request)
.then(function(result) {
assert_equals(result, undefined,
'Cache.add should resolve with undefined on success.');
});
}, 'Cache.add called with Request object');
cache_test(function(cache) {
var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'});
return request.text()
.then(function() {
assert_false(request.bodyUsed);
})
.then(function() {
return cache.add(request);
});
}, 'Cache.add called with Request object with a used body');
cache_test(function(cache) {
var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'});
return cache.add(request)
.then(function(result) {
assert_equals(result, undefined,
'Cache.add should resolve with undefined on success.');
})
.then(function() {
return assert_promise_rejects(
cache.add(request),
new TypeError(),
'Cache.add should throw TypeError if same request is added twice.');
});
}, 'Cache.add called twice with the same Request object');
cache_test(function(cache) {
return cache.add('this-does-not-exist-please-dont-create-it')
.then(function(result) {
assert_equals(result, undefined,
'Cache.add should resolve with undefined on success.');
});
}, 'Cache.add with request that results in a status of 404');
cache_test(function(cache) {
return cache.add('../resources/fetch-status.py?status=500')
.then(function(result) {
assert_equals(result, undefined,
'Cache.add should resolve with undefined on success.');
});
}, 'Cache.add with request that results in a status of 500');
cache_test(function(cache) {
return assert_promise_rejects(
cache.addAll(),
new TypeError(),
'Cache.addAll with no arguments should throw TypeError.');
}, 'Cache.addAll with no arguments');
cache_test(function(cache) {
// Assumes the existence of ../resources/simple.txt and ../resources/blank.html
var urls = ['../resources/simple.txt', undefined, '../resources/blank.html'];
return assert_promise_rejects(
cache.addAll(),
new TypeError(),
'Cache.addAll should throw TypeError for an undefined argument.');
}, 'Cache.addAll with a mix of valid and undefined arguments');
cache_test(function(cache) {
// Assumes the existence of ../resources/simple.txt and ../resources/blank.html
var urls = ['../resources/simple.txt', self.location.href, '../resources/blank.html'];
return cache.addAll(urls)
.then(function(result) {
assert_equals(result, undefined,
'Cache.addAll should resolve with undefined on ' +
'success.');
});
}, 'Cache.addAll with string URL arguments');
cache_test(function(cache) {
// Assumes the existence of ../resources/simple.txt and ../resources/blank.html
var urls = ['../resources/simple.txt', self.location.href, '../resources/blank.html'];
var requests = urls.map(function(url) {
return new Request(url);
});
return cache.addAll(requests)
.then(function(result) {
assert_equals(result, undefined,
'Cache.addAll should resolve with undefined on ' +
'success.');
});
}, 'Cache.addAll with Request arguments');
cache_test(function(cache) {
// Assumes that ../resources/simple.txt and ../resources/blank.html exist. The second
// resource does not.
var urls = ['../resources/simple.txt', 'this-resource-should-not-exist', '../resources/blank.html'];
var requests = urls.map(function(url) {
return new Request(url);
});
return cache.addAll(requests)
.then(function(result) {
assert_equals(result, undefined,
'Cache.addAll should resolve with undefined on ' +
'success.');
});
}, 'Cache.addAll with a mix of succeeding and failing requests');
cache_test(function(cache) {
var request = new Request('../resources/simple.txt');
return assert_promise_rejects(
cache.addAll([request, request]),
new TypeError(),
'Cache.addAll should throw TypeError if the same request is added ' +
'twice.');
}, 'Cache.addAll called with the same Request object specified twice');
done();

View file

@ -0,0 +1,120 @@
if (self.importScripts) {
importScripts('/resources/testharness.js');
importScripts('../resources/testharness-helpers.js');
importScripts('../resources/test-helpers.js');
}
var test_url = 'https://example.com/foo';
// Construct a generic Request object. The URL is |test_url|. All other fields
// are defaults.
function new_test_request() {
return new Request(test_url);
}
// Construct a generic Response object.
function new_test_response() {
return new Response('Hello world!', { status: 200 });
}
cache_test(function(cache) {
return assert_promise_rejects(
cache.delete(),
new TypeError(),
'Cache.delete should reject with a TypeError when called with no ' +
'arguments.');
}, 'Cache.delete with no arguments');
cache_test(function(cache) {
return cache.put(new_test_request(), new_test_response())
.then(function() {
return cache.delete(test_url);
})
.then(function(result) {
assert_true(result,
'Cache.delete should resolve with "true" if an entry ' +
'was successfully deleted.');
return cache.match(test_url);
})
.then(function(result) {
assert_equals(result, undefined,
'Cache.delete should remove matching entries from cache.');
});
}, 'Cache.delete called with a string URL');
cache_test(function(cache) {
var request = new Request(test_url, { method: 'POST', body: 'Abc' });
return cache.put(request.clone(), new_test_response())
.then(function() {
return cache.delete(request);
})
.then(function(result) {
assert_true(result,
'Cache.delete should resolve with "true" if an entry ' +
'was successfully deleted.');
assert_false(request.bodyUsed,
'Cache.delete should not consume request body.');
});
}, 'Cache.delete called with a Request object');
cache_test(function(cache) {
var request = new Request(test_url, { method: 'POST', body: 'Abc' });
return cache.put(request.clone(), new_test_response())
.then(function() {
return request.text();
})
.then(function() {
assert_true(request.bodyUsed,
'[https://fetch.spec.whatwg.org/#body-mixin] ' +
'Request.bodyUsed should be true after text() method ' +
'resolves.');
})
.then(function() {
return cache.delete(request);
})
.then(function(result) {
assert_true(result,
'Cache.delete should resolve with "true" if an entry ' +
'was successfully deleted.');
});
}, 'Cache.delete with a Request object containing used body');
cache_test(function(cache) {
return cache.delete(test_url)
.then(function(result) {
assert_false(result,
'Cache.delete should resolve with "false" if there ' +
'are no matching entries.');
});
}, 'Cache.delete with a non-existent entry');
var cache_entries = {
a: {
request: new Request('http://example.com/abc'),
response: new Response('')
},
b: {
request: new Request('http://example.com/b'),
response: new Response('')
},
a_with_query: {
request: new Request('http://example.com/abc?q=r'),
response: new Response('')
}
};
function prepopulated_cache_test(test_function, description) {
cache_test(function(cache) {
return Promise.all(Object.keys(cache_entries).map(function(k) {
return cache.put(cache_entries[k].request.clone(),
cache_entries[k].response.clone());
}))
.then(function() {
return test_function(cache);
});
}, description);
}
done();

View file

@ -0,0 +1,501 @@
if (self.importScripts) {
importScripts('/resources/testharness.js');
importScripts('../resources/testharness-helpers.js');
importScripts('../resources/test-helpers.js');
}
// A set of Request/Response pairs to be used with prepopulated_cache_test().
var simple_entries = [
{
name: 'a',
request: new Request('http://example.com/a'),
response: new Response('')
},
{
name: 'b',
request: new Request('http://example.com/b'),
response: new Response('')
},
{
name: 'a_with_query',
request: new Request('http://example.com/a?q=r'),
response: new Response('')
},
{
name: 'A',
request: new Request('http://example.com/A'),
response: new Response('')
},
{
name: 'a_https',
request: new Request('https://example.com/a'),
response: new Response('')
},
{
name: 'a_org',
request: new Request('http://example.org/a'),
response: new Response('')
},
{
name: 'cat',
request: new Request('http://example.com/cat'),
response: new Response('')
},
{
name: 'catmandu',
request: new Request('http://example.com/catmandu'),
response: new Response('')
},
{
name: 'cat_num_lives',
request: new Request('http://example.com/cat?lives=9'),
response: new Response('')
},
{
name: 'cat_in_the_hat',
request: new Request('http://example.com/cat/in/the/hat'),
response: new Response('')
},
{
name: 'secret_cat',
request: new Request('http://tom:jerry@example.com/cat'),
response: new Response('')
},
{
name: 'top_secret_cat',
request: new Request('http://tom:j3rry@example.com/cat'),
response: new Response('')
}
];
// A set of Request/Response pairs to be used with prepopulated_cache_test().
// These contain a mix of test cases that use Vary headers.
var vary_entries = [
{
name: 'vary_cookie_is_cookie',
request: new Request('http://example.com/c',
{headers: {'Cookies': 'is-for-cookie'}}),
response: new Response('',
{headers: {'Vary': 'Cookies'}})
},
{
name: 'vary_cookie_is_good',
request: new Request('http://example.com/c',
{headers: {'Cookies': 'is-good-enough-for-me'}}),
response: new Response('',
{headers: {'Vary': 'Cookies'}})
},
{
name: 'vary_cookie_absent',
request: new Request('http://example.com/c'),
response: new Response('',
{headers: {'Vary': 'Cookies'}})
},
{
name: 'vary_wildcard',
request: new Request('http://example.com/c',
{headers: {'Cookies': 'x', 'X-Key': '1'}}),
response: new Response('',
{headers: {'Vary': '*'}})
}
];
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll('not-present-in-the-cache')
.then(function(result) {
assert_array_equivalent(
result, [],
'Cache.matchAll should resolve with an empty array on failure.');
});
}, 'Cache.matchAll with no matching entries');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match('not-present-in-the-cache')
.then(function(result) {
assert_equals(result, undefined,
'Cache.match failures should resolve with undefined.');
});
}, 'Cache.match with no matching entries');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a.request.url)
.then(function(result) {
assert_array_objects_equals(result, [entries.a.response],
'Cache.matchAll should match by URL.');
});
}, 'Cache.matchAll with URL');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.a.request.url)
.then(function(result) {
assert_object_equals(result, entries.a.response,
'Cache.match should match by URL.');
});
}, 'Cache.match with URL');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a.request)
.then(function(result) {
assert_array_objects_equals(
result, [entries.a.response],
'Cache.matchAll should match by Request.');
});
}, 'Cache.matchAll with Request');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.a.request)
.then(function(result) {
assert_object_equals(result, entries.a.response,
'Cache.match should match by Request.');
});
}, 'Cache.match with Request');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(new Request(entries.a.request.url))
.then(function(result) {
assert_array_objects_equals(
result, [entries.a.response],
'Cache.matchAll should match by Request.');
});
}, 'Cache.matchAll with new Request');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(new Request(entries.a.request.url))
.then(function(result) {
assert_object_equals(result, entries.a.response,
'Cache.match should match by Request.');
});
}, 'Cache.match with new Request');
cache_test(function(cache) {
var request = new Request('https://example.com/foo', {
method: 'POST',
body: 'Hello world!'
});
var response = new Response('Booyah!', {
status: 200,
headers: {'Content-Type': 'text/plain'}
});
return cache.put(request.clone(), response.clone())
.then(function() {
assert_false(
request.bodyUsed,
'[https://fetch.spec.whatwg.org/#concept-body-used-flag] ' +
'Request.bodyUsed flag should be initially false.');
})
.then(function() {
return cache.match(request);
})
.then(function(result) {
assert_false(request.bodyUsed,
'Cache.match should not consume Request body.');
});
}, 'Cache.match with Request containing non-empty body');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a.request,
{ignoreSearch: true})
.then(function(result) {
assert_array_equivalent(
result,
[
entries.a.response,
entries.a_with_query.response
],
'Cache.matchAll with ignoreSearch should ignore the ' +
'search parameters of cached request.');
});
},
'Cache.matchAll with ignoreSearch option (request with no search ' +
'parameters)');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.a.request,
{ignoreSearch: true})
.then(function(result) {
assert_object_in_array(
result,
[
entries.a.response,
entries.a_with_query.response
],
'Cache.match with ignoreSearch should ignore the ' +
'search parameters of cached request.');
});
},
'Cache.match with ignoreSearch option (request with no search ' +
'parameters)');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a_with_query.request,
{ignoreSearch: true})
.then(function(result) {
assert_array_equivalent(
result,
[
entries.a.response,
entries.a_with_query.response
],
'Cache.matchAll with ignoreSearch should ignore the ' +
'search parameters of request.');
});
},
'Cache.matchAll with ignoreSearch option (request with search parameter)');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.a_with_query.request,
{ignoreSearch: true})
.then(function(result) {
assert_object_in_array(
result,
[
entries.a.response,
entries.a_with_query.response
],
'Cache.match with ignoreSearch should ignore the ' +
'search parameters of request.');
});
},
'Cache.match with ignoreSearch option (request with search parameter)');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.cat.request.url + '#mouse')
.then(function(result) {
assert_array_equivalent(
result,
[
entries.cat.response,
],
'Cache.matchAll should ignore URL fragment.');
});
}, 'Cache.matchAll with URL containing fragment');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.cat.request.url + '#mouse')
.then(function(result) {
assert_object_equals(result, entries.cat.response,
'Cache.match should ignore URL fragment.');
});
}, 'Cache.match with URL containing fragment');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll('http')
.then(function(result) {
assert_array_equivalent(
result, [],
'Cache.matchAll should treat query as a URL and not ' +
'just a string fragment.');
});
}, 'Cache.matchAll with string fragment "http" as query');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match('http')
.then(function(result) {
assert_equals(
result, undefined,
'Cache.match should treat query as a URL and not ' +
'just a string fragment.');
});
}, 'Cache.match with string fragment "http" as query');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.secret_cat.request.url)
.then(function(result) {
assert_array_equivalent(
result, [entries.secret_cat.response],
'Cache.matchAll should not ignore embedded credentials');
});
}, 'Cache.matchAll with URL containing credentials');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.secret_cat.request.url)
.then(function(result) {
assert_object_equals(
result, entries.secret_cat.response,
'Cache.match should not ignore embedded credentials');
});
}, 'Cache.match with URL containing credentials');
prepopulated_cache_test(vary_entries, function(cache, entries) {
return cache.matchAll('http://example.com/c')
.then(function(result) {
assert_array_equivalent(
result,
[
entries.vary_wildcard.response,
entries.vary_cookie_absent.response
],
'Cache.matchAll should exclude matches if a vary header is ' +
'missing in the query request, but is present in the cached ' +
'request.');
})
.then(function() {
return cache.matchAll(
new Request('http://example.com/c',
{headers: {'Cookies': 'none-of-the-above'}}));
})
.then(function(result) {
assert_array_equivalent(
result,
[
entries.vary_wildcard.response
],
'Cache.matchAll should exclude matches if a vary header is ' +
'missing in the cached request, but is present in the query ' +
'request.');
})
.then(function() {
return cache.matchAll(
new Request('http://example.com/c',
{headers: {'Cookies': 'is-for-cookie'}}));
})
.then(function(result) {
assert_array_equivalent(
result,
[entries.vary_cookie_is_cookie.response],
'Cache.matchAll should match the entire header if a vary header ' +
'is present in both the query and cached requests.');
});
}, 'Cache.matchAll with responses containing "Vary" header');
prepopulated_cache_test(vary_entries, function(cache, entries) {
return cache.match('http://example.com/c')
.then(function(result) {
assert_object_in_array(
result,
[
entries.vary_wildcard.response,
entries.vary_cookie_absent.response
],
'Cache.match should honor "Vary" header.');
});
}, 'Cache.match with responses containing "Vary" header');
prepopulated_cache_test(vary_entries, function(cache, entries) {
return cache.matchAll('http://example.com/c',
{ignoreVary: true})
.then(function(result) {
assert_array_equivalent(
result,
[
entries.vary_cookie_is_cookie.response,
entries.vary_cookie_is_good.response,
entries.vary_cookie_absent.response,
entries.vary_wildcard.response
],
'Cache.matchAll should honor "ignoreVary" parameter.');
});
}, 'Cache.matchAll with "ignoreVary" parameter');
cache_test(function(cache) {
var request = new Request('http://example.com');
var response;
var request_url = new URL('../resources/simple.txt', location.href).href;
return fetch(request_url)
.then(function(fetch_result) {
response = fetch_result;
assert_equals(
response.url, request_url,
'[https://fetch.spec.whatwg.org/#dom-response-url] ' +
'Reponse.url should return the URL of the response.');
return cache.put(request, response.clone());
})
.then(function() {
return cache.match(request.url);
})
.then(function(result) {
assert_object_equals(
result, response,
'Cache.match should return a Response object that has the same ' +
'properties as the stored response.');
return cache.match(response.url);
})
.then(function(result) {
assert_equals(
result, undefined,
'Cache.match should not match cache entry based on response URL.');
});
}, 'Cache.match with Request and Response objects with different URLs');
cache_test(function(cache) {
var request_url = new URL('../resources/simple.txt', location.href).href;
return fetch(request_url)
.then(function(fetch_result) {
return cache.put(new Request(request_url), fetch_result);
})
.then(function() {
return cache.match(request_url);
})
.then(function(result) {
return result.text();
})
.then(function(body_text) {
assert_equals(body_text, 'a simple text file\n',
'Cache.match should return a Response object with a ' +
'valid body.');
})
.then(function() {
return cache.match(request_url);
})
.then(function(result) {
return result.text();
})
.then(function(body_text) {
assert_equals(body_text, 'a simple text file\n',
'Cache.match should return a Response object with a ' +
'valid body each time it is called.');
});
}, 'Cache.match invoked multiple times for the same Request/Response');
// Helpers ---
// Run |test_function| with a Cache object as its only parameter. Prior to the
// call, the Cache is populated by cache entries from |entries|. The latter is
// expected to be an Object mapping arbitrary keys to objects of the form
// {request: <Request object>, response: <Response object>}. There's no
// guarantee on the order in which entries will be added to the cache.
//
// |test_function| should return a Promise that can be used with promise_test.
function prepopulated_cache_test(entries, test_function, description) {
cache_test(function(cache) {
var p = Promise.resolve();
var hash = {};
entries.forEach(function(entry) {
p = p.then(function() {
return cache.put(entry.request.clone(),
entry.response.clone())
.catch(function(e) {
assert_unreached('Test setup failed for entry ' +
entry.name + ': ' + e);
});
});
hash[entry.name] = entry;
});
p = p.then(function() {
assert_equals(Object.keys(hash).length, entries.length);
});
return p.then(function() {
return test_function(cache, hash);
});
}, description);
}
done();

View file

@ -0,0 +1,324 @@
if (self.importScripts) {
importScripts('/resources/testharness.js');
importScripts('../resources/testharness-helpers.js');
importScripts('../resources/test-helpers.js');
}
var test_url = 'https://example.com/foo';
var test_body = 'Hello world!';
cache_test(function(cache) {
var request = new Request(test_url);
var response = new Response(test_body);
return cache.put(request, response)
.then(function(result) {
assert_equals(result, undefined,
'Cache.put should resolve with undefined on success.');
});
}, 'Cache.put called with simple Request and Response');
cache_test(function(cache) {
var test_url = new URL('../resources/simple.txt', location.href).href;
var request = new Request(test_url);
var response;
return fetch(test_url)
.then(function(fetch_result) {
response = fetch_result.clone();
return cache.put(request, fetch_result);
})
.then(function() {
return cache.match(test_url);
})
.then(function(result) {
assert_object_equals(result, response,
'Cache.put should update the cache with ' +
'new request and response.');
return result.text();
})
.then(function(body) {
assert_equals(body, 'a simple text file\n',
'Cache.put should store response body.');
});
}, 'Cache.put called with Request and Response from fetch()');
cache_test(function(cache) {
var request = new Request(test_url);
var response = new Response(test_body);
assert_false(request.bodyUsed,
'[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' +
'Request.bodyUsed should be initially false.');
return cache.put(request, response)
.then(function() {
assert_false(request.bodyUsed,
'Cache.put should not mark empty request\'s body used');
});
}, 'Cache.put with Request without a body');
cache_test(function(cache) {
var request = new Request(test_url);
var response = new Response();
assert_false(response.bodyUsed,
'[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' +
'Response.bodyUsed should be initially false.');
return cache.put(request, response)
.then(function() {
assert_false(response.bodyUsed,
'Cache.put should not mark empty response\'s body used');
});
}, 'Cache.put with Response without a body');
cache_test(function(cache) {
var request = new Request(test_url, {
method: 'POST',
body: 'Hello'
});
var response = new Response(test_body);
assert_false(request.bodyUsed,
'[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' +
'Request.bodyUsed should be initially false.');
return cache.put(request, response.clone())
.then(function() {
assert_true(request.bodyUsed,
'Cache.put should consume Request body.');
})
.then(function() {
return cache.match(request);
})
.then(function(result) {
assert_object_equals(result, response,
'Cache.put should store response body.');
});
}, 'Cache.put with Request containing a body');
cache_test(function(cache) {
var request = new Request(test_url);
var response = new Response(test_body);
return cache.put(request, response.clone())
.then(function() {
return cache.match(test_url);
})
.then(function(result) {
assert_object_equals(result, response,
'Cache.put should update the cache with ' +
'new Request and Response.');
});
}, 'Cache.put with a Response containing an empty URL');
cache_test(function(cache) {
var request = new Request(test_url);
var response = new Response('', {
status: 200,
headers: [['Content-Type', 'text/plain']]
});
return cache.put(request, response)
.then(function() {
return cache.match(test_url);
})
.then(function(result) {
assert_equals(result.status, 200, 'Cache.put should store status.');
assert_equals(result.headers.get('Content-Type'), 'text/plain',
'Cache.put should store headers.');
return result.text();
})
.then(function(body) {
assert_equals(body, '',
'Cache.put should store response body.');
});
}, 'Cache.put with an empty response body');
cache_test(function(cache) {
var test_url = new URL('../resources/fetch-status.py?status=500', location.href).href;
var request = new Request(test_url);
var response;
return fetch(test_url)
.then(function(fetch_result) {
assert_equals(fetch_result.status, 500,
'Test framework error: The status code should be 500.');
response = fetch_result.clone();
return cache.put(request, fetch_result);
})
.then(function() {
return cache.match(test_url);
})
.then(function(result) {
assert_object_equals(result, response,
'Cache.put should update the cache with ' +
'new request and response.');
return result.text();
})
.then(function(body) {
assert_equals(body, '',
'Cache.put should store response body.');
});
}, 'Cache.put with HTTP 500 response');
cache_test(function(cache) {
var alternate_response_body = 'New body';
var alternate_response = new Response(alternate_response_body,
{ statusText: 'New status' });
return cache.put(new Request(test_url),
new Response('Old body', { statusText: 'Old status' }))
.then(function() {
return cache.put(new Request(test_url), alternate_response.clone());
})
.then(function() {
return cache.match(test_url);
})
.then(function(result) {
assert_object_equals(result, alternate_response,
'Cache.put should replace existing ' +
'response with new response.');
return result.text();
})
.then(function(body) {
assert_equals(body, alternate_response_body,
'Cache put should store new response body.');
});
}, 'Cache.put called twice with matching Requests and different Responses');
cache_test(function(cache) {
var first_url = test_url;
var second_url = first_url + '#(O_o)';
var alternate_response_body = 'New body';
var alternate_response = new Response(alternate_response_body,
{ statusText: 'New status' });
return cache.put(new Request(first_url),
new Response('Old body', { statusText: 'Old status' }))
.then(function() {
return cache.put(new Request(second_url), alternate_response.clone());
})
.then(function() {
return cache.match(test_url);
})
.then(function(result) {
assert_object_equals(result, alternate_response,
'Cache.put should replace existing ' +
'response with new response.');
return result.text();
})
.then(function(body) {
assert_equals(body, alternate_response_body,
'Cache put should store new response body.');
});
}, 'Cache.put called twice with request URLs that differ only by a fragment');
cache_test(function(cache) {
var entries = {
dark: {
url: 'http://darkhelmet:12345@example.com/spaceballs',
body: 'Moranis'
},
skroob: {
url: 'http://skroob:12345@example.com/spaceballs',
body: 'Brooks'
},
control: {
url: 'http://example.com/spaceballs',
body: 'v(o.o)v'
}
};
return Promise.all(Object.keys(entries).map(function(key) {
return cache.put(new Request(entries[key].url),
new Response(entries[key].body));
}))
.then(function() {
return Promise.all(Object.keys(entries).map(function(key) {
return cache.match(entries[key].url)
.then(function(result) {
return result.text();
})
.then(function(body) {
assert_equals(body, entries[key].body,
'Cache put should store response body.');
});
}));
});
}, 'Cache.put with request URLs containing embedded credentials');
cache_test(function(cache) {
var url = 'http://example.com/foo';
return cache.put(url, new Response('some body'))
.then(function() { return cache.match(url); })
.then(function(response) { return response.text(); })
.then(function(body) {
assert_equals(body, 'some body',
'Cache.put should accept a string as request.');
});
}, 'Cache.put with a string request');
cache_test(function(cache) {
return assert_promise_rejects(
cache.put(new Request(test_url), 'Hello world!'),
new TypeError(),
'Cache.put should only accept a Response object as the response.');
}, 'Cache.put with an invalid response');
cache_test(function(cache) {
return assert_promise_rejects(
cache.put(new Request('file:///etc/passwd'),
new Response(test_body)),
new TypeError(),
'Cache.put should reject non-HTTP/HTTPS requests with a TypeError.');
}, 'Cache.put with a non-HTTP/HTTPS request');
cache_test(function(cache) {
var response = new Response(test_body);
return cache.put(new Request('relative-url'), response.clone())
.then(function() {
return cache.match(new URL('relative-url', location.href).href);
})
.then(function(result) {
assert_object_equals(result, response,
'Cache.put should accept a relative URL ' +
'as the request.');
});
}, 'Cache.put with a relative URL');
cache_test(function(cache) {
var request = new Request('http://example.com/foo', { method: 'HEAD' });
return assert_promise_rejects(
cache.put(request, new Response(test_body)),
new TypeError(),
'Cache.put should throw a TypeError for non-GET requests.');
}, 'Cache.put with a non-GET request');
cache_test(function(cache) {
return assert_promise_rejects(
cache.put(new Request(test_url), null),
new TypeError(),
'Cache.put should throw a TypeError for a null response.');
}, 'Cache.put with a null response');
cache_test(function(cache) {
var request = new Request(test_url, {method: 'POST', body: test_body});
assert_false(request.bodyUsed,
'[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' +
'Request.bodyUsed should be initially false.');
var copy = new Request(request);
assert_true(request.bodyUsed,
'[https://fetch.spec.whatwg.org/#dom-request] ' +
'Request constructor should set input\'s used flag.');
return assert_promise_rejects(
cache.put(request, new Response(test_body)),
new TypeError(),
'Cache.put should throw a TypeError for a request with used body.');
}, 'Cache.put with a used request body');
cache_test(function(cache) {
var response = new Response(test_body);
assert_false(response.bodyUsed,
'[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' +
'Response.bodyUsed should be initially false.');
return response.text().then(function() {
assert_false(
response.bodyUsed,
'[https://fetch.spec.whatwg.org/#concept-body-consume-body] ' +
'The text() method should not set "body passed" flag.');
return cache.put(new Request(test_url), response);
});
}, 'Cache.put with a used response body');
done();

View file

@ -0,0 +1,36 @@
if (self.importScripts) {
importScripts('/resources/testharness.js');
importScripts('../resources/testharness-helpers.js');
importScripts('../resources/test-helpers.js');
}
var test_cache_list =
['', 'example', 'Another cache name', 'A', 'a', 'ex ample'];
promise_test(function(test) {
return self.caches.keys()
.then(function(keys) {
assert_true(Array.isArray(keys),
'CacheStorage.keys should return an Array.');
return Promise.all(keys.map(function(key) {
return self.caches.delete(key);
}));
})
.then(function() {
return Promise.all(test_cache_list.map(function(key) {
return self.caches.open(key);
}));
})
.then(function() { return self.caches.keys(); })
.then(function(keys) {
assert_true(Array.isArray(keys),
'CacheStorage.keys should return an Array.');
assert_array_equals(keys,
test_cache_list,
'CacheStorage.keys should only return ' +
'existing caches.');
});
}, 'CacheStorage keys');
done();

View file

@ -0,0 +1,123 @@
if (self.importScripts) {
importScripts('/resources/testharness.js');
importScripts('../resources/testharness-helpers.js');
importScripts('../resources/test-helpers.js');
}
(function() {
var next_index = 1;
// Returns a transaction (request, response, and url) for a unique URL.
function create_unique_transaction(test) {
var uniquifier = String(next_index++);
var url = 'http://example.com/' + uniquifier;
return {
request: new Request(url),
response: new Response('hello'),
url: url
};
}
self.create_unique_transaction = create_unique_transaction;
})();
cache_test(function(cache) {
var transaction = create_unique_transaction();
return cache.put(transaction.request.clone(), transaction.response.clone())
.then(function() {
return self.caches.match(transaction.request);
})
.then(function(response) {
assert_object_equals(response, transaction.response,
'The response should not have changed.');
});
}, 'CacheStorageMatch with no cache name provided');
cache_test(function(cache) {
var transaction = create_unique_transaction();
var test_cache_list = ['a', 'b', 'c'];
return cache.put(transaction.request.clone(), transaction.response.clone())
.then(function() {
return Promise.all(test_cache_list.map(function(key) {
return self.caches.open(key);
}));
})
.then(function() {
return self.caches.match(transaction.request);
})
.then(function(response) {
assert_object_equals(response, transaction.response,
'The response should not have changed.');
});
}, 'CacheStorageMatch from one of many caches');
promise_test(function(test) {
var transaction = create_unique_transaction();
var test_cache_list = ['x', 'y', 'z'];
return Promise.all(test_cache_list.map(function(key) {
return self.caches.open(key);
}))
.then(function() { return caches.open('x'); })
.then(function(cache) {
return cache.put(transaction.request.clone(),
transaction.response.clone());
})
.then(function() {
return self.caches.match(transaction.request, {cacheName: 'x'});
})
.then(function(response) {
assert_object_equals(response, transaction.response,
'The response should not have changed.');
})
.then(function() {
return self.caches.match(transaction.request, {cacheName: 'y'});
})
.then(function(response) {
assert_equals(response, undefined,
'Cache y should not have a response for the request.');
});
}, 'CacheStorageMatch from one of many caches by name');
cache_test(function(cache) {
var transaction = create_unique_transaction();
return cache.put(transaction.url, transaction.response.clone())
.then(function() {
return self.caches.match(transaction.request);
})
.then(function(response) {
assert_object_equals(response, transaction.response,
'The response should not have changed.');
});
}, 'CacheStorageMatch a string request');
promise_test(function(test) {
var transaction = create_unique_transaction();
return self.caches.match(transaction.request)
.then(function(response) {
assert_equals(response, undefined,
'The response should not be found.');
})
}, 'CacheStorageMatch with no cached entry');
promise_test(function(test) {
var transaction = create_unique_transaction();
return self.caches.has('foo')
.then(function(has_foo) {
assert_false(has_foo, "The cache should not exist.");
return self.caches.match(transaction.request, {cacheName: 'foo'});
})
.then(function(response) {
assert_equals(response, undefined,
'The response should not be found.');
return self.caches.has('foo');
})
.then(function(has_foo) {
assert_false(has_foo, "The cache should still not exist.");
})
}, 'CacheStorageMatch with no caches available but name provided');
done();

View file

@ -0,0 +1,192 @@
if (self.importScripts) {
importScripts('/resources/testharness.js');
importScripts('../resources/testharness-helpers.js');
importScripts('../resources/test-helpers.js');
}
promise_test(function(t) {
var cache_name = 'cache-storage/foo';
return self.caches.delete(cache_name)
.then(function() {
return self.caches.open(cache_name);
})
.then(function(cache) {
assert_true(cache instanceof Cache,
'CacheStorage.open should return a Cache.');
});
}, 'CacheStorage.open');
promise_test(function(t) {
// Note that this test may collide with other tests running in the same
// origin that also uses an empty cache name.
var cache_name = '';
return self.caches.delete(cache_name)
.then(function() {
return self.caches.open(cache_name);
})
.then(function(cache) {
assert_true(cache instanceof Cache,
'CacheStorage.open should accept an empty name.');
});
}, 'CacheStorage.open with an empty name');
promise_test(function(t) {
return assert_promise_rejects(
self.caches.open(),
new TypeError(),
'CacheStorage.open should throw TypeError if called with no arguments.');
}, 'CacheStorage.open with no arguments');
promise_test(function(t) {
var test_cases = [
{
name: 'cache-storage/lowercase',
should_not_match:
[
'cache-storage/Lowercase',
' cache-storage/lowercase',
'cache-storage/lowercase '
]
},
{
name: 'cache-storage/has a space',
should_not_match:
[
'cache-storage/has'
]
},
{
name: 'cache-storage/has\000_in_the_name',
should_not_match:
[
'cache-storage/has',
'cache-storage/has_in_the_name'
]
}
];
return Promise.all(test_cases.map(function(testcase) {
var cache_name = testcase.name;
return self.caches.delete(cache_name)
.then(function() {
return self.caches.open(cache_name);
})
.then(function() {
return self.caches.has(cache_name);
})
.then(function(result) {
assert_true(result,
'CacheStorage.has should return true for existing ' +
'cache.');
})
.then(function() {
return Promise.all(
testcase.should_not_match.map(function(cache_name) {
return self.caches.has(cache_name)
.then(function(result) {
assert_false(result,
'CacheStorage.has should only perform ' +
'exact matches on cache names.');
});
}));
})
.then(function() {
return self.caches.delete(cache_name);
});
}));
}, 'CacheStorage.has with existing cache');
promise_test(function(t) {
return self.caches.has('cheezburger')
.then(function(result) {
assert_false(result,
'CacheStorage.has should return false for ' +
'nonexistent cache.');
});
}, 'CacheStorage.has with nonexistent cache');
promise_test(function(t) {
var cache_name = 'cache-storage/open';
var cache;
return self.caches.delete(cache_name)
.then(function() {
return self.caches.open(cache_name);
})
.then(function(result) {
cache = result;
})
.then(function() {
return self.caches.open(cache_name);
})
.then(function(result) {
assert_equals(result, cache,
'CacheStorage.open should return the named Cache ' +
'object if it exists.');
})
.then(function() {
return self.caches.open(cache_name);
})
.then(function(result) {
assert_equals(result, cache,
'CacheStorage.open should return the same ' +
'instance of an existing Cache object.');
});
}, 'CacheStorage.open with existing cache');
promise_test(function(t) {
var cache_name = 'cache-storage/delete';
return self.caches.delete(cache_name)
.then(function() {
return self.caches.open(cache_name);
})
.then(function() { return self.caches.delete(cache_name); })
.then(function(result) {
assert_true(result,
'CacheStorage.delete should return true after ' +
'deleting an existing cache.');
})
.then(function() { return self.caches.has(cache_name); })
.then(function(cache_exists) {
assert_false(cache_exists,
'CacheStorage.has should return false after ' +
'fulfillment of CacheStorage.delete promise.');
});
}, 'CacheStorage.delete with existing cache');
promise_test(function(t) {
return self.caches.delete('cheezburger')
.then(function(result) {
assert_false(result,
'CacheStorage.delete should return false for a ' +
'nonexistent cache.');
});
}, 'CacheStorage.delete with nonexistent cache');
promise_test(function(t) {
var bad_name = 'unpaired\uD800';
var converted_name = 'unpaired\uFFFD'; // Don't create cache with this name.
return self.caches.has(converted_name)
.then(function(cache_exists) {
assert_false(cache_exists,
'Test setup failure: cache should not exist');
})
.then(function() { return self.caches.open(bad_name); })
.then(function() { return self.caches.keys(); })
.then(function(keys) {
assert_true(keys.indexOf(bad_name) !== -1,
'keys should include cache with bad name');
})
.then(function() { return self.caches.has(bad_name); })
.then(function(cache_exists) {
assert_true(cache_exists,
'CacheStorage names should be not be converted.');
})
.then(function() { return self.caches.has(converted_name); })
.then(function(cache_exists) {
assert_false(cache_exists,
'CacheStorage names should be not be converted.');
});
}, 'CacheStorage names are DOMStrings not USVStrings');
done();

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<title>Cache.add and Cache.addAll</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-add">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../service-workers/resources/test-helpers.js"></script>
<script>
service_worker_test('../script-tests/cache-add.js');
</script>

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<title>Cache.delete</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-delete">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../service-workers/resources/test-helpers.js"></script>
<script>
service_worker_test('../script-tests/cache-delete.js');
</script>

View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<title>Cache.match and Cache.matchAll</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-match">
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../service-workers/resources/test-helpers.js"></script>
<script>
service_worker_test('../script-tests/cache-match.js');
</script>

View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<title>Cache.put</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-put">
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../service-workers/resources/test-helpers.js"></script>
<script>
service_worker_test('../script-tests/cache-put.js');
</script>

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<title>CacheStorage.keys</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-storage">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../service-workers/resources/test-helpers.js"></script>
<script>
service_worker_test('../script-tests/cache-storage-keys.js');
</script>

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<title>CacheStorage.match</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-storage-match">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../service-workers/resources/test-helpers.js"></script>
<script>
service_worker_test('../script-tests/cache-storage-match.js');
</script>

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<title>CacheStorage</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-storage">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../service-workers/resources/test-helpers.js"></script>
<script>
service_worker_test('../script-tests/cache-storage.js');
</script>

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<title>Cache Storage: Cache.add and Cache.addAll</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-add">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/testharness-helpers.js"></script>
<script src="../resources/test-helpers.js"></script>
<script src="../script-tests/cache-add.js"></script>

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<title>Cache Storage: Cache.delete</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-delete">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/testharness-helpers.js"></script>
<script src="../resources/test-helpers.js"></script>
<script src="../script-tests/cache-delete.js"></script>

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<title>Cache Storage: Cache.match and Cache.matchAll</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-match">
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/testharness-helpers.js"></script>
<script src="../resources/test-helpers.js"></script>
<script src="../script-tests/cache-match.js"></script>

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<title>Cache Storage: Cache.put</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-put">
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/testharness-helpers.js"></script>
<script src="../resources/test-helpers.js"></script>
<script src="../script-tests/cache-put.js"></script>

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<title>Cache Storage: CacheStorage.keys</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-storage">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/testharness-helpers.js"></script>
<script src="../resources/test-helpers.js"></script>
<script src="../script-tests/cache-storage-keys.js"></script>

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<title>Cache Storage: CacheStorage.match</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-storage-match">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/testharness-helpers.js"></script>
<script src="../resources/test-helpers.js"></script>
<script src="../script-tests/cache-storage-match.js"></script>

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<title>Cache Storage: CacheStorage</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-storage">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/testharness-helpers.js"></script>
<script src="../resources/test-helpers.js"></script>
<script src="../script-tests/cache-storage.js"></script>

View file

@ -0,0 +1,66 @@
<!DOCTYPE html>
<title>Cache Storage: Verify access in sandboxed iframes</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-storage">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/testharness-helpers.js"></script>
<script>
function load_iframe(src, sandbox) {
return new Promise(function(resolve, reject) {
var iframe = document.createElement('iframe');
iframe.onload = function() { resolve(iframe); };
iframe.sandbox = sandbox;
iframe.src = src;
document.documentElement.appendChild(iframe);
});
}
function wait_for_message(id) {
return new Promise(function(resolve) {
self.addEventListener('message', function listener(e) {
if (e.data.id === id) {
resolve(e.data);
self.removeEventListener(listener);
}
});
});
}
var counter = 0;
promise_test(function(t) {
return load_iframe('../resources/iframe.html',
'allow-scripts allow-same-origin')
.then(function(iframe) {
var id = ++counter;
iframe.contentWindow.postMessage({id: id}, '*');
return wait_for_message(id);
})
.then(function(message) {
assert_equals(
message.result, 'allowed',
'Access should be allowed if sandbox has allow-same-origin');
});
}, 'Sandboxed iframe with allow-same-origin is allowed access');
promise_test(function(t) {
return load_iframe('../resources/iframe.html',
'allow-scripts')
.then(function(iframe) {
var id = ++counter;
iframe.contentWindow.postMessage({id: id}, '*');
return wait_for_message(id);
})
.then(function(message) {
assert_equals(
message.result, 'denied',
'Access should be denied if sandbox lacks allow-same-origin');
assert_equals(message.name, 'SecurityError',
'Failure should be a SecurityError');
});
}, 'Sandboxed iframe without allow-same-origin is denied access');
</script>

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<title>Cache.add and Cache.addAll</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-add">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
fetch_tests_from_worker(new Worker('../script-tests/cache-add.js'));
</script>

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<title>Cache.delete</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-delete">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
fetch_tests_from_worker(new Worker('../script-tests/cache-delete.js'));
</script>

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<title>Cache.match and Cache.matchAll</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-match">
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
fetch_tests_from_worker(new Worker('../script-tests/cache-match.js'));
</script>

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<title>Cache.put</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-put">
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
fetch_tests_from_worker(new Worker('../script-tests/cache-put.js'));
</script>

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<title>CacheStorage.keys</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-storage">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
fetch_tests_from_worker(new Worker('../script-tests/cache-storage-keys.js'));
</script>

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<title>CacheStorage.match</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-storage-match">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
fetch_tests_from_worker(new Worker('../script-tests/cache-storage-match.js'));
</script>

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<title>CacheStorage</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-storage">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
fetch_tests_from_worker(new Worker('../script-tests/cache-storage.js'));
</script>

View file

@ -0,0 +1,222 @@
// Adapter for testharness.js-style tests with Service Workers
function service_worker_unregister_and_register(test, url, scope) {
if (!scope || scope.length == 0)
return Promise.reject(new Error('tests must define a scope'));
var options = { scope: scope };
return service_worker_unregister(test, scope)
.then(function() {
return navigator.serviceWorker.register(url, options);
})
.catch(unreached_rejection(test,
'unregister and register should not fail'));
}
function service_worker_unregister(test, documentUrl) {
return navigator.serviceWorker.getRegistration(documentUrl)
.then(function(registration) {
if (registration)
return registration.unregister();
})
.catch(unreached_rejection(test, 'unregister should not fail'));
}
function service_worker_unregister_and_done(test, scope) {
return service_worker_unregister(test, scope)
.then(test.done.bind(test));
}
function unreached_fulfillment(test, prefix) {
return test.step_func(function(result) {
var error_prefix = prefix || 'unexpected fulfillment';
assert_unreached(error_prefix + ': ' + result);
});
}
// Rejection-specific helper that provides more details
function unreached_rejection(test, prefix) {
return test.step_func(function(error) {
var reason = error.message || error.name || error;
var error_prefix = prefix || 'unexpected rejection';
assert_unreached(error_prefix + ': ' + reason);
});
}
// Adds an iframe to the document and returns a promise that resolves to the
// iframe when it finishes loading. The caller is responsible for removing the
// iframe later if needed.
function with_iframe(url) {
return new Promise(function(resolve) {
var frame = document.createElement('iframe');
frame.src = url;
frame.onload = function() { resolve(frame); };
document.body.appendChild(frame);
});
}
function normalizeURL(url) {
return new URL(url, self.location).toString().replace(/#.*$/, '');
}
function wait_for_update(test, registration) {
if (!registration || registration.unregister == undefined) {
return Promise.reject(new Error(
'wait_for_update must be passed a ServiceWorkerRegistration'));
}
return new Promise(test.step_func(function(resolve) {
registration.addEventListener('updatefound', test.step_func(function() {
resolve(registration.installing);
}));
}));
}
function wait_for_state(test, worker, state) {
if (!worker || worker.state == undefined) {
return Promise.reject(new Error(
'wait_for_state must be passed a ServiceWorker'));
}
if (worker.state === state)
return Promise.resolve(state);
if (state === 'installing') {
switch (worker.state) {
case 'installed':
case 'activating':
case 'activated':
case 'redundant':
return Promise.reject(new Error(
'worker is ' + worker.state + ' but waiting for ' + state));
}
}
if (state === 'installed') {
switch (worker.state) {
case 'activating':
case 'activated':
case 'redundant':
return Promise.reject(new Error(
'worker is ' + worker.state + ' but waiting for ' + state));
}
}
if (state === 'activating') {
switch (worker.state) {
case 'activated':
case 'redundant':
return Promise.reject(new Error(
'worker is ' + worker.state + ' but waiting for ' + state));
}
}
if (state === 'activated') {
switch (worker.state) {
case 'redundant':
return Promise.reject(new Error(
'worker is ' + worker.state + ' but waiting for ' + state));
}
}
return new Promise(test.step_func(function(resolve) {
worker.addEventListener('statechange', test.step_func(function() {
if (worker.state === state)
resolve(state);
}));
}));
}
// Declare a test that runs entirely in the ServiceWorkerGlobalScope. The |url|
// is the service worker script URL. This function:
// - Instantiates a new test with the description specified in |description|.
// The test will succeed if the specified service worker can be successfully
// registered and installed.
// - Creates a new ServiceWorker registration with a scope unique to the current
// document URL. Note that this doesn't allow more than one
// service_worker_test() to be run from the same document.
// - Waits for the new worker to begin installing.
// - Imports tests results from tests running inside the ServiceWorker.
function service_worker_test(url, description) {
// If the document URL is https://example.com/document and the script URL is
// https://example.com/script/worker.js, then the scope would be
// https://example.com/script/scope/document.
var scope = new URL('scope' + window.location.pathname,
new URL(url, window.location)).toString();
promise_test(function(test) {
return service_worker_unregister_and_register(test, url, scope)
.then(function(registration) {
add_completion_callback(function() {
registration.unregister();
});
return wait_for_update(test, registration)
.then(function(worker) {
return fetch_tests_from_worker(worker);
});
});
}, description);
}
function get_host_info() {
var ORIGINAL_HOST = '127.0.0.1';
var REMOTE_HOST = 'localhost';
var UNAUTHENTICATED_HOST = 'example.test';
var HTTP_PORT = 8000;
var HTTPS_PORT = 8443;
try {
// In W3C test, we can get the hostname and port number in config.json
// using wptserve's built-in pipe.
// http://wptserve.readthedocs.org/en/latest/pipes.html#built-in-pipes
HTTP_PORT = eval('{{ports[http][0]}}');
HTTPS_PORT = eval('{{ports[https][0]}}');
ORIGINAL_HOST = eval('\'{{host}}\'');
REMOTE_HOST = 'www1.' + ORIGINAL_HOST;
} catch (e) {
}
return {
HTTP_ORIGIN: 'http://' + ORIGINAL_HOST + ':' + HTTP_PORT,
HTTPS_ORIGIN: 'https://' + ORIGINAL_HOST + ':' + HTTPS_PORT,
HTTP_REMOTE_ORIGIN: 'http://' + REMOTE_HOST + ':' + HTTP_PORT,
HTTPS_REMOTE_ORIGIN: 'https://' + REMOTE_HOST + ':' + HTTPS_PORT,
UNAUTHENTICATED_ORIGIN: 'http://' + UNAUTHENTICATED_HOST + ':' + HTTP_PORT
};
}
function base_path() {
return location.pathname.replace(/\/[^\/]*$/, '/');
}
function test_login(test, origin, username, password, cookie) {
return new Promise(function(resolve, reject) {
with_iframe(
origin +
'/serviceworker/resources/fetch-access-control-login.html')
.then(test.step_func(function(frame) {
var channel = new MessageChannel();
channel.port1.onmessage = test.step_func(function() {
frame.remove();
resolve();
});
frame.contentWindow.postMessage(
{username: username, password: password, cookie: cookie},
origin, [channel.port2]);
}));
});
}
function login(test) {
return test_login(test, 'http://127.0.0.1:8000',
'username1', 'password1', 'cookie1')
.then(function() {
return test_login(test, 'http://localhost:8000',
'username2', 'password2', 'cookie2');
});
}
function login_https(test) {
return test_login(test, 'https://127.0.0.1:8443',
'username1s', 'password1s', 'cookie1')
.then(function() {
return test_login(test, 'https://localhost:8443',
'username2s', 'password2s', 'cookie2');
});
}

View file

@ -0,0 +1,204 @@
import os
import re
import shutil
import glob
import tempfile
import sys
from collections import defaultdict
here = os.path.abspath(os.path.split(__file__)[0])
def get_extra_files(chromium_root):
return [(os.path.join(chromium_root, "LayoutTests", "http", "tests", "resources", "testharness-helpers.js"),
os.path.join("resources", "testharness-helpers.js"))]
resources_re = re.compile("/?(?:\.\./)*resources/(testharness(?:report)?)\.js")
def resources_path(line, depth):
return False, resources_re.sub(r"/resources/\1.js", line)
php_re = re.compile("\.php")
def python_to_php(line, depth):
return False, php_re.sub(".py", line)
abs_testharness_helpers_re = re.compile("([\"'])/resources/testharness-helpers.js")
testharness_helpers_re = re.compile("\.\./((?:\.\./)*)resources/testharness-helpers.js")
def testharness_helpers(line, depth):
if abs_testharness_helpers_re.findall(line):
return False, abs_testharness_helpers_re.sub(r"\1%sresources/testharness-helpers.js" % ("../" * (depth - 1)), line)
return False, testharness_helpers_re.sub(r"\1resources/testharness-helpers.js", line)
serviceworker_path_re = re.compile("/serviceworker/")
def service_worker_path(line, depth):
return False, serviceworker_path_re.sub("/service-workers/", line)
localhost_re = re.compile("localhost")
alt_host_re = re.compile("127\.0\.0\.1")
port_http_re = re.compile("8000")
port_https_re = re.compile("8000")
def server_names(line, depth):
line, count_0 = localhost_re.subn("{{host}}", line)
line, count_1 = alt_host_re.subn("{{domains[www]}}", line)
line, count_2 = port_http_re.subn("{{ports[http][0]}}", line)
line, count_3 = port_https_re.subn("{{ports[https][0]}}", line)
count = count_0 + count_1 + count_2 + count_3
return bool(count), line
def source_paths(chromium_root):
for dirpath, dirnames, filenames in os.walk(chromium_root):
if "chromium" in dirnames:
dirnames.remove("chromium")
for filename in filenames:
if filename.endswith("-expected.txt") or filename.endswith(".php"):
continue
yield os.path.relpath(os.path.join(dirpath, filename), chromium_root)
def do_subs(path, line):
depth = len(os.path.split(os.path.sep))
subs = [resources_path, python_to_php, testharness_helpers, service_worker_path, server_names]
file_is_template = False
for sub in subs:
added_template, line = sub(line, depth)
if added_template:
file_is_template = True
return file_is_template, line
def get_head(git):
return git("rev-parse", "HEAD")
def get_changes(git, path, old, new):
data = git("diff", "--name-status", "-z", "--no-renames", "%s..%s" % (old, new), "--", path)
items = data.split("\0")
rv = defaultdict(list)
for status, path in items:
rv[status].append(path)
return rv
def copy(src_path, out_dir, rel_path):
dest = os.path.normpath(os.path.join(out_dir, rel_path))
dest_dir = os.path.split(dest)[0]
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)
shutil.copy2(src_path, dest)
def copy_local_files(local_files, out_root, tmp_dir):
for path in local_files:
rel_path = os.path.relpath(path, out_root)
copy(path, tmp_dir, rel_path)
def copy_extra_files(chromium_root, tmp_dir):
for in_path, rel_path in get_extra_files(chromium_root):
copy(in_path, tmp_dir, rel_path)
def sub_changed_filenames(filename_changes, f):
rv = []
for line in f:
for in_name, out_name in filename_changes.iteritems():
line = line.replace(in_name, out_name)
rv.append(line)
return "".join(rv)
testharness_re = re.compile("<script[^>]*src=[\"']?/resources/testharness.js[\"' ][^>]*>")
def is_top_level_test(path, data):
if os.path.splitext(path)[1] != ".html":
return False
for line in data:
if testharness_re.findall(line):
return True
return False
def add_suffix(path, suffix):
root, ext = os.path.splitext(path)
return root + ".%s" % suffix + ext
def main():
if "--cache-tests" in sys.argv:
sw_path = os.path.join("LayoutTests", "http", "tests", "cachestorage")
out_root = os.path.abspath(os.path.join(here, "..", "cache-storage"))
elif "--sw-tests" in sys.argv:
sw_path = os.path.join("LayoutTests", "http", "tests", "serviceworkers")
out_root = os.path.abspath(os.path.join(here, "..", "service-worker"))
else:
raise ValueError("Must supply either --cache-tests or --sw-tests")
chromium_root = os.path.abspath(sys.argv[1])
work_path = tempfile.mkdtemp()
test_path = os.path.join(chromium_root, sw_path)
local_files = glob.glob(os.path.normpath(os.path.join(here, "..", "resources", "*.py")))
if not os.path.exists(out_root):
os.mkdir(out_root)
copy_local_files(local_files, out_root, work_path)
copy_extra_files(chromium_root, work_path)
path_changes = {}
for path in source_paths(test_path):
out_path = os.path.join(work_path, path)
out_dir = os.path.dirname(out_path)
if not os.path.exists(out_dir):
os.makedirs(out_dir)
with open(os.path.join(test_path, path)) as in_f:
data = []
sub = False
for line in in_f:
sub_flag, output_line = do_subs(path, line)
data.append(output_line)
if sub_flag:
sub = True
is_test = is_top_level_test(out_path, data)
initial_path = out_path
if is_test:
path_1 = add_suffix(out_path, "https")
else:
path_1 = out_path
if sub:
path_2 = add_suffix(out_path, "sub")
else:
path_2 = path_1
if path_2 != initial_path:
path_changes[initial_path] = path_2
with open(path_2, "w") as out_f:
out_f.write("".join(data))
filename_changes = {}
for k, v in path_changes.iteritems():
if os.path.basename(k) in filename_changes:
print "Got duplicate name:" + os.path.basename(k)
filename_changes[os.path.basename(k)] = os.path.basename(v)
for path in source_paths(work_path):
full_path = os.path.join(work_path, path)
with open(full_path) as f:
data = sub_changed_filenames(filename_changes, f)
with open(full_path, "w") as f:
f.write(data)
for dirpath, dirnames, filenames in os.walk(work_path):
for filename in filenames:
in_path = os.path.join(dirpath, filename)
rel_path = os.path.relpath(in_path, work_path)
copy(in_path, out_root, rel_path)
if __name__ == "__main__":
main()

View file

@ -46,6 +46,18 @@ class SourceFile(object):
self.meta_flags = self.name.split(".")[1:]
def __getstate__(self):
# Remove computed properties if we pickle this class
rv = self.__dict__.copy()
if "__cached_properties__" in rv:
cached_properties = rv["__cached_properties__"]
for key in rv.keys():
if key in cached_properties:
del rv[key]
del rv["__cached_properties__"]
return rv
def name_prefix(self, prefix):
"""Check if the filename starts with a given prefix

View file

@ -40,4 +40,5 @@ class cached_property(object):
if self.name not in obj.__dict__:
obj.__dict__[self.name] = self.func(obj)
obj.__dict__.setdefault("__cached_properties__", set()).add(self.name)
return obj.__dict__[self.name]

View file

@ -285,7 +285,7 @@ class WebTestRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
if response:
response.set_error(500, err)
response.write()
logger.error(err)
self.logger.error(err)
def get_request_line(self):
try:

View file

@ -14,6 +14,8 @@ async_test(function(t) {
assert_equals(e.wasClean, false, 'e.wasClean = true');
delete e.wasClean;
assert_equals(e.wasClean, false, 'delete e.wasClean');
delete CloseEvent.prototype.wasClean;
assert_equals(e.wasClean, undefined, 'delete CloseEvent.prototype.wasClean');
t.done();
});
ws.close();

View file

@ -6,10 +6,11 @@
<div id=log></div>
<script>
test(function(t) {
delete WebSocket.prototype.readyState;
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/');
ws.close();
delete ws.readyState;
assert_equals(ws.readyState, ws.CLOSING);
assert_equals(ws.readyState, ws.CLOSING, 'delete ws.readyState');
delete WebSocket.prototype.readyState;
assert_equals(ws.readyState, undefined, 'delete WebSocket.prototype.readyState');
});
</script>

View file

@ -8,6 +8,8 @@
test(function() {
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/');
delete ws.url;
assert_equals(ws.url, SCHEME_DOMAIN_PORT+'/');
assert_equals(ws.url, SCHEME_DOMAIN_PORT+'/', 'delete ws.url');
delete WebSocket.prototype.url;
assert_equals(ws.url, undefined, 'delete WebSocket.prototype.url');
});
</script>

View file

@ -1,11 +1,13 @@
importScripts("/resources/testharness.js");
test(function() {
test(function(t) {
var i = 0;
addEventListener("message", this.step_func(function listener(evt) {
addEventListener("message", function listener(evt) {
t.step(function() {
++i;
removeEventListener("message", listener, true);
}), true);
});
}, true);
self.dispatchEvent(new Event("message"));
self.dispatchEvent(new Event("message"));
assert_equals(i, 1);

View file

@ -21,7 +21,7 @@ async_test(function() {
assert_equals(typeof e.message, 'string', 'typeof e.message');
assert_equals(e.filename, document.URL+'#', 'e.filename');
assert_equals(typeof e.lineno, 'number', 'typeof e.lineno');
assert_equals(typeof e.column, 'number', 'typeof e.column');
assert_equals(typeof e.colno, 'number', 'typeof e.column');
e.preventDefault(); // "handled"
this.done();
});

View file

@ -21,7 +21,7 @@ async_test(function() {
assert_equals(typeof e.message, 'string', 'typeof e.message');
assert_equals(e.filename, document.URL+'#', 'e.filename');
assert_equals(typeof e.lineno, 'number', 'typeof e.lineno');
assert_equals(typeof e.column, 'number', 'typeof e.column');
assert_equals(typeof e.colno, 'number', 'typeof e.column');
e.preventDefault(); // "handled"
this.done();
});

View file

@ -16,15 +16,11 @@ setup({
});
async_test(function() {
var worker = new Worker('#');
var timeout = setTimeout(this.step_func(function() {
assert_unreached();
}, 500));
window.onerror = this.step_func(function(a, b, c, d) {
assert_true(typeof a, 'string', 'first argument');
assert_equals(typeof a, 'string', 'first argument');
assert_equals(b, document.URL+'#', 'second argument');
assert_equals(typeof c, 'number', 'third argument');
assert_equals(typeof d, 'number', 'fourth argument');
clearTimeout(timeout);
this.done();
return true; // "handled"
});