Changeset 116686 in webkit
- Timestamp:
- May 10, 2012 2:14:12 PM (12 years ago)
- Location:
- trunk/Source/WebKit/chromium
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/chromium/ChangeLog
r116671 r116686 1 2012-05-10 Tom Sepez <tsepez@chromium.org> 2 3 [Chromium] WebFrameTest.ChromePageNoJavascript isn't catching regressions 4 https://bugs.webkit.org/show_bug.cgi?id=86046 5 6 Reviewed by Adam Barth. 7 8 Test both cases for registerURLSchemeAsNotAllowingJavascriptURLs. Also add 9 a call to layout() to ensure the javascript result is seen. 10 11 * tests/WebFrameTest.cpp: 12 (WebKit::TEST_F): 13 (WebKit): 14 1 15 2012-05-10 Varun Jain <varunjain@google.com> 2 16 -
trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp
r116608 r116686 138 138 } 139 139 140 TEST_F(WebFrameTest, ChromePageJavascript) 141 { 142 registerMockedChromeURLLoad("history.html"); 143 144 // Pass true to enable JavaScript. 145 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true); 146 147 // Try to run JS against the chrome-style URL. 148 FrameTestHelpers::loadFrame(webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))"); 149 150 // Required to see any updates in contentAsText. 151 webView->layout(); 152 153 // Now retrieve the frame's text and ensure it was modified by running javascript. 154 std::string content = webView->mainFrame()->contentAsText(1024).utf8(); 155 EXPECT_NE(std::string::npos, content.find("Clobbered")); 156 } 157 140 158 TEST_F(WebFrameTest, ChromePageNoJavascript) 141 159 { 142 160 registerMockedChromeURLLoad("history.html"); 143 161 162 /// Pass true to enable JavaScript. 144 163 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true); 145 164 146 // Try to run JS against the chrome-style URL .165 // Try to run JS against the chrome-style URL after prohibiting it. 147 166 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs("chrome"); 148 167 FrameTestHelpers::loadFrame(webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))"); 149 168 150 // Now retrieve the frames text and see if it was clobbered. 169 // Required to see any updates in contentAsText. 170 webView->layout(); 171 172 // Now retrieve the frame's text and ensure it wasn't modified by running javascript. 151 173 std::string content = webView->mainFrame()->contentAsText(1024).utf8(); 152 EXPECT_NE(std::string::npos, content.find("Simulated Chromium History Page"));153 174 EXPECT_EQ(std::string::npos, content.find("Clobbered")); 154 175 }
Note: See TracChangeset
for help on using the changeset viewer.