-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Correct URL parsing of base elements #1064
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12073,9 +12073,10 @@ gave me some of the songs they wrote. I love sharing my music.</p> | |
data-x="attr-base-target">target</code> attributes, all but the first are ignored.</p> | ||
|
||
<p>A <code>base</code> element that is the first <code>base</code> element with an <code | ||
data-x="attr-base-href">href</code> content attribute in a particular <code>Document</code> has a | ||
<dfn>frozen base URL</dfn>. The <span>frozen base URL</span> must be <span>immediately</span> <span data-x="set the frozen | ||
base URL">set</span> for an element whenever any of the following situations occur:</p> | ||
data-x="attr-base-href">href</code> content attribute <span>in a <code>Document</code></span> has | ||
a <dfn>frozen base URL</dfn>. The <span>frozen base URL</span> must be <span>immediately</span> | ||
<span data-x="set the frozen base URL">set</span> for an element whenever any of the following | ||
situations occur:</p> | ||
|
||
<ul class="brief"> | ||
|
||
|
@@ -12095,47 +12096,46 @@ gave me some of the songs they wrote. I love sharing my music.</p> | |
<ol> | ||
<li><p>Let <var>document</var> be <var>element</var>'s <span>node document</span>. | ||
|
||
<li><p><span data-x="parse a URL">Parse</span> the value of <var>element</var>'s <code | ||
data-x="attr-base-href">href</code> content attribute relative to <var>document</var>.</p></li> | ||
|
||
<li> | ||
<p>If that algorithm fails or if running <span>Is base allowed for Document?</span> on the | ||
<span>resulting URL record</span> and <var>document</var> returns "<code | ||
data-x="">Blocked</code>", then set <var>element</var>'s <span>frozen base URL</span> to the | ||
<span>fallback base URL</span>.</p> | ||
<li><p>Let <var>urlRecord</var> be the result of <span data-x="URL parser">parsing</span> the | ||
value of <var>element</var>'s <code data-x="attr-base-href">href</code> content attribute with | ||
<var>document</var>'s <span>fallback base URL</span>, and <var>document</var>'s <span | ||
data-x="document's character encoding">character encoding</span>. (Thus, the <code>base</code> | ||
element isn't affected by itself.)</p></li> | ||
<!-- This uses the URL parser rather than parse a URL since otherwise we'd have to unnessarily | ||
complicate the latter for two callsites. --> | ||
|
||
<p>Otherwise, set <var>element</var>'s <span>frozen base URL</span> to the <var>resulting URL | ||
record</var>.</p> | ||
</li> | ||
<li><p>Set <var>element</var>'s <span>frozen base URL</span> to <var>document</var>'s | ||
<span>fallback base URL</span>, if <var>urlRecord</var> is failure or running <span>Is base | ||
allowed for Document?</span> on the <span>resulting URL record</span> and <var>document</var> | ||
returns "<code data-x="">Blocked</code>", and to <var>urlRecord</var> otherwise.</p></li> | ||
</ol> | ||
|
||
<p>The <dfn><code data-x="dom-base-href">href</code></dfn> IDL attribute, on getting, must return | ||
the result of running the following algorithm: | ||
<!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1715 | ||
https://github.com/whatwg/html/issues/1060#issuecomment-211221664 --> | ||
|
||
<ol> <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1715 --> | ||
|
||
<li><p>If the <code>base</code> element has no <code data-x="attr-base-href">href</code> content | ||
attribute, then return the <span>document base URL</span> and abort these steps.</p></li> | ||
<ol> | ||
<li><p>If this element has a <span>frozen base URL</span>, return it, <span | ||
data-x="concept-url-serialiser">serialised</span>.</p></li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: "return its serialization" sounds a little better to my ear. |
||
|
||
<li><p>Let <var>fallback base url</var> be the <code>Document</code>'s <span>fallback | ||
base URL</span>.</p></li> | ||
<li><p>Let <var>document</var> be <var>element</var>'s <span>node document</span>. | ||
|
||
<li><p>Let <var>url</var> be the value of the <code data-x="attr-base-href">href</code> | ||
attribute of the <code>base</code> element.</p></li> | ||
attribute of this element, if it has one, and the empty string otherwise.</p></li> | ||
|
||
<li><p>Let <var>urlRecord</var> be the result of <span data-x="URL parser">parsing</span> | ||
<var>url</var> with <var>fallback base url</var>, and the <code>Document</code>'s <span | ||
data-x="document's character encoding">character encoding</span>. (Thus, the <code>base</code>'s | ||
<code data-x="attr-base-href">href</code> attribute isn't affected by other <code>base</code> | ||
elements).</p></li> | ||
<var>url</var> with <var>document</var>'s <span>fallback base URL</span>, and | ||
<var>document</var>'s <span data-x="document's character encoding">character encoding</span>. | ||
(Thus, the <code>base</code> element isn't affected by other <code>base</code> elements or | ||
itself.)</p></li> | ||
<!-- This uses the URL parser rather than parse a URL since otherwise we'd have to unnessarily | ||
complicate the latter for this single callsite. --> | ||
complicate the latter for two callsites. --> | ||
|
||
<li><p>If <var>urlRecord</var> is failure, return the empty string.</p></li> | ||
|
||
<li><p>Return the <span data-x="concept-url-serialiser">serialisation</span> of | ||
<var>urlRecord</var>.</p></li> | ||
|
||
</ol> | ||
|
||
<p>The <code data-x="dom-base-href">href</code> IDL attribute, on setting, must set the <code | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CSP integration LGTM.