summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/web_navigation
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/extensions/api/web_navigation')
-rw-r--r--chrome/browser/extensions/api/web_navigation/web_navigation_api.cc6
-rw-r--r--chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc8
-rw-r--r--chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc7
3 files changed, 12 insertions, 9 deletions
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
index 13bf2af..635636e 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -26,6 +26,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
#include "extensions/browser/event_router.h"
+#include "extensions/browser/extension_api_frame_id_map.h"
#include "extensions/browser/view_type_utils.h"
#include "net/base/net_errors.h"
@@ -492,7 +493,6 @@ bool WebNavigationGetFrameFunction::RunSync() {
EXTENSION_FUNCTION_VALIDATE(params.get());
int tab_id = params->details.tab_id;
int frame_id = params->details.frame_id;
- int process_id = params->details.process_id;
SetResult(base::Value::CreateNullValue());
@@ -516,8 +516,8 @@ bool WebNavigationGetFrameFunction::RunSync() {
observer->frame_navigation_state();
content::RenderFrameHost* render_frame_host =
- frame_id == 0 ? web_contents->GetMainFrame()
- : content::RenderFrameHost::FromID(process_id, frame_id);
+ ExtensionApiFrameIdMap::Get()->GetRenderFrameHostById(web_contents,
+ frame_id);
if (!frame_navigation_state.IsValidFrame(render_frame_host))
return true;
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc
index a8b027a..14612ed 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc
@@ -21,6 +21,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/event_router.h"
+#include "extensions/browser/extension_api_frame_id_map.h"
#include "extensions/common/event_filtering_info.h"
#include "net/base/net_errors.h"
#include "ui/base/page_transition_types.h"
@@ -62,15 +63,10 @@ void DispatchEvent(content::BrowserContext* browser_context,
} // namespace
int GetFrameId(content::RenderFrameHost* frame_host) {
- if (!frame_host)
- return -1;
- return !frame_host->GetParent() ? 0 : frame_host->GetRoutingID();
+ return ExtensionApiFrameIdMap::GetFrameId(frame_host);
}
// Constructs and dispatches an onBeforeNavigate event.
-// TODO(dcheng): Is the parent process ID needed here? http://crbug.com/393640
-// Collisions are probably possible... but maybe this won't ever happen because
-// of the SiteInstance grouping policies.
void DispatchOnBeforeNavigate(content::WebContents* web_contents,
content::RenderFrameHost* frame_host,
const GURL& validated_url) {
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
index e2c2379..46d1020d 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
@@ -44,6 +44,7 @@
#include "content/public/common/resource_type.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test_utils.h"
+#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/switches.h"
#include "extensions/test/result_catcher.h"
@@ -739,6 +740,12 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessHistory) {
<< message_;
}
+IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessIframe) {
+ content::IsolateAllSitesForTesting(base::CommandLine::ForCurrentProcess());
+ ASSERT_TRUE(StartEmbeddedTestServer());
+ ASSERT_TRUE(RunExtensionTest("webnavigation/crossProcessIframe")) << message_;
+}
+
// TODO(jam): http://crbug.com/350550
#if !(defined(OS_CHROMEOS) && defined(ADDRESS_SANITIZER))
IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, Crash) {