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

Avoid panics when using HTMLAnchorElement attribute setters #10903

Merged

Conversation

@broesamle
Copy link
Contributor

broesamle commented Apr 28, 2016

expected: OK still explicitly mentioned in .ini file. Shall I remove it?

Fixes #10877.


This change is Reviewable

@highfive
Copy link

highfive commented Apr 28, 2016

Heads up! This PR modifies the following files:

  • @KiChjang: components/script/dom/htmlanchorelement.rs
@broesamle broesamle changed the title Issue10877 html anchor element setter panic Issue #10877 html anchor element setter panic Apr 28, 2016
@@ -0,0 +1,3 @@
[htmlanchorelment-search-attribute.html]
type: testharness
expected: OK

This comment has been minimized.

Copy link
@KiChjang

KiChjang Apr 28, 2016

Member

Yes, remove this. By default, tests are expected to PASS (or OK), so if there's no .ini file, the test framework will expect the test file to pass.

@broesamle broesamle changed the title Issue #10877 html anchor element setter panic Fixes #10877 Apr 28, 2016
@KiChjang
Copy link
Member

KiChjang commented Apr 29, 2016

Speaking of which, why isn't this a WPT test?

<title>HTMLAnchorElement search setter crashes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<a>anchor</a>

This comment has been minimized.

Copy link
@Ms2ger

Ms2ger Apr 29, 2016

Contributor

Please put this in the directory of upstream tests, add assert_*s that the setter works correctly, and also test all the other setters you changed.

This comment has been minimized.

Copy link
@broesamle

broesamle Apr 29, 2016

Author Contributor

@jdm points to an overlap regarding the tests with #10876 and suggests:

Test: We should create a test that exercises each of the getters and setters individually in tests/wpt/web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements/.

Shall I just move it there?

This comment has been minimized.

Copy link
@broesamle

broesamle Apr 29, 2016

Author Contributor

to rephrase my question (making me hesitate to just move the test):
Is there a specific location where to put it, before it formally enters the WPT repo?

what you called:

the directory of upstream tests

This comment has been minimized.

Copy link
@Ms2ger

Ms2ger Apr 29, 2016

Contributor

tests/wpt/web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements/ is perfect.

@broesamle
Copy link
Contributor Author

broesamle commented May 1, 2016

well, I tried to merge the the upstream(servo/servo) master into a local branch of my fork.

The conflict in MANIFEST.json looks a bit awkward to resolve manually :-/
"Rebuilding" MANIFEST.json could be easier:
./mach test-wpt --manifest-update
Would that work, does that make sense?

@jdm
Copy link
Member

jdm commented May 1, 2016

It would, but I recommend ./mach test-wpt --manifest-update SKIP_TESTS to avoid running any tests.

@broesamle broesamle force-pushed the broesamle:issue10877-HTMLAnchorElement-setter-panic branch from 0aabe09 to 222278a May 2, 2016
@bors-servo
Copy link
Contributor

bors-servo commented May 2, 2016

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

@jdm jdm assigned jdm and unassigned pcwalton May 2, 2016
@broesamle broesamle force-pushed the broesamle:issue10877-HTMLAnchorElement-setter-panic branch from 222278a to daf4fe2 May 2, 2016
@broesamle
Copy link
Contributor Author

broesamle commented May 2, 2016

done the rebase...at least the conflict is gone :-)

@broesamle
Copy link
Contributor Author

broesamle commented May 2, 2016

Manually merged MANIFEST.json
all tests that I touched can be run (so the MANIFEST should be ok), despite some did not pass.

@jdm jdm removed the S-needs-rebase label May 2, 2016
@broesamle
Copy link
Contributor Author

broesamle commented May 2, 2016

