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

Use the document base url when resolving form action URLs #11219

Closed
wants to merge 4 commits into from

Conversation

@mylainos
Copy link
Contributor

mylainos commented May 17, 2016

  • ./mach build -d does not report any errors
  • ./mach test-tidy --faster does not report any errors
  • These changes fix #10580

The test fail with TIMEOUT.
On screen Unknown content type (application/json). is displayed, the target of the form isn't recognize as a html file. How can I fix this?


This change is Reviewable

@highfive
Copy link

highfive commented May 17, 2016

Heads up! This PR modifies the following files:

@@ -0,0 +1,6 @@
<!DOCTYPE html>

This comment has been minimized.

@jdm

jdm May 17, 2016

Member

This should be in tests/wpt/web-platform-tests/html/semantics/forms/the-form-element/resources/, not servo's toplevel resources directory :)

@highfive
Copy link

highfive commented May 17, 2016

New code was committed to pull request.

@mylainos
Copy link
Contributor Author

mylainos commented May 18, 2016

The function t.step_func_done(); is executed but the test fail (TIMEOUT).

@Ms2ger
Copy link
Contributor

Ms2ger commented May 18, 2016

step_func_done creates a function that finishes the test when called; you could use var success = t.step_func_done();

@highfive
Copy link

highfive commented May 18, 2016

New code was committed to pull request.

@mylainos
Copy link
Contributor Author

mylainos commented May 18, 2016

Everything good now 😄

@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use dom::document::Document;

This comment has been minimized.

@KiChjang

KiChjang May 19, 2016

Member

Is this actually used?

This comment has been minimized.

@mylainos

mylainos May 19, 2016

Author Contributor

No, I'll remove it.

@highfive
Copy link

highfive commented May 20, 2016

New code was committed to pull request.

@mylainos
Copy link
Contributor Author

mylainos commented May 24, 2016

Need changes ?

@bors-servo
Copy link
Contributor

bors-servo commented May 27, 2016

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

@larsbergstrom
Copy link
Contributor

larsbergstrom commented May 27, 2016

r? @Ms2ger

@highfive highfive assigned Ms2ger and unassigned larsbergstrom May 27, 2016
@Ms2ger
Copy link
Contributor

Ms2ger commented Jun 2, 2016

Reviewed 1 of 3 files at r2, 1 of 4 files at r3, 1 of 3 files at r4, 3 of 3 files at r7, 1 of 1 files at r8, 1 of 1 files at r9.
Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


components/script/dom/macros.rs, line 102 [r9] (raw file):

            if url.is_empty() {
                let document = document_from_node(self);
                DOMString::from(document.r().base_url().into_string())

Drop the .r()


components/script/dom/macros.rs, line 102 [r9] (raw file):
Reading the spec, I find:

The action IDL attribute must reflect the content attribute of the same name, except that on getting, when the content attribute is missing or its value is the empty string, the element's node document's URL must be returned instead.

Note: "URL", not "base URL".

I'm not sure what @jdm had in mind, but this doesn't seem to be it.

r? @jdm


Comments from Reviewable

@highfive highfive assigned jdm and unassigned Ms2ger Jun 2, 2016
@jdm
Copy link
Member

jdm commented Jun 2, 2016

Ok, the specification is oddly obscure here. The getter should actually reflect the content value (ie. not return a resolved URL at all), except when it's empty, in which case it should return the document URL (not base URL). HOWEVER, when we use the action value during the form submission process (steps 8-10), we need to resolve the value obtained from the getter against the document's base URL.

@jdm
Copy link
Member

jdm commented Jun 2, 2016

Sorry for the incorrect original description in #10580. What we should do now:

  • replace each make_url_or_base_getter for action and formaction with a new make_string_or_document_url macro that returns the document's URL as a string if the attribute value is empty
  • modify HTMLFormElement::submit to use the actual document base URL in base, and make step 8 use the document's non-base URL instead
@mylainos
Copy link
Contributor Author

mylainos commented Jun 2, 2016

Ok, I will modify this.

@jdm
Copy link
Member

jdm commented Jul 27, 2016

@mylainos Are you still planning to finish this?

@mylainos
Copy link
Contributor Author

mylainos commented Jul 29, 2016

Yes !

@jdm
Copy link
Member

jdm commented Sep 8, 2016

Closing due to inaction. If you continue to work on this, please feel free to reopen this PR.

@jdm jdm closed this Sep 8, 2016
@ducks ducks mentioned this pull request Sep 21, 2016
4 of 4 tasks complete
bors-servo added a commit that referenced this pull request Sep 26, 2016
Form action url 11219

First pass at fixing #10580.
I've added a new macro that returns a DomString with either the attr val or the doc url.
I then made the form element use that macro on the action attribute.
I also added a test that contains an iframe with a form and base url that submits to a page in
a resources directory.

I made all these changes based on #11219 (comment).

The only thing I'm confused on is how to change step 8. It looks to just be getting the action so I'm wondering if I need to change either step 9 or 10 instead?

---

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

- [X] There are tests for these changes OR

using that macro with the form action,
making the form submit process use base url,
adding tests.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13358)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this pull request Sep 26, 2016
Form action url 11219

