Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove nativeWindowOpen option #29405

Merged
merged 12 commits into from Jan 6, 2022
Merged

feat: remove nativeWindowOpen option #29405

merged 12 commits into from Jan 6, 2022

Conversation

nornagon
Copy link
Member

@nornagon nornagon commented May 28, 2021

Description of Change

nativeWindowOpen: true was made the default in 15.x.y. Let's remove the option to set it to false.

Checklist

Release Notes

Notes: Removed the old BrowserWindowProxy-based implementation of window.open. This also removes the nativeWindowOpen option from webPreferences.

@nornagon nornagon requested review from a team as code owners May 28, 2021 19:04
@nornagon nornagon added the semver/major incompatible API changes label May 28, 2021
@electron-cation electron-cation bot added new-pr 🌱 PR opened in the last 24 hours api-review/requested 🗳 labels May 28, 2021
@nornagon
Copy link
Member Author

nornagon commented Jun 1, 2021

Blocked on #29463

@miniak
Copy link
Contributor

miniak commented Jun 2, 2021

@nornagon you can also remove openerId from InternalWebPreferences in typings/internal-ambient.d.ts

zcbenz
zcbenz previously requested changes Jun 3, 2021
Copy link
Member

@zcbenz zcbenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mac/linux CI are crashing:

ok 35 chromium feature navigator.geolocation returns position when permission is granted


#
# Fatal error in ../../v8/src/api/api-inl.h, line 183
# Debug check failed: microtask_queue->GetMicrotasksScopeDepth() || !microtask_queue->DebugMicrotasksScopeDepthIsZero().
#
#
#
#FailureMessage Object: 0x7ffee33942500   Electron Framework                  0x0000000112010a79 base::debug::CollectStackTrace(void**, unsigned long) + 9
1   Electron Framework                  0x0000000111f2c103 base::debug::StackTrace::StackTrace() + 19
2   Electron Framework                  0x00000001143aa24d gin::(anonymous namespace)::PrintStackTrace() + 45
3   Electron Framework                  0x0000000113d80d16 V8_Fatal(char const*, int, char const*, ...) + 326
4   Electron Framework                  0x0000000113d806f5 v8::base::(anonymous namespace)::DefaultDcheckHandler(char const*, int, char const*) + 21
5   Electron Framework                  0x000000010f23e9e1 v8::CallDepthScope<true>::~CallDepthScope() + 865
6   Electron Framework                  0x000000010f1fbd53 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) + 835
7   Electron Framework                  0x00000001173b9d62 node::InternalMakeCallback(node::Environment*, v8::Local<v8::Object>, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) + 738
8   Electron Framework                  0x00000001173ba02b node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) + 187
9   Electron Framework                  0x0000000117403175 node::Environment::CheckImmediate(uv_check_s*) + 181
10  Electron Framework                  0x000000010d7f352d uv__run_check + 157
11  Electron Framework                  0x000000010d7ed461 uv_run + 369
12  Electron Framework                  0x000000010d9b30bc electron::NodeBindings::UvRunOnce() + 348
13  Electron Framework                  0x000000010d9b4874 base::internal::Invoker<base::internal::BindState<void (electron::NodeBindings::*)(), base::WeakPtr<electron::NodeBindings> >, void ()>::RunOnce(base::internal::BindStateBase*) + 148
14  Electron Framework                  0x0000000111fa8050 base::TaskAnnotator::RunTask(char const*, base::PendingTask*) + 400
15  Electron Framework                  0x0000000111fcc152 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::sequence_manager::LazyNow*) + 994
16  Electron Framework                  0x0000000111fcb978 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() + 88
17  Electron Framework                  0x00000001120270b1 base::MessagePumpCFRunLoopBase::RunWork() + 65
18  Electron Framework                  0x0000000112020862 base::mac::CallWithEHFrame(void () block_pointer) + 10
19  Electron Framework                  0x0000000112026adf base::MessagePumpCFRunLoopBase::RunWorkSource(void*) + 63
20  CoreFoundation                      0x00007fff3384e8f4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
21  CoreFoundation                      0x00007fff3384e893 __CFRunLoopDoSource0 + 103
22  CoreFoundation                      0x00007fff3384e6ad __CFRunLoopDoSources0 + 209
23  CoreFoundation                      0x00007fff3384d3c9 __CFRunLoopRun + 937
24  CoreFoundation                      0x00007fff3384c9c3 CFRunLoopRunSpecific + 466
25  Foundation                          0x00007fff35f081c8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
26  Electron Framework                  0x00000001120276ee base::MessagePumpNSRunLoop::DoRun(base::MessagePump::Delegate*) + 126
27  Electron Framework                  0x000000011202648c base::MessagePumpCFRunLoopBase::Run(base::MessagePump::Delegate*) + 140
28  Electron Framework                  0x0000000111fccd1b base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) + 651
29  Electron Framework                  0x0000000111f80c2a base::RunLoop::Run(base::Location const&) + 890
30  Electron Framework                  0x0000000117178efb content::RendererMain(content::MainFunctionParams const&) + 1611
31  Electron Framework                  0x000000010f17c6f7 content::ContentMainRunnerImpl::Run(bool) + 503
32  Electron Framework                  0x000000010f17b602 content::RunContentProcess(content::ContentMainParams const&, content::ContentMainRunner*) + 2658
33  Electron Framework                  0x000000010f17b6ec content::ContentMain(content::ContentMainParams const&) + 44
34  Electron Framework                  0x000000010d7fff17 ElectronMain + 135
35  Electron Helper (Renderer)          0x000000010c868eda main + 298
36  libdyld.dylib                       0x00007fff6d943cc9 start + 1
webContents 1 crashed: file:///Users/distiller/project/src/electron/spec/static/index.html?grep=&invert=&files=spec%2Fapi-clipboard-spec.js%2Cspec%2Fapi-process-spec.js%2Cspec%2Fapi-web-frame-spec.js%2Cspec%2Fchromium-spec.js%2Cspec%2Fwebview-spec.js (killed=false)
Renderer process crashed
Renderer process crashed - see https://www.electronjs.org/docs/tutorial/application-debugging for potential debugging information.
webContents 2 crashed:  (killed=false)
Renderer process crashed - see https://www.electronjs.org/docs/tutorial/application-debugging for potential debugging information.
[2832:0602/173246.272595:WARNING:discardable_shared_memory_manager.cc(432)] Some MojoDiscardableSharedMemoryManagerImpls are still alive. They will be leaked.
[2832:0602/173246.276213:ERROR:process_posix.cc(330)] Unable to terminate process 2835: No such process (3)
✗ Electron tests failed with code 1.

