Skip to content

Commit

Permalink
Bug 1482083 [wpt PR 12377] - Replace document.origin with self.origin…
Browse files Browse the repository at this point in the history
… in cookie-helper.sub.js, a=testonly

Automatic update from web-platform-testsReplace document.origin with self.origin in cookie-helper.sub.js (#12377)

In anticipation of whatwg/dom#410
--

wpt-commits: 0e1ac363581d4bf0851a00a5563619bfef622fe4
wpt-pr: 12377
  • Loading branch information
foolip authored and moz-wptsync-bot committed Aug 15, 2018
1 parent 094da6a commit f11f0dd
Show file tree
Hide file tree
Showing 23 changed files with 1,981 additions and 108 deletions.
132 changes: 120 additions & 12 deletions testing/web-platform/meta/MANIFEST.json
Original file line number Diff line number Diff line change
Expand Up @@ -294958,6 +294958,36 @@
{}
]
],
"resources/test/tests/functional/add_cleanup_async.html": [
[
{}
]
],
"resources/test/tests/functional/add_cleanup_async_bad_return.html": [
[
{}
]
],
"resources/test/tests/functional/add_cleanup_async_rejection.html": [
[
{}
]
],
"resources/test/tests/functional/add_cleanup_async_rejection_after_load.html": [
[
{}
]
],
"resources/test/tests/functional/add_cleanup_async_timeout.html": [
[
{}
]
],
"resources/test/tests/functional/add_cleanup_bad_return.html": [
[
{}
]
],
"resources/test/tests/functional/add_cleanup_count.html": [
[
{}
Expand All @@ -294973,6 +295003,11 @@
{}
]
],
"resources/test/tests/functional/add_cleanup_sync_queue.html": [
[
{}
]
],
"resources/test/tests/functional/api-tests-1.html": [
[
{}
Expand Down Expand Up @@ -295068,11 +295103,21 @@
{}
]
],
"resources/test/tests/functional/promise-with-sync.html": [
[
{}
]
],
"resources/test/tests/functional/promise.html": [
[
{}
]
],
"resources/test/tests/functional/queue.html": [
[
{}
]
],
"resources/test/tests/functional/single-page-test-fail.html": [
[
{}
Expand All @@ -295093,6 +295138,16 @@
{}
]
],
"resources/test/tests/functional/task-scheduling-promise-test.html": [
[
{}
]
],
"resources/test/tests/functional/task-scheduling-test.html": [
[
{}
]
],
"resources/test/tests/functional/uncaught-exception-handle.html": [
[
{}
Expand All @@ -295108,7 +295163,7 @@
{}
]
],
"resources/test/tests/functional/worker-dedicated.html": [
"resources/test/tests/functional/worker-dedicated.sub.html": [
[
{}
]
Expand Down Expand Up @@ -295203,6 +295258,11 @@
{}
]
],
"resources/test/tests/unit/exceptional-cases.html": [
[
{}
]
],
"resources/test/tox.ini": [
[
{}
Expand Down Expand Up @@ -453636,7 +453696,7 @@
"testharness"
],
"cookies/resources/cookie-helper.sub.js": [
"852fbb6bb64726bec094a2b3ec5cf17d289116b0",
"428cab042e4fd0ac3f67180587f4f42e42643049",
"support"
],
"cookies/resources/drop.py": [
Expand Down Expand Up @@ -578844,7 +578904,7 @@
"support"
],
"docs/_writing-tests/testharness-api.md": [
"92a9536b69030fd8bb930f6c325a4e2bf4a2eaf7",
"bb5524532915a58e4fab3c3bb89a41bbe2a46b4a",
"support"
],
"docs/_writing-tests/testharness.md": [
Expand Down Expand Up @@ -605716,7 +605776,7 @@
"support"
],
"lint.whitelist": [
"de9e36cf12ff4b5b3158f2f383aae70753043d2f",
"bd9bd46c52250849267c8a9fa6c8f72129f20140",
"support"
],
"longtask-timing/META.yml": [
Expand Down Expand Up @@ -625644,7 +625704,7 @@
"support"
],
"resources/test/conftest.py": [
"801c97a1f9299805abe8f25726a2d4feb374f7d0",
"8765bf835dfc241d5cbd15e9697de465d4289bfb",
"support"
],
"resources/test/harness.html": [
Expand All @@ -625659,16 +625719,44 @@
"31fe19c4bceb96a1a6904706a7369d7c10e1ed12",
"support"
],
"resources/test/tests/functional/add_cleanup_async.html": [
"9d0ade4150a25ef60bde2b09881398c226cea703",
"support"
],
"resources/test/tests/functional/add_cleanup_async_bad_return.html": [
"0b45362f1643bae215b22137eb7fc2f586993f65",
"support"
],
"resources/test/tests/functional/add_cleanup_async_rejection.html": [
"0528b4254f671b0c629fb1df7b7e81aed2b41af5",
"support"
],
"resources/test/tests/functional/add_cleanup_async_rejection_after_load.html": [
"bd8fb379c787457675a41c141c2cddf886450682",
"support"
],
"resources/test/tests/functional/add_cleanup_async_timeout.html": [
"5cb04d5a8ba7f895568dddbbf12987cd0ff3a83e",
"support"
],
"resources/test/tests/functional/add_cleanup_bad_return.html": [
"1f1c6fbf44b5d505d172e213b93261bd20c45fb6",
"support"
],
"resources/test/tests/functional/add_cleanup_count.html": [
"03f6f11e3294a7940638d59f914819f1e7293a2b",
"38fd8fd7a10e9e52e7738902dd0751dccc581e79",
"support"
],
"resources/test/tests/functional/add_cleanup_err.html": [
"d9fd1375e9bf738a9eaf98eb84e15a20aa141a79",
"9997281242a613ea14e6e36b4151129d4e058d7e",
"support"
],
"resources/test/tests/functional/add_cleanup_err_multi.html": [
"7891c12d77a28493501951e9cbb3bece2ddda39b",
"a489b96659066fb5db98c3146f3ae90b53cc53f5",
"support"
],
"resources/test/tests/functional/add_cleanup_sync_queue.html": [
"1e058f150136cf4ab9a3e5e1b4c16a28685bd94f",
"support"
],
"resources/test/tests/functional/api-tests-1.html": [
Expand Down Expand Up @@ -625728,7 +625816,7 @@
"support"
],
"resources/test/tests/functional/iframe-consolidate-errors.html": [
"9ba6e179faffc44f6caea124654a9e421289c3be",
"e382c6e6fd96bc40ea057a941f13816c947fa3eb",
"support"
],
"resources/test/tests/functional/iframe-consolidate-tests.html": [
Expand All @@ -625747,10 +625835,18 @@
"d4c62794c4f77abf460cd484fd548a59e1ed16e3",
"support"
],
"resources/test/tests/functional/promise-with-sync.html": [
"234f5476e9cdaf8c388cdaaa2e6464bc9120fe3d",
"support"
],
"resources/test/tests/functional/promise.html": [
"bdf6dc3ec2af07a9799243cbc7b15da939961363",
"support"
],
"resources/test/tests/functional/queue.html": [
"4ea32a2bc8ee64b5841596f240291ec7fa514274",
"support"
],
"resources/test/tests/functional/single-page-test-fail.html": [
"5826a2ef15c00d817197333de1f444cf1ac51e8b",
"support"
Expand All @@ -625767,6 +625863,14 @@
"9d5f776d541454cdcff985bb2ad050036d358b81",
"support"
],
"resources/test/tests/functional/task-scheduling-promise-test.html": [
"fb4cc2dd27d52573c4113aa1a6f8d833ce80c9be",
"support"
],
"resources/test/tests/functional/task-scheduling-test.html": [
"134bdb2ea8d629afaac79b0fe84b3ae570445b17",
"support"
],
"resources/test/tests/functional/uncaught-exception-handle.html": [
"4c960186e0d29885aebeb379181ed181ccc26d1d",
"support"
Expand All @@ -625779,8 +625883,8 @@
"760151832e81f8ef61d510b252d0cd1d7d843495",
"support"
],
"resources/test/tests/functional/worker-dedicated.html": [
"a790a1520ceed96f254b1f5415d0415f7bf3a456",
"resources/test/tests/functional/worker-dedicated.sub.html": [
"586326d876119da03413a6473b042885abee7741",
"support"
],
"resources/test/tests/functional/worker-error.js": [
Expand Down Expand Up @@ -625855,6 +625959,10 @@
"7eef4a8fa5b50547bce915170a9b3e1e0312adf4",
"support"
],
"resources/test/tests/unit/exceptional-cases.html": [
"df9e1239a2ec48dd8b489fb7001a5295e334f963",
"support"
],
"resources/test/tox.ini": [
"d3a30f870a1572d4423ae99f64c67d63afa345da",
"support"
Expand Down Expand Up @@ -625888,7 +625996,7 @@
"support"
],
"resources/testharness.js": [
"0ea7a2a7f48424708ef661e2dbcecdb8b916c81a",
"f0c24635017dad6275c99dc149ab1739470eeb36",
"support"
],
"resources/testharness.js.headers": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ function assert_cookie(origin, obj, name, value, present) {
}

// Remove the cookie named |name| from |origin|, then set it on |origin| anew.
// If |origin| matches `document.origin`, also assert (via `document.cookie`) that
// If |origin| matches `self.origin`, also assert (via `document.cookie`) that
// the cookie was correctly removed and reset.
function create_cookie(origin, name, value, extras) {
alert("Create_cookie: " + origin + "/cookies/resources/drop.py?name=" + name);
return credFetch(origin + "/cookies/resources/drop.py?name=" + name)
.then(_ => {
if (origin == document.origin)
if (origin == self.origin)
assert_dom_cookie(name, value, false);
})
.then(_ => {
return credFetch(origin + "/cookies/resources/set.py?" + name + "=" + value + ";path=/;" + extras)
.then(_ => {
if (origin == document.origin)
if (origin == self.origin)
assert_dom_cookie(name, value, true);
});
});
Expand Down Expand Up @@ -96,7 +96,7 @@ function set_prefixed_cookie_via_http_test(options) {

var name = options.prefix + "prefixtestcookie";
if (!options.origin) {
options.origin = document.origin;
options.origin = self.origin;
erase_cookie_from_js(name);
return postDelete;
} else {
Expand All @@ -116,12 +116,12 @@ window.SameSiteStatus = {
STRICT: "strict"
};

// Reset SameSite test cookies on |origin|. If |origin| matches `document.origin`, assert
// Reset SameSite test cookies on |origin|. If |origin| matches `self.origin`, assert
// (via `document.cookie`) that they were properly removed and reset.
function resetSameSiteCookies(origin, value) {
return credFetch(origin + "/cookies/resources/dropSameSite.py")
.then(_ => {
if (origin == document.origin) {
if (origin == self.origin) {
assert_dom_cookie("samesite_strict", value, false);
assert_dom_cookie("samesite_lax", value, false);
assert_dom_cookie("samesite_none", value, false);
Expand All @@ -130,7 +130,7 @@ function resetSameSiteCookies(origin, value) {
.then(_ => {
return credFetch(origin + "/cookies/resources/setSameSite.py?" + value)
.then(_ => {
if (origin == document.origin) {
if (origin == self.origin) {
assert_dom_cookie("samesite_strict", value, true);
assert_dom_cookie("samesite_lax", value, true);
assert_dom_cookie("samesite_none", value, true);
Expand Down Expand Up @@ -164,12 +164,12 @@ window.SecureStatus = {
BOTH_COOKIES: "2",
};

//Reset SameSite test cookies on |origin|. If |origin| matches `document.origin`, assert
//Reset SameSite test cookies on |origin|. If |origin| matches `self.origin`, assert
//(via `document.cookie`) that they were properly removed and reset.
function resetSecureCookies(origin, value) {
return credFetch(origin + "/cookies/resources/dropSecure.py")
.then(_ => {
if (origin == document.origin) {
if (origin == self.origin) {
assert_dom_cookie("alone_secure", value, false);
assert_dom_cookie("alone_insecure", value, false);
}
Expand Down
10 changes: 10 additions & 0 deletions testing/web-platform/tests/docs/_writing-tests/testharness-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,16 @@ the test result is known. For example:
}, "Calling document.getElementById with a null argument.");
```

If the test was created using the `promise_test` API, then cleanup functions
may optionally return a "thenable" value (i.e. an object which defines a `then`
method). `testharness.js` will assume that such values conform to [the
ECMAScript standard for
Promises](https://tc39.github.io/ecma262/#sec-promise-objects) and delay the
completion of the test until all "thenables" provided in this way have settled.
All callbacks will be invoked synchronously; tests that require more complex
cleanup behavior should manage execution order explicitly. If any of the
eventual values are rejected, the test runner will report an error.

## Timeouts in Tests ##

In general the use of timeouts in tests is discouraged because this is
Expand Down
4 changes: 4 additions & 0 deletions testing/web-platform/tests/lint.whitelist
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,12 @@ SET TIMEOUT: html/dom/documents/dom-tree-accessors/Document.currentScript.html
SET TIMEOUT: html/webappapis/timers/*
SET TIMEOUT: resources/chromium/*
SET TIMEOUT: resources/test/tests/functional/add_cleanup.html
SET TIMEOUT: resources/test/tests/functional/add_cleanup_async.html
SET TIMEOUT: resources/test/tests/functional/add_cleanup_async_rejection.html
SET TIMEOUT: resources/test/tests/functional/add_cleanup_async_rejection_after_load.html
SET TIMEOUT: resources/test/tests/functional/api-tests-1.html
SET TIMEOUT: resources/test/tests/functional/worker.js
SET TIMEOUT: resources/test/tests/unit/exceptional-cases.html
SET TIMEOUT: resources/testharness.js

# setTimeout use in reftests
Expand Down
Loading

0 comments on commit f11f0dd

Please sign in to comment.