New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 596311 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 496814
Owner: ----
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Feature



Sign in to add a comment

issues with the protocol behavior of about:blank iframes

Reported by lahat....@gmail.com, Mar 20 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.75 Safari/537.36

Steps to reproduce the problem:
There are two issues with how the protocol of empty iframes works which I think require improvement.

Relative protocol in nested empty iframes:
---------------------------
1. Create an iframe with about:blank src.
2. Create an iframe with about:blank src inside the above mentioned empty iframe.
3. Add a resource to the nested empty iframe with a relative path, for example: <script src="//resource.com/script.js"></script>
The script will not load because it will inherit the protocol from the parent empty iframe resulting in about://resource.com/script.js

history.pushState stopped working in empty iframe (I think since chrome 45):
---------------------------
Empty iframes are used in many cases to isolate the load of external resource from the page while allowing them some access and visibility, for example adverts, videos, etc.

Many of those third parties use the following check to decide the type of protocol they should use:
var domain = window.location.protocol == "https:" ? "secure.domain.com" : "non-secure.domain.com".
In empty iframes running in SSL pages the above will result in the non secure domain.

In the past the solution for this problem was:
history.replaceState({}, null, window.parent.location.href);

I understand the reasoning behind why this was disabled, but is there a way to solve this?
I don't believe this is a rare situation and when using third parties there's no way to fix this without them fixing their implementation.

What is the expected behavior?

What went wrong?
Wrong protocol

Did this work before? Yes Chrome 44 and below

Chrome version: 49.0.2623.75  Channel: stable
OS Version: OS X 10.11.0
Flash Version: Shockwave Flash 21.0 r0
 
Cc: tkonch...@chromium.org
Labels: Needs-Feedback
Could you please provide a sample test case/HTML file to reproduce the issue from test team end.

Comment 2 by lahat....@gmail.com, Mar 21 2016

Attached is a test page that demonstrates the two issues.

Re:second issue, a suggestion could be an iframe attribute or a sandbox option that tells the iframe to have the same location as it's parent, something that will have the same effect as:
history.replaceState({}, null, window.parent.location.href);
empty-iframe-issues-test-page.html
1.3 KB View Download
Project Member

Comment 3 by sheriffbot@chromium.org, Mar 22 2016

Labels: -Needs-Feedback Needs-Review
Owner: tkonch...@chromium.org
Status: Assigned (was: Unconfirmed)
Thank you for providing more feedback. Assigning to requester "tkonchada@chromium.org" for another review.

For more details visit https://sites.google.com/a/chromium.org/dev/issue-tracking/autotriage - Your friendly Sheriffbot
Components: Blink>HTML>IFrame
Labels: -Needs-Review Needs-Feedback
Owner: ----
Status: Unconfirmed (was: Assigned)
Tested the same on mac 10.11 chrome version 50.0.2661.87 - observed the output as shown in the screenshot

Could you please let us know what should be the expected output.
Screen Shot 2016-04-26 at 3.57.23 PM.png
127 KB View Download

Comment 6 by lahat....@gmail.com, Apr 26 2016

Thank you for following up on the issue.

For the first scenario I would expect that in nested empty iframes relative protocols would continue to inherit the topmost relevant protocol.
Example: I'm on https://website.com, an about:blank iframe and another about:blank iframe in it and then a script tag pointing to "//domain.com/script.js".
Current: Chrome will attempt to load about://domain.com/script.js
Expected: Chrome will attempt to load https://domain.com/script.js


what about history.replaceState which stopped working on empty iframes?
Project Member

Comment 7 by sheriffbot@chromium.org, Apr 26 2016

Labels: -Needs-Feedback Needs-Review
Owner: tkonch...@chromium.org
Thank you for providing more feedback. Adding requester "tkonchada@chromium.org" for another review and adding "Needs-Review" label for tracking.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 8 by dcheng@chromium.org, Apr 26 2016

Cc: creis@chromium.org mkwst@chromium.org
Labels: -Needs-Review
Owner: ----
Status: Untriaged (was: Unconfirmed)

Comment 10 by tkent@chromium.org, Jul 29 2016

Components: Blink>Loader
Labels: Hotlist-Interop
Status: Available (was: Untriaged)
Firefox and Edge uses the top-level document URL as the base of relative URLs in the nested IFRAME. Safari has the same behaivor as Chrome.

https://html.spec.whatwg.org/multipage/infrastructure.html#fallback-base-url
> 2. If document's URL is about:blank, and document's browsing context has a creator browsing context, then return the creator base URL.

https://html.spec.whatwg.org/multipage/embedded-content.html#the-iframe-element:the-iframe-element-6
> When an iframe element is inserted into a document that has a browsing context, the user agent must create a new browsing context, set the element's nested browsing context to the newly-created browsing context, and then process the iframe attributes for the "first time".

It's unclear if we should make the former browsing context a creator browsing context of the new one.
Maybe we should file a spec bug to clarify it.

Comment 11 by tkent@chromium.org, Jul 29 2016

As for history.replaceState(), would you file a new issue please?

Comment 12 by tkent@chromium.org, Jul 27 2017

Mergedinto: 496814
Status: Duplicate (was: Available)

Sign in to add a comment