| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/test/histogram_tester.h" | 8 #include "base/test/histogram_tester.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // attacker-controlled value in a resource on the extension origin. | 171 // attacker-controlled value in a resource on the extension origin. |
| 172 content::PwnMessageHelper::FileSystemWrite(rfh->GetProcess(), 24, target_url, | 172 content::PwnMessageHelper::FileSystemWrite(rfh->GetProcess(), 24, target_url, |
| 173 blob_id, 0); | 173 blob_id, 0); |
| 174 | 174 |
| 175 // Now navigate to |target_url| in a new tab. It should not contain |payload|. | 175 // Now navigate to |target_url| in a new tab. It should not contain |payload|. |
| 176 AddTabAtIndex(0, target_url, ui::PAGE_TRANSITION_TYPED); | 176 AddTabAtIndex(0, target_url, ui::PAGE_TRANSITION_TYPED); |
| 177 content::WaitForLoadStop(browser()->tab_strip_model()->GetWebContentsAt(0)); | 177 content::WaitForLoadStop(browser()->tab_strip_model()->GetWebContentsAt(0)); |
| 178 rfh = browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(); | 178 rfh = browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(); |
| 179 EXPECT_EQ(GURL(target_origin), rfh->GetSiteInstance()->GetSiteURL()); | 179 EXPECT_EQ(GURL(target_origin), rfh->GetSiteInstance()->GetSiteURL()); |
| 180 std::string body; | 180 std::string body; |
| 181 EXPECT_TRUE(content::ExecuteScriptAndExtractString( | 181 std::string script = R"( |
| 182 rfh, "window.domAutomationController.send(document.body.innerText);", | 182 var textContent = document.body.innerText.replace(/\n+/g, '\n'); |
| 183 &body)); | 183 window.domAutomationController.send(textContent); |
| 184 )"; |
| 185 |
| 186 EXPECT_TRUE(content::ExecuteScriptAndExtractString(rfh, script, &body)); |
| 184 if (extensions::IsIsolateExtensionsEnabled()) { | 187 if (extensions::IsIsolateExtensionsEnabled()) { |
| 185 EXPECT_EQ( | 188 EXPECT_EQ( |
| 186 "\nYour file was not found\n\n" | 189 "\nYour file was not found\n" |
| 187 "It may have been moved or deleted.\n" | 190 "It may have been moved or deleted.\n" |
| 188 "ERR_FILE_NOT_FOUND\n", | 191 "ERR_FILE_NOT_FOUND\n", |
| 189 body); | 192 body); |
| 190 } else { | 193 } else { |
| 191 // Without --isolate-extensions, the above steps must succeed, since | 194 // Without --isolate-extensions, the above steps must succeed, since |
| 192 // unblessed extension frames are allowed in ordinary renderer processes. | 195 // unblessed extension frames are allowed in ordinary renderer processes. |
| 193 EXPECT_EQ("pwned.", body); | 196 EXPECT_EQ("pwned.", body); |
| 194 } | 197 } |
| 195 } | 198 } |
| OLD | NEW |