The command "bash etc/ci/manifest_changed.sh" exited with 1.
:-(

so, what is the best practice of resolving merge conflicts from MANIFEST.json?

@jdm
Copy link
Member

jdm commented May 2, 2016

Huh, it should be enough to undo any changes to MANIFEST.json and run ./mach test-wpt --manifest-update SKIP_TESTS.

@broesamle
Copy link
Contributor Author

broesamle commented May 2, 2016

let's see ... this time I used the automatic update again.

@broesamle
Copy link
Contributor Author

broesamle commented May 2, 2016

you were right, @jdm, I should not have merged MANIFEST.json by hand.

@jdm jdm changed the title Fixes #10877 Avoid panics when using HTMLAnchorElement attribute setters May 3, 2016
@jdm
Copy link
Member

jdm commented May 3, 2016

Looking good! I think we can make the new test easier to read and modify, however.
-S-awaiting-review +S-needs-code-changes


Reviewed 1 of 2 files at r2, 1 of 3 files at r4, 2 of 4 files at r5, 1 of 1 files at r6.
Review status: all files reviewed at latest revision, 3 unresolved discussions.


tests/wpt/web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements/htmlanchorelement_attribute-getter-setter.html, line 11 [r6] (raw file):
There's a lot of duplication in each of these tests. I think we can do something like this:

function test_setter(property, old, new) {
  /* initialize a to known url */
  assert_equals(a[property], old);
  a[property] = new;
  assert_equals(a[property], new);
}

var tests = [["hash", "#somehash", "#someother"], ...];
for (var i = 0; i < tests.length; i++) {
  test(function() {
    test_setter(tests[i][0], tests[i][1], tests[i][2]);
  }, "Getter and setter for attribute of anchor element: " + tests[i][0])
}

Comments from Reviewable

@broesamle
Copy link
Contributor Author

broesamle commented May 3, 2016

agreed. I rewrote the test according to your suggestion -- with the slight 'complexication' that I have an additional check for the old and new url.

Which already produced an unexpected (to me) fail in the search setter

assert_equals: expected "http://google.com?hi" but got "http://google.com/?hi"

Is it valid, if the setter adds the / after the hostname, here?
(From my quick look in the specs I did not come to a conclusion.)

otherwise all tests pass nicely.

Fixes #10877.
Includes new test for attribute getters and setters.
@broesamle broesamle force-pushed the broesamle:issue10877-HTMLAnchorElement-setter-panic branch from 7ef4768 to 751733a May 11, 2016
@highfive
Copy link

highfive commented May 11, 2016

New code was committed to pull request.

@broesamle
Copy link
Contributor Author

broesamle commented May 11, 2016

did it. (forget my former concern) ... its late here in berlin.

@jdm
Copy link
Member

jdm commented May 11, 2016

@bors-servo: r+
Thank you very much!

@bors-servo
Copy link
Contributor

bors-servo commented May 11, 2016

📌 Commit 751733a has been approved by jdm

@broesamle
Copy link
Contributor Author

broesamle commented May 11, 2016

Thank you for your patience! I learned a lot about servo on the way :-)

@bors-servo
Copy link
Contributor

bors-servo commented May 12, 2016

Testing commit 751733a with merge fe83feb...

bors-servo added a commit that referenced this pull request May 12, 2016
…panic, r=jdm

Avoid panics when using HTMLAnchorElement attribute setters

`expected: OK` still explicitly mentioned in .ini file. Shall I remove it?

Fixes #10877.
<!-- 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/10903)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 12, 2016

💔 Test failed - windows

@mbrubeck
Copy link
Contributor

mbrubeck commented May 12, 2016

@bors-servo retry

  • network error
@bors-servo
Copy link
Contributor

bors-servo commented May 12, 2016

Testing commit 751733a with merge 545da38...

bors-servo added a commit that referenced this pull request May 12, 2016
…panic, r=jdm

Avoid panics when using HTMLAnchorElement attribute setters

`expected: OK` still explicitly mentioned in .ini file. Shall I remove it?

Fixes #10877.
<!-- 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/10903)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 12, 2016

@bors-servo bors-servo merged commit 751733a into servo:master May 12, 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
@jdm jdm mentioned this pull request May 17, 2016
4 of 5 tasks complete
@broesamle broesamle deleted the broesamle:issue10877-HTMLAnchorElement-setter-panic branch Apr 4, 2017
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.

None yet

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