Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2855263004: Throw in window.open() when an invalid URL is being passed (Closed)
Patch Set: updates Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 9427 matching lines...) Expand 10 before | Expand all | Expand 10 after
9438 MainFrame()->FirstChild()->Swap(remote_frame); 9438 MainFrame()->FirstChild()->Swap(remote_frame);
9439 remote_frame->SetReplicatedOrigin( 9439 remote_frame->SetReplicatedOrigin(
9440 WebSecurityOrigin::CreateFromString("http://127.0.0.1")); 9440 WebSecurityOrigin::CreateFromString("http://127.0.0.1"));
9441 9441
9442 ASSERT_TRUE(MainFrame()->IsWebLocalFrame()); 9442 ASSERT_TRUE(MainFrame()->IsWebLocalFrame());
9443 ASSERT_TRUE(MainFrame()->FirstChild()->IsWebRemoteFrame()); 9443 ASSERT_TRUE(MainFrame()->FirstChild()->IsWebRemoteFrame());
9444 LocalDOMWindow* main_window = 9444 LocalDOMWindow* main_window =
9445 ToWebLocalFrameImpl(MainFrame())->GetFrame()->DomWindow(); 9445 ToWebLocalFrameImpl(MainFrame())->GetFrame()->DomWindow();
9446 9446
9447 KURL destination = ToKURL("data:text/html:destination"); 9447 KURL destination = ToKURL("data:text/html:destination");
9448 NonThrowableExceptionState exception_state;
9448 main_window->open(destination.GetString(), "frame1", "", main_window, 9449 main_window->open(destination.GetString(), "frame1", "", main_window,
9449 main_window); 9450 main_window, exception_state);
9450 ASSERT_FALSE(remote_client.LastRequest().IsNull()); 9451 ASSERT_FALSE(remote_client.LastRequest().IsNull());
9451 EXPECT_EQ(remote_client.LastRequest().Url(), WebURL(destination)); 9452 EXPECT_EQ(remote_client.LastRequest().Url(), WebURL(destination));
9452 9453
9453 // Pointing a named frame to an empty URL should just return a reference to 9454 // Pointing a named frame to an empty URL should just return a reference to
9454 // the frame's window without navigating it. 9455 // the frame's window without navigating it.
9455 DOMWindow* result = 9456 DOMWindow* result = main_window->open("", "frame1", "", main_window,
9456 main_window->open("", "frame1", "", main_window, main_window); 9457 main_window, exception_state);
9457 EXPECT_EQ(remote_client.LastRequest().Url(), WebURL(destination)); 9458 EXPECT_EQ(remote_client.LastRequest().Url(), WebURL(destination));
9458 EXPECT_EQ(result, WebFrame::ToCoreFrame(*remote_frame)->DomWindow()); 9459 EXPECT_EQ(result, WebFrame::ToCoreFrame(*remote_frame)->DomWindow());
9459 9460
9460 Reset(); 9461 Reset();
9461 } 9462 }
9462 9463
9463 class RemoteWindowCloseClient : public FrameTestHelpers::TestWebViewClient { 9464 class RemoteWindowCloseClient : public FrameTestHelpers::TestWebViewClient {
9464 public: 9465 public:
9465 RemoteWindowCloseClient() : closed_(false) {} 9466 RemoteWindowCloseClient() : closed_(false) {}
9466 9467
(...skipping 2570 matching lines...) Expand 10 before | Expand all | Expand 10 after
12037 12038
12038 // Failing the original child frame navigation and trying to render fallback 12039 // Failing the original child frame navigation and trying to render fallback
12039 // content shouldn't crash. It should return NoLoadInProgress. This is so the 12040 // content shouldn't crash. It should return NoLoadInProgress. This is so the
12040 // caller won't attempt to replace the correctly empty frame with an error 12041 // caller won't attempt to replace the correctly empty frame with an error
12041 // page. 12042 // page.
12042 EXPECT_EQ(WebLocalFrame::NoLoadInProgress, 12043 EXPECT_EQ(WebLocalFrame::NoLoadInProgress,
12043 child->MaybeRenderFallbackContent(WebURLError())); 12044 child->MaybeRenderFallbackContent(WebURLError()));
12044 } 12045 }
12045 12046
12046 } // namespace blink 12047 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698