def test_cross_origin_iframe(session, server_config): session.url = inline(iframe("", subdomain="www")) frame_element = session.find.css("iframe", all=False) response = switch_to_frame(session, frame_element) value = assert_success(response) assert document_location(session).startswith("http://www.{}".format( server_config["browser_host"]))
def test_cross_origin_iframe(session, server_config, inline, iframe): session.url = inline(iframe("", domain="alt")) frame_element = session.find.css("iframe", all=False) response = switch_to_frame(session, frame_element) assert_success(response) parse_result = urlparse(document_location(session)) assert parse_result.netloc != server_config["browser_host"]
def test_nested_cross_origin_iframe(session, server_config): frame2 = iframe("", subdomain="www.www") frame1 = iframe(frame2, subdomain="www") top_doc = inline(frame1, subdomain="") session.url = top_doc assert document_location(session).startswith("http://{}".format( server_config["browser_host"])) frame1_el = session.find.css("iframe", all=False) response = switch_to_frame(session, frame1_el) value = assert_success(response) assert document_location(session).startswith("http://www.{}".format( server_config["browser_host"])) frame2_el = session.find.css("iframe", all=False) response = switch_to_frame(session, frame2_el) value = assert_success(response) assert document_location(session).startswith("http://www.www.{}".format( server_config["browser_host"]))
def test_nested_cross_origin_iframe(session, server_config, inline, iframe): frame2 = iframe("", domain="alt", subdomain="www") frame1 = iframe(frame2) top_doc = inline(frame1, domain="alt") session.url = top_doc parse_result = urlparse(document_location(session)) top_level_host = parse_result.netloc assert not top_level_host.startswith(server_config["browser_host"]) frame1_element = session.find.css("iframe", all=False) response = switch_to_frame(session, frame1_element) assert_success(response) parse_result = urlparse(document_location(session)) assert parse_result.netloc.startswith(server_config["browser_host"]) frame2_el = session.find.css("iframe", all=False) response = switch_to_frame(session, frame2_el) assert_success(response) parse_result = urlparse(document_location(session)) assert parse_result.netloc == "www.{}".format(top_level_host)