First pass at fixing #10580.
I've added a new macro that returns a DomString with either the attr val or the doc url.
I then made the form element use that macro on the action attribute.
I also added a test that contains an iframe with a form and base url that submits to a page in
a resources directory.

I made all these changes based on #11219 (comment).

The only thing I'm confused on is how to change step 8. It looks to just be getting the action so I'm wondering if I need to change either step 9 or 10 instead?

---

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

- [X] There are tests for these changes OR

using that macro with the form action,
making the form submit process use base url,
adding tests.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13358)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this pull request Sep 27, 2016
Form action url 11219

First pass at fixing #10580.
I've added a new macro that returns a DomString with either the attr val or the doc url.
I then made the form element use that macro on the action attribute.
I also added a test that contains an iframe with a form and base url that submits to a page in
a resources directory.

I made all these changes based on #11219 (comment).

The only thing I'm confused on is how to change step 8. It looks to just be getting the action so I'm wondering if I need to change either step 9 or 10 instead?

---

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

- [X] There are tests for these changes OR

using that macro with the form action,
making the form submit process use base url,
adding tests.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13358)
<!-- Reviewable:end -->
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Feb 4, 2017
…rl-11219); r=mbrubeck

First pass at fixing #10580.
I've added a new macro that returns a DomString with either the attr val or the doc url.
I then made the form element use that macro on the action attribute.
I also added a test that contains an iframe with a form and base url that submits to a page in
a resources directory.

I made all these changes based on servo/servo#11219 (comment).

The only thing I'm confused on is how to change step 8. It looks to just be getting the action so I'm wondering if I need to change either step 9 or 10 instead?

---

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

- [X] There are tests for these changes OR

using that macro with the form action,
making the form submit process use base url,
adding tests.

Source-Repo: https://github.com/servo/servo
Source-Revision: 040075ad085f7e74f207241fedba144d710f42b7
xeonchen pushed a commit to xeonchen/gecko-cinnabar that referenced this pull request Feb 4, 2017
…rl-11219); r=mbrubeck

First pass at fixing #10580.
I've added a new macro that returns a DomString with either the attr val or the doc url.
I then made the form element use that macro on the action attribute.
I also added a test that contains an iframe with a form and base url that submits to a page in
a resources directory.

I made all these changes based on servo/servo#11219 (comment).

The only thing I'm confused on is how to change step 8. It looks to just be getting the action so I'm wondering if I need to change either step 9 or 10 instead?

---

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

- [X] There are tests for these changes OR

using that macro with the form action,
making the form submit process use base url,
adding tests.

Source-Repo: https://github.com/servo/servo
Source-Revision: 040075ad085f7e74f207241fedba144d710f42b7
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 1, 2019
…rl-11219); r=mbrubeck

First pass at fixing #10580.
I've added a new macro that returns a DomString with either the attr val or the doc url.
I then made the form element use that macro on the action attribute.
I also added a test that contains an iframe with a form and base url that submits to a page in
a resources directory.

I made all these changes based on servo/servo#11219 (comment).

The only thing I'm confused on is how to change step 8. It looks to just be getting the action so I'm wondering if I need to change either step 9 or 10 instead?

---

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

- [X] There are tests for these changes OR

using that macro with the form action,
making the form submit process use base url,
adding tests.

Source-Repo: https://github.com/servo/servo
Source-Revision: 040075ad085f7e74f207241fedba144d710f42b7

UltraBlame original commit: bd478fc9bb0ee7573e39cd9a48fe7d512981dbf1
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 1, 2019
…rl-11219); r=mbrubeck

First pass at fixing #10580.
I've added a new macro that returns a DomString with either the attr val or the doc url.
I then made the form element use that macro on the action attribute.
I also added a test that contains an iframe with a form and base url that submits to a page in
a resources directory.

I made all these changes based on servo/servo#11219 (comment).

The only thing I'm confused on is how to change step 8. It looks to just be getting the action so I'm wondering if I need to change either step 9 or 10 instead?

---

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

- [X] There are tests for these changes OR

using that macro with the form action,
making the form submit process use base url,
adding tests.

Source-Repo: https://github.com/servo/servo
Source-Revision: 040075ad085f7e74f207241fedba144d710f42b7

UltraBlame original commit: bd478fc9bb0ee7573e39cd9a48fe7d512981dbf1
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 1, 2019
…rl-11219); r=mbrubeck

First pass at fixing #10580.
I've added a new macro that returns a DomString with either the attr val or the doc url.
I then made the form element use that macro on the action attribute.
I also added a test that contains an iframe with a form and base url that submits to a page in
a resources directory.

I made all these changes based on servo/servo#11219 (comment).

The only thing I'm confused on is how to change step 8. It looks to just be getting the action so I'm wondering if I need to change either step 9 or 10 instead?

---

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

- [X] There are tests for these changes OR

using that macro with the form action,
making the form submit process use base url,
adding tests.

Source-Repo: https://github.com/servo/servo
Source-Revision: 040075ad085f7e74f207241fedba144d710f42b7

UltraBlame original commit: bd478fc9bb0ee7573e39cd9a48fe7d512981dbf1
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.

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