summaryrefslogtreecommitdiffstats
path: root/chrome/test/data
diff options
context:
space:
mode:
authorlazyboy <lazyboy@chromium.org>2015-07-31 19:05:56 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-01 02:06:37 +0000
commit9ca4291019ed006cf1c3c696402aa694f3f4652c (patch)
tree6fe98ddff5af5c51e91ea9ae48908582e3928963 /chrome/test/data
parent10da79fd9b66f7b12bc7608d4346cceef1c741af (diff)
downloadchromium_src-9ca4291019ed006cf1c3c696402aa694f3f4652c.zip
chromium_src-9ca4291019ed006cf1c3c696402aa694f3f4652c.tar.gz
chromium_src-9ca4291019ed006cf1c3c696402aa694f3f4652c.tar.bz2
Subframes in inner WebContents should not create proxies in process of outer WebContents.
In an inner WebContents main frame process, we create a proxy for the outer WebContents. However, we do not need proxies in the outer WebContents for all of the subframes in the inner WebContents. Omitting such proxies fixes issues with subframes inside <webview> when using OOPIFs (under --site-per-process). Previously we'd fail a CHECK(frame_tree_node_->IsMainFrame()) in RFHM::CreateRenderFrameProxy() while creating these proxies: RFHM::CreateRenderFrameProxy() would not find an RVH in the outer delegate's SiteInstance and it would try to create one for this subframe. However, RVH creation is only allowed on main frames. TBR=jam@chromium.org for chromium.fyi.json BUG=500957 Test=Open a <webview> in a chrome app with --site-per-process. Load an <iframe> inside the <webview>. This should work and not crash the browser/ process. Review URL: https://codereview.chromium.org/1262563003 Cr-Commit-Position: refs/heads/master@{#341455}
Diffstat (limited to 'chrome/test/data')
-rw-r--r--chrome/test/data/extensions/platform_apps/web_view/shim/child_frame.html9
-rw-r--r--chrome/test/data/extensions/platform_apps/web_view/shim/main.js50
-rw-r--r--chrome/test/data/extensions/platform_apps/web_view/shim/manifest.json2
-rw-r--r--chrome/test/data/extensions/platform_apps/web_view/shim/parent_frame.html35
4 files changed, 96 insertions, 0 deletions
diff --git a/chrome/test/data/extensions/platform_apps/web_view/shim/child_frame.html b/chrome/test/data/extensions/platform_apps/web_view/shim/child_frame.html
new file mode 100644
index 0000000..46b1fb9
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/web_view/shim/child_frame.html
@@ -0,0 +1,9 @@
+<!--
+ * Copyright (c) 2015 The Chromium Authors. All rights reserved. Use of this
+ * source code is governed by a BSD-style license that can be found in the
+ * LICENSE file.
+-->
+<body>
+ <!-- Our parent frame will navigate this frame. -->
+ <iframe id="child-frame"></iframe>
+</body>
diff --git a/chrome/test/data/extensions/platform_apps/web_view/shim/main.js b/chrome/test/data/extensions/platform_apps/web_view/shim/main.js
index a8e0c09..7c6a29f 100644
--- a/chrome/test/data/extensions/platform_apps/web_view/shim/main.js
+++ b/chrome/test/data/extensions/platform_apps/web_view/shim/main.js
@@ -1334,6 +1334,54 @@ function testNavOnConsecutiveSrcAttributeChanges() {
webview.src = testPage3;
}
+function testNestedCrossOriginSubframes() {
+ var webview = document.createElement('webview');
+ var nestedFrameURL = embedder.baseGuestURL +
+ '/extensions/platform_apps/web_view/shim/parent_frame.html';
+ webview.onconsolemessage = function(e) {
+ window.console.log('guest.consolemessage ' + e.message);
+ };
+ webview.onloadstop = function() {
+ window.onmessage = function(e) {
+ if (e.data == 'frames-loaded') {
+ embedder.test.succeed();
+ }
+ };
+
+ // Ask the <webview> to load nested frames. It will reply via postMessage
+ // once frames have finished loading.
+ webview.contentWindow.postMessage('load-frames', '*');
+ };
+ webview.onloadabort = embedder.test.fail;
+
+ webview.src = nestedFrameURL;
+ document.body.appendChild(webview);
+}
+
+function testNestedSubframes() {
+ var webview = document.createElement('webview');
+ webview.partition = 'foobar';
+ var nestedFrameURL = 'parent_frame.html';
+ webview.onconsolemessage = function(e) {
+ window.console.log('guest.consolemessage ' + e.message);
+ };
+ webview.onloadstop = function() {
+ window.onmessage = function(e) {
+ if (e.data == 'frames-loaded') {
+ embedder.test.succeed();
+ }
+ };
+
+ // Ask the <webview> to load nested frames. It will reply via postMessage
+ // once frames have finished loading.
+ webview.contentWindow.postMessage('load-frames', '*');
+ };
+ webview.onloadabort = embedder.test.fail;
+
+ webview.src = nestedFrameURL;
+ document.body.appendChild(webview);
+}
+
// This test verifies that we can set the <webview> src multiple times and the
// changes will cause a navigation.
function testNavOnSrcAttributeChange() {
@@ -2852,6 +2900,8 @@ embedder.test.testList = {
'testNavOnConsecutiveSrcAttributeChanges':
testNavOnConsecutiveSrcAttributeChanges,
'testNavOnSrcAttributeChange': testNavOnSrcAttributeChange,
+ 'testNestedCrossOriginSubframes': testNestedCrossOriginSubframes,
+ 'testNestedSubframes': testNestedSubframes,
'testReassignSrcAttribute': testReassignSrcAttribute,
'testRemoveSrcAttribute': testRemoveSrcAttribute,
'testPluginLoadInternalResource': testPluginLoadInternalResource,
diff --git a/chrome/test/data/extensions/platform_apps/web_view/shim/manifest.json b/chrome/test/data/extensions/platform_apps/web_view/shim/manifest.json
index 715a08b..a9d1567 100644
--- a/chrome/test/data/extensions/platform_apps/web_view/shim/manifest.json
+++ b/chrome/test/data/extensions/platform_apps/web_view/shim/manifest.json
@@ -14,6 +14,8 @@
{
"name": "foobar",
"accessible_resources": [
+ "child_frame.html",
+ "parent_frame.html",
"guest_with_inline_script.html",
"test.pdf"
]
diff --git a/chrome/test/data/extensions/platform_apps/web_view/shim/parent_frame.html b/chrome/test/data/extensions/platform_apps/web_view/shim/parent_frame.html
new file mode 100644
index 0000000..e323104
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/web_view/shim/parent_frame.html
@@ -0,0 +1,35 @@
+<!--
+ * Copyright (c) 2015 The Chromium Authors. All rights reserved. Use of this
+ * source code is governed by a BSD-style license that can be found in the
+ * LICENSE file.
+-->
+<body>
+ <iframe></iframe>
+ <script>
+ var frame = document.querySelector('iframe');
+ var port = null;
+ var seenRequest = false;
+
+ // Message arrives from <webview>.
+ window.onmessage = function(e) {
+ seenRequest = true;
+ port = e.source;
+ if (e.data == 'load-frames') {
+ // Start loading the iframe.
+ frame.src = 'child_frame.html';
+ }
+ };
+
+ frame.onload = function() {
+ if (seenRequest) {
+ var childFrame =
+ frame.contentWindow.document.getElementById('child-frame');
+ childFrame.onload = function() {
+ port.postMessage('frames-loaded', '*');
+ };
+ // Load the nested iframe.
+ childFrame.src = 'data:text/html,Hello';
+ }
+ };
+ </script>
+</body>