Closes https://github.com/electron/electron/issues/43714.
Fixes an issue where the resizing border was not being handled correctly on Linux WCO
caption buttons. This is now taken into account as a part of the NonClientHitTest.
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
fix: Emit() should not leak converted arg handles into caller's HandleScope
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* perf: use v8::Object* as direct keys instead of using hash + a linked list
* refactor: use v8::Local<v8::Object> as the key
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fix: restore Chromium default Content-Disposition header parsing
Co-authored-by: Milan Burda <milan.burda@gmail.com>
* Update api-web-request-spec.ts
Co-authored-by: Milan Burda <milan.burda@gmail.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
refactor: use an EscapableHandleScope
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
reassign the uv_handle_t of the source
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
refactor: avoid redundant Promise.GetContext calls
Several Promise methods call `GetContext()` multiple times. From looking
at the assembly in obj/electron/electron_lib/promise.o, these redundant
calls are actually being made -- they aren't optmized out.
This PR keeps the return value in a local variable to avoid extra calls.
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
refactor: take a uint8_t span in ValidateIntegrityOrDie()
Doing some groundwork for fixing unsafe base::File() APIs:
- Change ValidateIntegrityOrDie() to take a span<const uint8_t> arg.
We'll need this to migrate asar's base::File API calls away from the
ones tagged `UNSAFE_BUFFER_USAGE` because the safe counterparts use
span<uint8_t> too.
- Simplify ValidateIntegrityOrDie()'s implementation by using
crypto::SHA256Hash() instead of reinventing the wheel.
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
fix: confirm a v8::Value is a v8::Object before casting it
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fix: free UvTaskRunner timers only after they are closed
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: UvTaskRunner now holds UvHandles
Co-authored-by: Charles Kerr <charles@charleskerr.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fix: Launch apps with XDG_ACTIVATION_TOKEN in ozone/wayland
Ensure apps are launched with the activation token received from
xdg_activation_v1 protocol.
Co-authored-by: Orko Garai <orko@igalia.com>
* add focus_launched_process option
Co-authored-by: Orko Garai <orko@igalia.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Orko Garai <orko@igalia.com>
* fix: -Wunsafe-buffer-usage warnings in IsUrlArg()
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: improve code comments for CheckCommandLineArguments()
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: reduce diffs from main
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: CheckCommandLineArguments takes a StringVector arg
Fixes another buffer warning!
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: use base::CommandLine::StringPieceType
base:CommandLine::StringViewType has not been invented yet
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fix: remove use of deprecated v8::String::Value
Upstream marked v8::String::Value as `V8_DEPRECATE_SOON` last month,
so let's stop using it.
The replacement code mostly does the same as v8::String::Value();
but since our test only cares about the length and not the contents,
we get a small perf win of not needing to allocate a char array and
not needing to call Local::String::Write().
Upstream V8_DEPRECATE_SOON:
Xref: https://chromium-review.googlesource.com/c/v8/v8/+/5667299kkk
v8::String::Value() implementation:
20226b740b/src/api/api.cc (10883)
History on why we used it:
80c1a9739df49ed30f72
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* Update shell/common/gin_converters/file_path_converter.h
Co-authored-by: Robo <hop2deep@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fixup! Update shell/common/gin_converters/file_path_converter.h
do not return success for all non-Null non-Strings
Co-authored-by: Charles Kerr <charles@charleskerr.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
When an electron app is launched by another app ensure that the
XDG_ACTIVATION_TOKEN env var is read and used for activation using
xdg_activation_v1 protocol.
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Orko Garai <orko@igalia.com>
added in Aug 2021 (41646d11, #29600) but never used
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
chore: remove unused asar::ClearArchives()
last use removed in Jun 2021 (b1d1ac65, #29293)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Last use of `icon_path_` was removed on May 29, 2017 (c741b584)
Last use of `has_icon_` was removed on May 30, 2017 (5048425e)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* perf: avoid double-calls to GetView()
There are a lot of places where we call the virtual method GetView()
twice in succession: the first to check if the view exists, and the
second to use. This PR holds the view in a temp variable instead, e.g.:
if (auto* view = foo->GetView())
view->DoSomething();
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* perf: avoid discarded GetView() call
Co-authored-by: Charles Kerr <charles@charleskerr.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
chore: remove unused unSetVar JS binding
Added in Oct 2020 (b33f2260, #25623) but never used
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fix: handle failing to enter/exit fullscreen on macOS
On macOS, failing to enter/exit fullscreen can fail. If this happens,
properly restore the original window state.
Co-authored-by: cptpcrd <31829097+cptpcrd@users.noreply.github.com>
* refactor: remove fail to exit fullscreen handlers
Seem to be unnecessary since the window exits fullscreen anyway.
Co-authored-by: cptpcrd <31829097+cptpcrd@users.noreply.github.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: cptpcrd <31829097+cptpcrd@users.noreply.github.com>
chore: remove unused v8Util.deleteHiddenValue()
Its last use was removed in Nov 2020 by c8d77cae4a (#26659)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
The last three pieces of code that used it were removed in:
- Oct 2020 (8df4faa8#25711)
- Jun 2020 (e1e73fa5#24115)
- Jun 2020 (c0182bca#24116).
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>