OLD | NEW |
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 7615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7626 TestConsoleMessageWebFrameClient popupWebFrameClient; | 7626 TestConsoleMessageWebFrameClient popupWebFrameClient; |
7627 WebView* popupView = popupWebViewHelper.initializeAndLoad(m_chromeURL + "hel
lo_world.html", true, &popupWebFrameClient); | 7627 WebView* popupView = popupWebViewHelper.initializeAndLoad(m_chromeURL + "hel
lo_world.html", true, &popupWebFrameClient); |
7628 popupView->mainFrame()->setOpener(webViewHelper.webView()->mainFrame()); | 7628 popupView->mainFrame()->setOpener(webViewHelper.webView()->mainFrame()); |
7629 | 7629 |
7630 // Attempt a blocked navigation of an opener's subframe, and ensure that | 7630 // Attempt a blocked navigation of an opener's subframe, and ensure that |
7631 // the error shows up on the popup (calling) window's console, rather than | 7631 // the error shows up on the popup (calling) window's console, rather than |
7632 // the target window. | 7632 // the target window. |
7633 popupView->mainFrame()->executeScript(WebScriptSource("opener.frames[1].loca
tion.href='data:text/html,foo'")); | 7633 popupView->mainFrame()->executeScript(WebScriptSource("opener.frames[1].loca
tion.href='data:text/html,foo'")); |
7634 EXPECT_TRUE(webFrameClient.messages.empty()); | 7634 EXPECT_TRUE(webFrameClient.messages.empty()); |
7635 ASSERT_EQ(1u, popupWebFrameClient.messages.size()); | 7635 ASSERT_EQ(1u, popupWebFrameClient.messages.size()); |
7636 EXPECT_TRUE(std::string::npos != popupWebFrameClient.messages[0].text.utf8()
.find("Unsafe JavaScript attempt to initiate navigation")); | 7636 EXPECT_TRUE(std::string::npos != popupWebFrameClient.messages[0].text.utf8()
.find("Uncaught SecurityError: Blocked a frame with origin")); |
7637 | 7637 |
7638 // Try setting a cross-origin iframe element's source to a javascript: URL, | 7638 // Try setting a cross-origin iframe element's source to a javascript: URL, |
7639 // and check that this error is also printed on the calling window. | 7639 // and check that this error is also printed on the calling window. |
7640 popupView->mainFrame()->executeScript(WebScriptSource("opener.document.query
SelectorAll('iframe')[1].src='javascript:alert()'")); | 7640 popupView->mainFrame()->executeScript(WebScriptSource("opener.document.query
SelectorAll('iframe')[1].src='javascript:alert()'")); |
7641 EXPECT_TRUE(webFrameClient.messages.empty()); | 7641 EXPECT_TRUE(webFrameClient.messages.empty()); |
7642 ASSERT_EQ(2u, popupWebFrameClient.messages.size()); | 7642 ASSERT_EQ(2u, popupWebFrameClient.messages.size()); |
7643 EXPECT_TRUE(std::string::npos != popupWebFrameClient.messages[1].text.utf8()
.find("Blocked a frame")); | 7643 EXPECT_TRUE(std::string::npos != popupWebFrameClient.messages[1].text.utf8()
.find("Blocked a frame")); |
7644 | 7644 |
7645 // Manually reset to break WebViewHelpers' dependencies on the stack | 7645 // Manually reset to break WebViewHelpers' dependencies on the stack |
7646 // allocated WebFrameClients. | 7646 // allocated WebFrameClients. |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8006 | 8006 |
8007 TEST_F(WebFrameTest, MaxFramesDetach) | 8007 TEST_F(WebFrameTest, MaxFramesDetach) |
8008 { | 8008 { |
8009 registerMockedHttpURLLoad("max-frames-detach.html"); | 8009 registerMockedHttpURLLoad("max-frames-detach.html"); |
8010 FrameTestHelpers::WebViewHelper webViewHelper; | 8010 FrameTestHelpers::WebViewHelper webViewHelper; |
8011 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); | 8011 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); |
8012 webViewImpl->mainFrameImpl()->collectGarbage(); | 8012 webViewImpl->mainFrameImpl()->collectGarbage(); |
8013 } | 8013 } |
8014 | 8014 |
8015 } // namespace blink | 8015 } // namespace blink |
OLD | NEW |