summaryrefslogtreecommitdiffstats
path: root/extensions/browser/api
diff options
context:
space:
mode:
authordcheng <dcheng@chromium.org>2016-03-01 11:15:51 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-01 19:17:50 +0000
commit9e24bd35f58fff1562b0784be8ab2e612ece6408 (patch)
tree981bb6a7b8e8a68ce34ce9232b461ad4fa8f8a6b /extensions/browser/api
parent372f7658f370076484322aed8e15756cea64ee53 (diff)
downloadchromium_src-9e24bd35f58fff1562b0784be8ab2e612ece6408.zip
chromium_src-9e24bd35f58fff1562b0784be8ab2e612ece6408.tar.gz
chromium_src-9e24bd35f58fff1562b0784be8ab2e612ece6408.tar.bz2
Plumb the correct owner document through DocumentInit::m_owner.
The current code tries to determine the security origin to inherit (if any) too late in document initialization. This results in strange and hard to understand behavior. For example, opener is not set until /after/ the document's security context is already initialized. To make this work, initSecurityContext() has a heuristic: if it should have inherited a security origin (e.g. the URL is about:blank) but there's nothing to inherit from, it initializes the security origin as unique, but then marks initialization as failed. When the opener is /actually/ set, it then calls initSecurityContext() again. Since the security context hasn't been marked as initialized yet, the reinitialization is allowed to proceed, and now the frame inherits its opener's security origin. Rather than going through this elaborate dance, this CL gets rid of it and proactively plumbs through the correct owner document to use. With these changes: - A security context can never be reinitialized. This requires passing the opener around when creating new windows, so that DocumentLoader can initialize the owner document correctly. - javascript: URLs have different inheritance rules: the loading machinery can now just directly pass in the correct owner document. - The exception for reusing a Window object when navigating from the initial empty Document has been removed: now it strictly follows the spec and reuses it iff it is same-origin to the new Document. BUG=583445 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation Review URL: https://codereview.chromium.org/1685003002 Cr-Commit-Position: refs/heads/master@{#378508}
Diffstat (limited to 'extensions/browser/api')
-rw-r--r--extensions/browser/api/app_window/app_window_api.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/extensions/browser/api/app_window/app_window_api.cc b/extensions/browser/api/app_window/app_window_api.cc
index 3e9f45f..4f5ffa5 100644
--- a/extensions/browser/api/app_window/app_window_api.cc
+++ b/extensions/browser/api/app_window/app_window_api.cc
@@ -340,7 +340,8 @@ bool AppWindowCreateFunction::RunAsync() {
AppWindow* app_window =
AppWindowClient::Get()->CreateAppWindow(browser_context(), extension());
- app_window->Init(url, new AppWindowContentsImpl(app_window), create_params);
+ app_window->Init(url, new AppWindowContentsImpl(app_window),
+ render_frame_host(), create_params);
if (ExtensionsBrowserClient::Get()->IsRunningInForcedAppMode() &&
!app_window->is_ime_window()) {