Skip to content

Commit

Permalink
fix: lost window.opener after cross-origin navigation (#18614)
Browse files Browse the repository at this point in the history
* SiteInstance::CreateRelatedSiteInstance and use it

* Some relies on preloads in opened window

The fact that, now, we always have an opener for opened windows diables note integration in opened windows, except if `nodeIntegrationInSubFrames` is enabled.

* Add a test on window.opener after cross-orgin navigation

* Make sure to unregisterProtocol in tests

* Introduc and use a NetworkSandbox for tests

* Modify tests about zoom persistence to properly simulate cross-origin navigation

* Revert "Modify tests about zoom persistence to properly simulate cross-origin navigation"

This reverts commit 0a7537f.
  • Loading branch information
alexstrat authored and codebytere committed Jun 12, 2019
1 parent 38cca77 commit 99c3ff6
Show file tree
Hide file tree
Showing 24 changed files with 267 additions and 458 deletions.
4 changes: 2 additions & 2 deletions patches/common/chromium/blink_initialization_order.patch
Expand Up @@ -10,10 +10,10 @@ to fix electron/electron#13787. The backport landed in Chromium 67 but the
DidCreateScriptContext re-ordering needs to be upstreamed or kept indefinitely

diff --git a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
index 9c3e848f01aef165c21a6d6043b6f9038d31cb66..7c16e8da1052b50f36da8102fdd8b9206dd7883d 100644
index 176acc60950a6e4c9747bd1bb8e2583c2336fd0f..78742471a5571fb1d5e01ba073c03e2d75f7cba5 100644
--- a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
+++ b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
@@ -190,11 +190,10 @@ void LocalWindowProxy::Initialize() {
@@ -188,11 +188,10 @@ void LocalWindowProxy::Initialize() {
GetFrame()->IsMainFrame());
MainThreadDebugger::Instance()->ContextCreated(script_state_, GetFrame(),
origin);
Expand Down
2 changes: 1 addition & 1 deletion patches/common/chromium/browser_compositor_mac.patch
Expand Up @@ -29,7 +29,7 @@ diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/cont
index 0817b4eca4f4e6f7f5d250589c1e4dbcc068237c..dcc2340e59771e8d73de7e97fa2371d8bec7b149 100644
--- a/content/browser/renderer_host/browser_compositor_view_mac.mm
+++ b/content/browser/renderer_host/browser_compositor_view_mac.mm
@@ -79,6 +79,12 @@ BrowserCompositorMac::~BrowserCompositorMac() {
@@ -79,6 +79,12 @@
DCHECK_EQ(1u, num_erased);
}

Expand Down
8 changes: 4 additions & 4 deletions patches/common/chromium/can_create_window.patch
Expand Up @@ -5,10 +5,10 @@ Subject: can_create_window.patch


diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index fcda9392b8a0cb24f80d64280432405f0b7d29e5..b804a7d118c2de6aa775d1b94b70f8208442261f 100644
index 66341ecfdc837c7d2d1ef45e14bcd4893c0a6b8a..bc596601da818b6000a1ccefb5fee0d4d098a995 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -3746,6 +3746,7 @@ void RenderFrameHostImpl::CreateNewWindow(
@@ -3754,6 +3754,7 @@ void RenderFrameHostImpl::CreateNewWindow(
last_committed_origin_, params->window_container_type,
params->target_url, params->referrer.To<Referrer>(),
params->frame_name, params->disposition, *params->features,
Expand All @@ -32,7 +32,7 @@ index e566a15b798e2586fa4fae3c4db97ce5f4f2f09f..08f52fd73bc9b6231a75f7804bb9b9f3

// Operation result when the renderer asks the browser to create a new window.
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
index 07d71b3a06f9b3b7ab4ea4f16a27fc82e51c2a6c..9d00218ae972b34073c84f2de78dee934962c3d8 100644
index 10de4bf0974d95e661983949b334b212ff7d1835..64c4d9eb2dfb8f53f7a6c8f00140b0cf22f18a49 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -494,6 +494,8 @@ bool ContentBrowserClient::CanCreateWindow(
Expand All @@ -45,7 +45,7 @@ index 07d71b3a06f9b3b7ab4ea4f16a27fc82e51c2a6c..9d00218ae972b34073c84f2de78dee93
bool opener_suppressed,
bool* no_javascript_access) {
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index eaa7d8b25141f8f2d461f0b37054c772c8df6297..09aca495389e48a8dbc1ea45b8bb636aa13d2486 100644
index b40ca1e3be824f4e2f782d36a89fef1a33148779..fdb9d7b8859270b36453e25349f7d84c44a6ce92 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -171,6 +171,7 @@ class RenderFrameHost;
Expand Down
10 changes: 5 additions & 5 deletions patches/common/chromium/color_chooser_mac.patch
Expand Up @@ -63,7 +63,7 @@ diff --git a/chrome/browser/ui/cocoa/color_chooser_mac.mm b/chrome/browser/ui/co
index bf47154f0a880f1c6143065e5c6d060f1df73765..e7cdab7a23d96345cc6e8ec578a8616d132b7d51 100644
--- a/chrome/browser/ui/cocoa/color_chooser_mac.mm
+++ b/chrome/browser/ui/cocoa/color_chooser_mac.mm
@@ -39,16 +39,18 @@ void ColorChooserMac::DidChooseColorInColorPanel(SkColor color) {
@@ -39,16 +39,18 @@
web_contents_->DidChooseColorInColorChooser(color);
}

Expand All @@ -87,7 +87,7 @@ index bf47154f0a880f1c6143065e5c6d060f1df73765..e7cdab7a23d96345cc6e8ec578a8616d
}

void ColorChooserMac::SetSelectedColor(SkColor color) {
@@ -67,9 +69,14 @@ void ColorChooserMac::SetSelectedColor(SkColor color) {
@@ -67,9 +69,14 @@ - (id)initWithChooser:(ColorChooserMac*)chooser {
chooser_ = chooser;
NSColorPanel* panel = [NSColorPanel sharedColorPanel];
[panel setShowsAlpha:NO];
Expand All @@ -103,7 +103,7 @@ index bf47154f0a880f1c6143065e5c6d060f1df73765..e7cdab7a23d96345cc6e8ec578a8616d
}
return self;
}
@@ -82,19 +89,21 @@ void ColorChooserMac::SetSelectedColor(SkColor color) {
@@ -82,19 +89,21 @@ - (void)dealloc {
// the ColorPanelCocoa is still the target.
BOOL respondsToPrivateTargetMethod =
[panel respondsToSelector:@selector(__target)];
Expand Down Expand Up @@ -134,7 +134,7 @@ diff --git a/chrome/browser/ui/cocoa/color_panel_cocoa_unittest.mm b/chrome/brow
index 83185ceb9bbd29bf38fce7f72c23f3a5b15ba6c8..823365fdfc0bceceeed6f5edc00b3462715a4751 100644
--- a/chrome/browser/ui/cocoa/color_panel_cocoa_unittest.mm
+++ b/chrome/browser/ui/cocoa/color_panel_cocoa_unittest.mm
@@ -28,28 +28,6 @@ class ColorPanelCocoaTest : public CocoaTest {
@@ -28,28 +28,6 @@ void SetUp() override {
}
};

Expand Down Expand Up @@ -163,7 +163,7 @@ index 83185ceb9bbd29bf38fce7f72c23f3a5b15ba6c8..823365fdfc0bceceeed6f5edc00b3462
TEST_F(ColorPanelCocoaTest, ClearTargetOnEnd) {
NSColorPanel* nscolor_panel = [NSColorPanel sharedColorPanel];
@autoreleasepool {
@@ -61,19 +39,12 @@ TEST_F(ColorPanelCocoaTest, ClearTargetOnEnd) {
@@ -61,19 +39,12 @@ void SetUp() override {

// Confirm the NSColorPanel's configuration by the ColorChooserMac's
// ColorPanelCocoa.
Expand Down
4 changes: 2 additions & 2 deletions patches/common/chromium/command-ismediakey.patch
Expand Up @@ -18,7 +18,7 @@ diff --git a/chrome/browser/extensions/global_shortcut_listener_mac.mm b/chrome/
index befe726af9c10b1563a7fc0bb77cc55f65943d5c..46c6fe08bab8471007f78d3ef227e5195bfdf0e1 100644
--- a/chrome/browser/extensions/global_shortcut_listener_mac.mm
+++ b/chrome/browser/extensions/global_shortcut_listener_mac.mm
@@ -21,6 +21,26 @@ using extensions::GlobalShortcutListenerMac;
@@ -21,6 +21,26 @@

namespace extensions {

Expand Down Expand Up @@ -104,7 +104,7 @@ index b48fa8e63867021bdd77bf585a0e02c366980d91..bae9e24e7bcf7615be243bcb5629cc59
}
return VKEY_UNKNOWN;
}
@@ -190,7 +196,10 @@ CGEventRef MediaKeysListenerImpl::EventTapCallback(CGEventTapProxy proxy,
@@ -190,7 +196,10 @@ static CGEventRef EventTapCallback(CGEventTapProxy proxy,
int key_code = (data1 & 0xFFFF0000) >> 16;
if (key_code != NX_KEYTYPE_PLAY && key_code != NX_KEYTYPE_NEXT &&
key_code != NX_KEYTYPE_PREVIOUS && key_code != NX_KEYTYPE_FAST &&
Expand Down
Expand Up @@ -22,7 +22,7 @@ index bd62ed07876ad4a2a7c6e8309843281719dbefb6..13e67994997caf175ba1b30ba8070718
}

diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
index e474d899fbcebfbaf4cb2ec0b63cc963292ee39a..8446076e169efb64569fb2e463cb5ebf5e1e6ee9 100644
index 0aff71c4339d0eacecf6b6d86ab750738696c31e..d3b2cdece52c4ca47776b6c79a97f2239fb253b6 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -58,6 +58,10 @@ ContentBrowserClient::SiteInstanceForNavigationType ContentBrowserClient::Should
Expand All @@ -37,7 +37,7 @@ index e474d899fbcebfbaf4cb2ec0b63cc963292ee39a..8446076e169efb64569fb2e463cb5ebf
const MainFunctionParams& parameters) {
return nullptr;
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index 2cc843982a697dbd693ca1d5fda3a8ab68c96f73..3ebe17d34cdcfb02acacd3c32f5dbb87594c010f 100644
index 9f0a966d8abf72b606906b14f00748b4466f8b0a..d01b1eaa680a6cfd999a67ecbdfd3cd29c311dc9 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -237,6 +237,9 @@ class CONTENT_EXPORT ContentBrowserClient {
Expand Down
4 changes: 2 additions & 2 deletions patches/common/chromium/disable_color_correct_rendering.patch
Expand Up @@ -268,7 +268,7 @@ index 1c93dfbc345d07769d7c91c8ecffc33bcd7505c1..ab87b6e5be09117e3dc1485a411ce72d
service_manager::switches::kGpuSandboxAllowSysVShm,
service_manager::switches::kGpuSandboxFailuresFatal,
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 77f9ff3979592f711a2f8b8cea5df31376d7f31d..933b4b4cadae9f9d997ed517d35d30e1ab18f630 100644
index 553ba03f0e8b995d3a5b1c26242bf85565c0037b..47d2047662bec651c94bb0667bf51791abe2ca49 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -221,6 +221,7 @@
Expand All @@ -279,7 +279,7 @@ index 77f9ff3979592f711a2f8b8cea5df31376d7f31d..933b4b4cadae9f9d997ed517d35d30e1
#include "ui/gl/gl_switches.h"
#include "ui/native_theme/native_theme_features.h"

@@ -3064,6 +3065,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
@@ -3068,6 +3069,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
// Propagate the following switches to the renderer command line (along
// with any associated values) if present in the browser command line.
static const char* const kSwitchNames[] = {
Expand Down
6 changes: 3 additions & 3 deletions patches/common/chromium/disable_hidden.patch
Expand Up @@ -5,7 +5,7 @@ Subject: disable_hidden.patch


diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 316e7cf9819c0ffe3a15a55e6bcada781d6d7832..d90f50ed29740b14e6259c4d6d14434222ddbfb4 100644
index f54486215cee46be524f8d607c511903891409e2..11bfaeb762ee215ba6fc0e6a5c24093ceaefd104 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -760,6 +760,9 @@ void RenderWidgetHostImpl::WasHidden() {
Expand All @@ -19,10 +19,10 @@ index 316e7cf9819c0ffe3a15a55e6bcada781d6d7832..d90f50ed29740b14e6259c4d6d144342

TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::WasHidden");
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h
index 4fd95dc7bdcd99342bd110d46b5829eb784e0f40..47af7e316c36c2f1733721170a6eff7fae39fa77 100644
index 33497ea7cd429df7db431ff1971ca84528c6d2d3..817ccdf2ed45f5afb3874cbbd6d2d9e8a1f1c458 100644
--- a/content/browser/renderer_host/render_widget_host_impl.h
+++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -153,6 +153,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl
@@ -154,6 +154,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl
// RenderWidgetHostImpl.
static RenderWidgetHostImpl* From(RenderWidgetHost* rwh);

Expand Down
2 changes: 1 addition & 1 deletion patches/common/chromium/disable_time_ticks_dcheck.patch
Expand Up @@ -6,7 +6,7 @@ Subject: disable_time_ticks_dcheck.patch
The DCHECK is failing for some reason.

diff --git a/content/common/inter_process_time_ticks_converter.cc b/content/common/inter_process_time_ticks_converter.cc
index 128abab37eb8..4d8e5e9c05b1 100644
index 128abab37eb8a96535ef92ebf11a463e863cc485..4d8e5e9c05b11083a69537d5badc85924b6fbae2 100644
--- a/content/common/inter_process_time_ticks_converter.cc
+++ b/content/common/inter_process_time_ticks_converter.cc
@@ -55,13 +55,13 @@ LocalTimeTicks InterProcessTimeTicksConverter::ToLocalTimeTicks(
Expand Down
Expand Up @@ -4,7 +4,6 @@ Date: Mon, 4 Mar 2019 14:46:48 -0800
Subject: fix: disable usage of pthread_fchdir_np and pthread_chdir_np in MAS
builds


diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc
index 6c0e14fc3332c27309c83137cff9f060ed306aea..2f77af0cafbc0122603bc2735f6327e2e42a07b6 100644
--- a/base/process/launch_mac.cc
Expand Down
Expand Up @@ -4,9 +4,8 @@ Date: Mon, 4 Mar 2019 14:51:45 -0800
Subject: fix: disable usage of SetApplicationIsDaemon and
_LSSetApplicationLaunchServicesServerConnectionStatus in MAS builds


diff --git a/content/utility/utility_service_factory.cc b/content/utility/utility_service_factory.cc
index 4450cc711772c600f138acb5458eb8ab0801ecf5..58e81aac8f8c97e5a3b3cd32b4d95789e14d2d31 100644
index 24a2644f008eb4878c87b62aebac962d074a0fe3..c1d07917c2ea576971b23c0f309d58ce559ca0ba 100644
--- a/content/utility/utility_service_factory.cc
+++ b/content/utility/utility_service_factory.cc
@@ -195,7 +195,7 @@ void UtilityServiceFactory::RunNetworkServiceOnIOThread(
Expand Down

0 comments on commit 99c3ff6

Please sign in to comment.