-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Fix #536: Abort document.open if origins mismatch #583
Conversation
This matches the implementation of Firefox, and will automatically resolve the issue that we use the document's origin for initializing the realm but the responsible document's url for setting the url: After this change, the document's origin and the responsible document's origin will be equal.
<li> | ||
<p>If the <span>origin</span> of the <code>Document</code> is not equal to the | ||
<span>origin</span> of the <span>responsible document</span> specified by the <span>entry | ||
settings object</span>, throw an <code>SecurityError</code> exception and abort these |
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.
s/an/a/
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.
done
note that Blink actually makes the doc's origin and alias of the responsible doc's origin, but FF doesn't. |
@@ -88391,6 +88391,13 @@ interface <dfn>WindowBase64</dfn> { | |||
<li><p>If the <code>Document</code> object is not an <span>active document</span>, then abort | |||
these steps.</p></li> | |||
|
|||
<li> |
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.
So the style conventions for this spec are a bit special, but when an <li>
(or <dd>
etc.) has only a single <p>
child, they flow together, as in the <li>
right above here. No clang-format for this, so we get to have fun in review :)
kinda - at least that's what FF implements as far as I can tell, and it would solve my specific problem (define what origin the resulting document should have) |
That's good! Can you tell if https://html.spec.whatwg.org/multipage/webappapis.html#set-up-a-browsing-context-environment-settings-object is till wrong? If this merely hides the issue in this instance, we need a separate issue to figure that out. |
it's a bit difficult to tell for me, as Blink's implementation of document.open() doesn't exactly align with the spec :-/ Maybe @bzbarsky can tell whether it's still not aligned with FF's implementation? |
So I think the way this is handled in Firefox is through a generic origin check at the IDL layer that applies to everything, not just |
well, at least in the source, there's an explicit check: http://mxr.mozilla.org/mozilla-central/source/dom/html/nsHTMLDocument.cpp#1497 |
There are two separate checks in Firefox. The first check, at the IDL layer, ensures that the effective script origin of the global of the Realm of the For In web-facing terms, the main effect of this in Firefox is that if two sites start out not-same-origin and then set The diff here looks good to me. |
updated the formatting |
Committed as 05599ab. Thank you! |
(I had to change the formatting a bit more, but no big deal.) |
@jeisinger, feel like writing a test for this case? |
I'll give it a try On Fri, Jan 29, 2016, 2:22 PM Ms2ger [email protected] wrote:
|
This matches the implementation of Firefox, and will automatically
resolve the issue that we use the document's origin for initializing the
realm but the responsible document's url for setting the url: After this
change, the document's origin and the responsible document's origin will
be equal.