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

htmlanchorelement getter work before href setting is called #11182

Merged
merged 1 commit into from May 18, 2016

Conversation

@mrmiywj
Copy link
Contributor

mrmiywj commented May 14, 2016

Thank you for contributing to Servo! Please replace each [ ] by [X] when the step is complete, and replace __ with appropriate data:

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #10876 (github issue number if applicable).

Either:

  • There are tests for these changes OR
  • These changes do not require tests because _____

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.


This change is Reviewable

@highfive
Copy link

highfive commented May 14, 2016

Heads up! This PR modifies the following files:

  • @KiChjang: components/script/dom/htmlanchorelement.rs
@KiChjang
Copy link
Member

KiChjang commented May 14, 2016

You'll need to use ./mach create-wpt tests/wpt/web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements/htmlanchorelement_attribute-getter-setter-sample.html to create a new test, otherwise the test harness wouldn't run your test.

@highfive
Copy link

highfive commented May 16, 2016

New code was committed to pull request.

@mrmiywj
Copy link
Contributor Author

mrmiywj commented May 16, 2016

cc @KiChjang
It works now. Since there is another test file to test setters and getters. I just wrote a test on calling getters before setters called.

@highfive
Copy link

highfive commented May 16, 2016

New code was committed to pull request.

<a href="https://anonymous:pwd@developer.mozilla.org:1234/en-US/">a10</a>
<script>
function test_gettersetter(property, result, url) {
var a = document.querySelector('a[href="'+url+'"]');

This comment has been minimized.

@KiChjang

KiChjang May 16, 2016

Member

document.getElementById("a1");

<title>HTMLAnchorElement getters before setters called</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<a href="http://google.com?hi">a1</a>

This comment has been minimized.

@KiChjang

KiChjang May 16, 2016

Member

You can change all of these two <a id=a1 href=.../>

@highfive
Copy link

highfive commented May 16, 2016

New code was committed to pull request.

@mrmiywj
Copy link
Contributor Author

mrmiywj commented May 16, 2016

@@ -91,6 +91,20 @@ impl VirtualMethods for HTMLAnchorElement {
Some(self.upcast::<HTMLElement>() as &VirtualMethods)
}

fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() {

This comment has been minimized.

@KiChjang

KiChjang May 16, 2016

Member
if attr.local_name() == &atom!("href") {
    if self.url.is_mutably_borrowed() {
        return;
    }
    self.set_url();
}
@highfive
Copy link

highfive commented May 16, 2016

New code was committed to pull request.

@mrmiywj
Copy link
Contributor Author

mrmiywj commented May 16, 2016

cc @KiChjang
Thx!

@KiChjang
Copy link
Member

KiChjang commented May 16, 2016

It doesn't look like the latest commit changed anything.

@highfive
Copy link

highfive commented May 16, 2016

New code was committed to pull request.

@highfive
Copy link

highfive commented May 17, 2016

New code was committed to pull request.

@KiChjang
Copy link
Member

KiChjang commented May 17, 2016

@bors-servo
Copy link
Contributor

bors-servo commented May 17, 2016

📌 Commit d4f125e has been approved by KiChjang

@bors-servo
Copy link
Contributor

bors-servo commented May 17, 2016

Testing commit d4f125e with merge 4635034...

bors-servo added a commit that referenced this pull request May 17, 2016
htmlanchorelement getter work before href setting is called

Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data:
- [x] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #10876  (github issue number if applicable).

Either:
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.

<!-- 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/11182)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 17, 2016

💔 Test failed - mac-rel-wpt

@highfive
Copy link

highfive commented May 17, 2016

  ▶ Unexpected subtest result in /url/a-element-xhtml.xhtml:
  │ FAIL [expected PASS] Parsing: &lt;http:/:@/www.example.com&gt; against &lt;about:blank&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;http:@/www.example.com&gt; against &lt;about:blank&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;http:/@/www.example.com&gt; against &lt;about:blank&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;http:a:b@/www.example.com&gt; against &lt;about:blank&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;http:/a:b@/www.example.com&gt; against &lt;about:blank&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;http::@/www.example.com&gt; against &lt;about:blank&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;http:@:www.example.com&gt; against &lt;about:blank&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;http:/@:www.example.com&gt; against &lt;about:blank&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;i&gt; against &lt;sc:sd&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;i&gt; against &lt;sc:sd/sd&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;../i&gt; against &lt;sc:sd&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;../i&gt; against &lt;sc:sd/sd&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;/i&gt; against &lt;sc:sd&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;/i&gt; against &lt;sc:sd/sd&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;?i&gt; against &lt;sc:sd&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;?i&gt; against &lt;sc:sd/sd&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ 
  │ runURLTests/&lt;@http://web-platform.test:8000/url/a-element.js:33:11
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1397:20
  │ test@http://web-platform.test:8000/resources/testharness.js:495:9
  │ runURLTests@http://web-platform.test:8000/url/a-element.js:29:5
  │ request.onload&lt;@http://web-platform.test:8000/url/a-element.js:7:5
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1397:20
  └ Test.prototype.step_func/&lt;@http://web-platform.test:8000/resources/testharness.js:1421:20

  ▶ Unexpected subtest result in /url/a-element.html:
  │ FAIL [expected PASS] Parsing: &lt;http:/:@/www.example.com&gt; against &lt;about:blank&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;http:@/www.example.com&gt; against &lt;about:blank&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;http:/@/www.example.com&gt; against &lt;about:blank&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;http:a:b@/www.example.com&gt; against &lt;about:blank&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;http:/a:b@/www.example.com&gt; against &lt;about:blank&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;http::@/www.example.com&gt; against &lt;about:blank&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;http:@:www.example.com&gt; against &lt;about:blank&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;http:/@:www.example.com&gt; against &lt;about:blank&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;i&gt; against &lt;sc:sd&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;i&gt; against &lt;sc:sd/sd&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;../i&gt; against &lt;sc:sd&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;../i&gt; against &lt;sc:sd/sd&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;/i&gt; against &lt;sc:sd&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;/i&gt; against &lt;sc:sd/sd&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;?i&gt; against &lt;sc:sd&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ FAIL [expected PASS] Parsing: &lt;?i&gt; against &lt;sc:sd/sd&gt;
  │   → assert_unreached: Expected URL to fail parsing Reached unreachable code
  │ 
  │ runURLTests/&lt;@http://web-platform.test:8000/url/a-element.js:33:11
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1397:20
  │ test@http://web-platform.test:8000/resources/testharness.js:495:9
  │ runURLTests@http://web-platform.test:8000/url/a-element.js:29:5
  │ request.onload&lt;@http://web-platform.test:8000/url/a-element.js:7:5
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1397:20
  └ Test.prototype.step_func/&lt;@http://web-platform.test:8000/resources/testharness.js:1421:20
update tests

rewrite it
@highfive
Copy link

highfive commented May 18, 2016

New code was committed to pull request.

@KiChjang
Copy link
Member

KiChjang commented May 18, 2016

@bors-servo
Copy link
Contributor

bors-servo commented May 18, 2016

📌 Commit 904e9ea has been approved by KiChjang

@bors-servo
Copy link
Contributor

bors-servo commented May 18, 2016

Testing commit 904e9ea with merge aa8c835...

bors-servo added a commit that referenced this pull request May 18, 2016
htmlanchorelement getter work before href setting is called

Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data:
- [x] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #10876  (github issue number if applicable).

Either:
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.

<!-- 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/11182)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 18, 2016

@bors-servo bors-servo merged commit 904e9ea into servo:master May 18, 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
@paulrouget
Copy link
Contributor

paulrouget commented May 19, 2016

This causes a crash: #11261

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.

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