Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wpt cookie path tests #11624

Merged
merged 1 commit into from Oct 16, 2016
Merged

wpt cookie path tests #11624

merged 1 commit into from Oct 16, 2016

Conversation

@g-k
Copy link
Contributor

g-k commented Jun 5, 2016

Adds wpt tests for the cookie path attribute.

Notes:

  • I included polyfills for fetch and promise to get tests running. Assuming these changes are OK, I'll remove them and add failure expectations so they don't get synced to w3c.
  • I didn't work out a way to test sending cookies when the request and cookie paths exactly match (e.g. request path /cookies/path/match-exact-page.sub.html and cookie path /cookies/path/match-exact-page.sub.html will not send cookies to /cookies/resources/echo-json.py)
  • test names could be clearer
  • everything can be squashed to one commit

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #8756 (github issue number if applicable).
  • These changes do not require tests because they are tests (and if we test our tests do we need to test our test tests? ...)

This change is Reviewable

@KiChjang
Copy link
Member

KiChjang commented Jun 5, 2016

Fails tidy:

--- a/tests/wpt/metadata/MANIFEST.json
+++ b/tests/wpt/metadata/MANIFEST.json
@@ -36030,18 +36030,18 @@
     "deleted_reftests": {},
     "items": {
       "testharness": {
-        "cookies/path/match-exact-slash.sub.html": [
-          {
-            "path": "cookies/path/match-exact-slash.sub.html",
-            "url": "/cookies/path/match-exact-slash.sub.html"
-          }
-        ],
         "cookies/path/match-exact-page.sub.html": [
           {
             "path": "cookies/path/match-exact-page.sub.html",
             "url": "/cookies/path/match-exact-page.sub.html"
           }
         ],
+        "cookies/path/match-exact-slash.sub.html": [
+          {
+            "path": "cookies/path/match-exact-slash.sub.html",
+            "url": "/cookies/path/match-exact-slash.sub.html"
+          }
+        ],
         "cookies/path/match-prefix-cookie-trailing-slash.sub.html": [
           {
             "path": "cookies/path/match-prefix-cookie-trailing-slash.sub.html",
@g-k
Copy link
Contributor Author

g-k commented Jun 5, 2016

Weird, it's passing for me:

$ git log -1 --format=oneline
713440ecd0a892afb3a12bd2459b54ae476bfca9 fixup! test cookie path
$ ./mach test-tidy
  Progress: 100% (19/19)
Running the WPT lint...
  Progress: 100% (16/16)
tidy reported no errors.

How do I reproduce that?

@highfive
Copy link

highfive commented Jun 5, 2016

New code was committed to pull request.

@KiChjang
Copy link
Member

KiChjang commented Jun 6, 2016

r? @Ms2ger

@highfive highfive assigned Ms2ger and unassigned KiChjang Jun 6, 2016
@KiChjang KiChjang removed the S-fails-tidy label Jun 6, 2016
@jdm
Copy link
Member

jdm commented Jun 6, 2016

FYI, that's not a tidy check. It's a separate one that runs ./mach update-manifest and verifies the output of git diff.

@bors-servo
Copy link
Contributor

bors-servo commented Jun 6, 2016

The latest upstream changes (presumably #11632) made this pull request unmergeable. Please resolve the merge conflicts.

@g-k g-k force-pushed the g-k:wpt-cookie-path-tests branch from c367912 to 96dd595 Jun 6, 2016
@jdm jdm removed the S-needs-rebase label Jun 8, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Jun 9, 2016

The latest upstream changes (presumably #11548) made this pull request unmergeable. Please resolve the merge conflicts.

@g-k g-k force-pushed the g-k:wpt-cookie-path-tests branch from 96dd595 to beac1d6 Jun 10, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Jun 23, 2016

The latest upstream changes (presumably #11699) made this pull request unmergeable. Please resolve the merge conflicts.

@jdm jdm assigned jdm and unassigned Ms2ger Jun 23, 2016
@g-k g-k force-pushed the g-k:wpt-cookie-path-tests branch from beac1d6 to 6dfde22 Jun 25, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Jun 30, 2016

The latest upstream changes (presumably #11934) made this pull request unmergeable. Please resolve the merge conflicts.

@g-k g-k force-pushed the g-k:wpt-cookie-path-tests branch from 6dfde22 to c733bd6 Jul 3, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Jul 6, 2016

The latest upstream changes (presumably #12265) made this pull request unmergeable. Please resolve the merge conflicts.

@jdm jdm removed the S-awaiting-review label Oct 4, 2016
@g-k g-k force-pushed the g-k:wpt-cookie-path-tests branch from 8817ce4 to b9e37dc Oct 4, 2016
@g-k g-k force-pushed the g-k:wpt-cookie-path-tests branch from b9e37dc to 4ed7305 Oct 4, 2016
@jdm
Copy link
Member

jdm commented Oct 4, 2016

This is looking really great! I'm very interested in that uncaught exception you saw.
-S-awaiting-review +S-needs-code-changes


Reviewed 9 of 21 files at r5.
Review status: all files reviewed at latest revision, 5 unresolved discussions.


tests/wpt/web-platform-tests/cookies/path/echo-cookie.html, line 13 at r5 (raw file):

  document.cookie = name + '=1; path = ' + path + ';';
}
window.fetchCookieThen = function (name, path) {

The name implies a callback or returning a promise or something.


tests/wpt/web-platform-tests/cookies/path/match.html, line 41 at r5 (raw file):

  var iframe = createIframeThen(function () {
    iframe.contentWindow.fetchCookieThen(testCase.name, testCase.path);
      // TODO: figure out 'ERROR:script::dom::bindings::error: Uncaught exception: failed to extract information' error

Spooky: https://dxr.mozilla.org/servo/source/components/script/dom/bindings/error.rs?q=failed+to+extract&redirect_type=single#221 . If you have a way to reproduce this, that would be really useful.


tests/wpt/web-platform-tests/cookies/path/match.html, line 42 at r5 (raw file):

    iframe.contentWindow.fetchCookieThen(testCase.name, testCase.path);
      // TODO: figure out 'ERROR:script::dom::bindings::error: Uncaught exception: failed to extract information' error
      window.setTimeout(function (testCase, ctx, iframe) {

We'll need to solve the previous problem and remove this setTimeout before we can merge this.


tests/wpt/web-platform-tests/cookies/path/match.html, line 50 at r5 (raw file):

    }
    iframe.contentWindow.expireCookie(testCase.name, testCase.path);
    ctx.done();

nit: spaces instead of tabs.


tests/wpt/web-platform-tests/cookies/resources/set-cookie.py, line 24 at r5 (raw file):

    """
    params = urlparse.parse_qs(request.url_parts.query)
    print >> sys.stderr, params

Let's remove the print statements in this file.


Comments from Reviewable

@g-k g-k force-pushed the g-k:wpt-cookie-path-tests branch from 4ed7305 to 93b13d0 Oct 4, 2016
@g-k
Copy link
Contributor Author

g-k commented Oct 4, 2016

Review status: 1 of 4 files reviewed at latest revision, 5 unresolved discussions.


tests/wpt/web-platform-tests/cookies/path/echo-cookie.html, line 13 at r5 (raw file):

Previously, jdm (Josh Matthews) wrote…

The name implies a callback or returning a promise or something.

Switched it back to returning a promise.

tests/wpt/web-platform-tests/cookies/path/match.html, line 41 at r5 (raw file):

Previously, jdm (Josh Matthews) wrote…

Spooky: https://dxr.mozilla.org/servo/source/components/script/dom/bindings/error.rs?q=failed+to+extract&redirect_type=single#221 . If you have a way to reproduce this, that would be really useful.

I pushed: https://github.com/g-k/servo/tree/failed-to-extract-info-js-error and can reproduce it there but haven't pared it down.

Calling executeTestsSerially directly (without the tests.map call) and removing the iframe made the error go away.

Maybe something to do with the JS VM losing stack info when the iframe promise continues in another window?


tests/wpt/web-platform-tests/cookies/path/match.html, line 42 at r5 (raw file):

Previously, jdm (Josh Matthews) wrote…

We'll need to solve the previous problem and remove this setTimeout before we can merge this.

Fixed on the most recent push.

The fetch API calls or server response isn't setting cookies (tried checking with an alert in e167968) and the assertion failure triggers the promise catch (for some reason I thought the assertion would be self contained and it looks like promise_test does that).

This was the result of trying a few different things like not using an iframe, not passing the callback to the iframe, using post message instead, XHRs instead of the fetch API, etc.


tests/wpt/web-platform-tests/cookies/path/match.html, line 50 at r5 (raw file):

Previously, jdm (Josh Matthews) wrote…

nit: spaces instead of tabs.

Should be fixed or at least

grep '\t' tests/wpt/web-platform-tests/cookies/path/match.html

doesn't return anything.


tests/wpt/web-platform-tests/cookies/resources/set-cookie.py, line 24 at r5 (raw file):

Previously, jdm (Josh Matthews) wrote…

Let's remove the print statements in this file.

Done. https://github.com//pull/11624/commits/6fcbcf8cf1c840f82312dba3a62620a19ed8027e

Comments from Reviewable

@jdm
Copy link
Member

jdm commented Oct 13, 2016

Almost there! A couple last fixups to maximize the ability to report errors effectively and this should be ready to merge!
-S-awaiting-review +S-needs-code-changes


Reviewed 3 of 3 files at r6.
Review status: all files reviewed at latest revision, 4 unresolved discussions.


tests/wpt/web-platform-tests/cookies/path/match.html, line 41 at r5 (raw file):

Previously, g-k (Greg Guthe) wrote…

I pushed: https://github.com/g-k/servo/tree/failed-to-extract-info-js-error
and can reproduce it there but haven't pared it down.

Calling executeTestsSerially directly (without the tests.map call) and removing the iframe made the error go away.

Maybe something to do with the JS VM losing stack info when the iframe promise continues in another window?

Thanks! I filed #13748 based on my investigations of this.

tests/wpt/web-platform-tests/cookies/path/match.html, line 25 at r6 (raw file):

};
var testCookiePathFromDOM = function (testCase, test) {
  var iframe = createIframeThen(function () {

createIframeThen(test.step_func(function() {


tests/wpt/web-platform-tests/cookies/path/match.html, line 39 at r6 (raw file):

};
var testCookiePathFromHeader = function (testCase, test) {
  var iframe = createIframeThen(function () {

createIframeThen(test.step_func(function() {


tests/wpt/web-platform-tests/cookies/path/match.html, line 40 at r6 (raw file):

var testCookiePathFromHeader = function (testCase, test) {
  var iframe = createIframeThen(function () {
    iframe.contentWindow.fetchCookieThen(testCase.name, testCase.path).then(function (response) {

.then(test.step_func(function(response) {


Comments from Reviewable

@g-k g-k force-pushed the g-k:wpt-cookie-path-tests branch from 93b13d0 to ec68a99 Oct 15, 2016
@g-k
Copy link
Contributor Author

g-k commented Oct 15, 2016

Review status: 2 of 4 files reviewed at latest revision, 3 unresolved discussions.


tests/wpt/web-platform-tests/cookies/path/match.html, line 25 at r6 (raw file):

Previously, jdm (Josh Matthews) wrote…

createIframeThen(test.step_func(function() {

Done.

tests/wpt/web-platform-tests/cookies/path/match.html, line 39 at r6 (raw file):

Previously, jdm (Josh Matthews) wrote…

createIframeThen(test.step_func(function() {

Done.

tests/wpt/web-platform-tests/cookies/path/match.html, line 40 at r6 (raw file):

Previously, jdm (Josh Matthews) wrote…

.then(test.step_func(function(response) {

Done.

Comments from Reviewable

@jdm
Copy link
Member

jdm commented Oct 16, 2016

@bors-servo: r+
Woo!

@bors-servo
Copy link
Contributor

bors-servo commented Oct 16, 2016

📌 Commit ec68a99 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Oct 16, 2016

Testing commit ec68a99 with merge ecbdeb3...

bors-servo added a commit that referenced this pull request Oct 16, 2016
wpt cookie path tests

Adds wpt tests for the cookie path attribute.

Notes:

* I included polyfills for fetch and promise to get tests running.  Assuming these changes are OK, I'll remove them and add failure expectations so they don't get synced to w3c.
* I didn't work out a way to test sending cookies when the request and cookie paths exactly match (e.g. request path `/cookies/path/match-exact-page.sub.html` and cookie path `/cookies/path/match-exact-page.sub.html` will not send cookies to `/cookies/resources/echo-json.py`)
* test names could be clearer
* everything can be squashed to one commit

---

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #8756 (github issue number if applicable).

- [x] These changes do not require tests because they are tests (and if we test our tests do we need to test our test tests? ...)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11624)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Oct 16, 2016

@bors-servo bors-servo merged commit ec68a99 into servo:master Oct 16, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

6 participants
You can’t perform that action at this time.