Closed
Bug 1488592
Opened 7 years ago
Closed 7 years ago
[wpt-sync] Sync PR 12835 - [cookies] Correct utility function and tests
Categories
(Core :: Networking: Cookies, enhancement, P4)
Core
Networking: Cookies
Tracking
()
RESOLVED
FIXED
mozilla64
| Tracking | Status | |
|---|---|---|
| firefox64 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Sync web-platform-tests PR 12835 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/12835
Details from upstream follow.
Mike Pennisi <mike@mikepennisi.com> wrote:
> [cookies] Correct utility function and tests
>
> The `cookie-helper.sub.js` utility script includes
> `set_prefixed_cookie_via_http_test`, a function that defines sub-tests
> using the `promise_test` API. Previously, it included the following
> code:
>
> promise_test(t => {
> var postDelete = _ => {
> // (elided)
> };
>
> if (!options.origin) {
> return postDelete;
> } else {
> // (elided)
> }
> });
>
> The `promise_test` function does not recognize return values which are
> functions, so returning the `postDelete` method had no effect, and as a
> result, the generated tests performed zero assertions. Because none of
> the consumers of `set_prefixed_cookie_via_http_test` specified a value
> for the `origin` option, all invocations were effected by this bug.
>
> Correcting the problem surfaced a number of errors in the tests. In the
> interest of atomicity, this patch attempts to address them all:
>
> - The logic intended to defensively remove cookies prior to testing was
> implemented using `document.cookie`. Because some tests create cookies
> which include the `HttpOnly` attribute, the DOM API cannot remove
> cookies in all cases. This patch refactors the solution to remove
> such cookies via an HTTP request. It also assumes the environment is
> initially clean and instead expresses the concern via an asynchronous
> "cleanup" function. (This change necessitated an extension to the
> `set.py` script so that it could be used to expire cookies.)
> - The test name `__secure.header.html` incorrectly asserted that a
> cookie set with the `Secure` attribute could be observed in a
> non-secure context. This patch corrects the expectation.
> - The test named `__secure.header.https.html` incorrectly asserted that
> a cookie set with a foreign `Origin` attribute could be observed from
> the current origin. This patch corrects the expectation.
>
> ---
>
> This patch does not affect the test results in Firefox or Chrome. The commands:
>
> $ xvfb-run --auto-servernum ./wpt run firefox cookies/prefix
> $ xvfb-run --auto-servernum ./wpt run chrome cookies/prefix
>
> ...both continue to report the following:
>
> web-platform-test
> ~~~~~~~~~~~~~~~~~
> Ran 95 checks (9 tests, 86 subtests)
> Expected results: 95
| Assignee | ||
Comment 1•7 years ago
|
||
PR 12835 applied with additional changes from upstream: 88e4a9aa658f08de05f6a4d5354c30100c15e688
| Assignee | ||
Updated•7 years ago
|
Component: web-platform-tests → Networking: Cookies
Product: Testing → Core
| Assignee | ||
Comment 2•7 years ago
|
||
| Assignee | ||
Comment 3•7 years ago
|
||
| Assignee | ||
Comment 4•7 years ago
|
||
Pushed to try (stability) https://treeherder.mozilla.org/#/jobs?repo=try&revision=2943c4ae8b2b6fd0d2e3abe8262f6dc7147d7dcf
| Assignee | ||
Comment 5•7 years ago
|
||
Ran 19 tests and 167 subtests
OK : 18
PASS : 145
FAIL : 22
ERROR : 1
Pushed by wptsync@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/a676b98389c7
[wpt PR 12835] - [cookies] Correct utility function and tests, a=testonly
Comment 7•7 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox64:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in
before you can comment on or make changes to this bug.
Description
•