Copy link
Member

@MarshallOfSound MarshallOfSound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nativeWindowOpen being made the default doesn't allow us to just remove it. It needs to go through a deprecation cycle just like everything else.

As far as I can see the Electron 14 PR to enable nativeWindowOpen by default also failed to go through a proper deprecation cycle #28552

The deprecation cycle for a default change should be as follows:

  • Version N - Initial state
  • Version N + 1 - Deprecation warning about initial state changing
  • Version N + 2 - Change initial state
  • Version N + 3 - Add deprecation warning that the flag will be removed
  • Version N + 4 - Remove the flag

We skipped over step N + 1 and N + 3 Electron 14 hasn't really existed for long though, so we can still fix this.

A good example of a deprecation timeline that worked really well IMO is the context aware module deprecation --> #18397

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Jun 4, 2021
@nornagon
Copy link
Member Author

The deprecation cycle for a default change should be as follows:

  • Version N - Initial state
  • Version N + 1 - Deprecation warning about initial state changing
  • Version N + 2 - Change initial state
  • Version N + 3 - Add deprecation warning that the flag will be removed
  • Version N + 4 - Remove the flag

We skipped over step N + 1 and N + 3 Electron 14 hasn't really existed for long though, so we can still fix this.

We chose N=13. So:

  • 14 - leaving nativeWindowOpen unspecified warns that the default will change.
  • 15 - nativeWindowOpen: true becomes the default.
  • 16 - specifying nativeWindowOpen: false will result in a deprecation warning.
  • 17 - the nativeWindowOpen option will be removed.

Should we consider lengthening this timeline on account of the new release cadence? Perhaps we should target the final removal for 18 instead of 17?

@miniak miniak force-pushed the remove-nativewindowopen branch 5 times, most recently from 6984077 to bc2a39b Compare November 16, 2021 20:52
@miniak
Copy link
Contributor

miniak commented Nov 17, 2021

@zcbenz I am still seeing those crashes when running tests, I will probably need some help with that if possible.

@zcbenz
Copy link
Member

zcbenz commented Nov 17, 2021

The node::FreeEnvironment implicitly executes callbacks, adding a microtasks scope fixes the crash.

@miniak
Copy link
Contributor

miniak commented Nov 22, 2021

@zcbenz there is still one test failing:

not ok 39 chromium feature window.open accepts "nodeIntegration" as feature
  AssertionError: expected false to be true
      at Context.<anonymous> (/Users/distiller/project/src/electron/spec/chromium-spec.js:71:61)

It's caused by this bug #31949

@zcbenz
Copy link
Member

zcbenz commented Dec 8, 2021

After looking into related code, I found that the referenced code path is still used by the new-window event. I have update the comments instead.

@nornagon nornagon dismissed MarshallOfSound’s stale review January 4, 2022 16:58

Deprecation cycle now respected

docs/breaking-changes.md Outdated Show resolved Hide resolved
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
@miniak
Copy link
Contributor

miniak commented Jan 6, 2022

@nornagon #32116 is merged, this should be finally ready for merging

@miniak
Copy link
Contributor

miniak commented Jan 6, 2022

API LGTM

1 similar comment
@nornagon
Copy link
Member Author

nornagon commented Jan 6, 2022

API LGTM

@nornagon nornagon merged commit d44a187 into main Jan 6, 2022
@nornagon nornagon deleted the remove-nativewindowopen branch January 6, 2022 17:28
@release-clerk
Copy link

release-clerk bot commented Jan 6, 2022

Release Notes Persisted

Removed the old BrowserWindowProxy-based implementation of window.open. This also removes the nativeWindowOpen option from webPreferences.

t57ser pushed a commit to t57ser/electron that referenced this pull request Jan 25, 2022
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
BitYoungjae added a commit to bgpworks/boxhero-electron that referenced this pull request May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants