mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
refactor: prefer upstream gin::Arguments::ThrowTypeError() over gin_helper (#48368)
* refactor: use gin::Arguments::ThrowTypeError() in AutoUpdater::SetFeedURL() * refactor: use gin::Arguments::ThrowTypeError() in Browser::Focus() * refactor: use gin::Arguments::ThrowTypeError() in SystemPreferences::SetUserDefault() * refactor: use gin::Arguments::ThrowTypeError() in UtilityProcessWrapper::Create() * refactor: use gin::Arguments::ThrowTypeError() in UtilityProcessWrapper::PostMessage() * refactor: use gin::Arguments::ThrowTypeError() in ElectronBundleMover::ShouldContinueMove() * refactor: use gin::Arguments::ThrowTypeError() in OnClientCertificateSelected() * refactor: use gin::Arguments::ThrowTypeError() in Session::ClearData() * refactor: use gin::Arguments::ThrowTypeError() in ElectronBrowserContext::DisplayMediaDeviceChosen() * refactor: use gin::Arguments::ThrowTypeError() in WebContents::ReplaceMisspelling() * refactor: use gin::Arguments::ThrowTypeError() in WebContents::Print() * chore: iwyu shell/common/gin_helper/error_thrower.h
This commit is contained in:
@@ -26,8 +26,7 @@ class ElectronBundleMover {
|
||||
static bool IsCurrentAppInApplicationsFolder();
|
||||
|
||||
private:
|
||||
static bool ShouldContinueMove(gin_helper::ErrorThrower thrower,
|
||||
BundlerMoverConflictType type,
|
||||
static bool ShouldContinueMove(BundlerMoverConflictType type,
|
||||
gin::Arguments* args);
|
||||
};
|
||||
|
||||
|
||||
@@ -328,9 +328,9 @@ bool IsApplicationAtPathRunning(NSString* bundlePath) {
|
||||
|
||||
namespace electron {
|
||||
|
||||
bool ElectronBundleMover::ShouldContinueMove(gin_helper::ErrorThrower thrower,
|
||||
BundlerMoverConflictType type,
|
||||
gin::Arguments* args) {
|
||||
bool ElectronBundleMover::ShouldContinueMove(
|
||||
const BundlerMoverConflictType type,
|
||||
gin::Arguments* const args) {
|
||||
gin::Dictionary options(args->isolate());
|
||||
bool hasOptions = args->GetNext(&options);
|
||||
base::OnceCallback<v8::Local<v8::Value>(BundlerMoverConflictType)>
|
||||
@@ -345,7 +345,7 @@ bool ElectronBundleMover::ShouldContinueMove(gin_helper::ErrorThrower thrower,
|
||||
// we only want to throw an error if a user has returned a non-boolean
|
||||
// value; this allows for client-side error handling should something in
|
||||
// the handler throw
|
||||
thrower.ThrowError("Invalid conflict handler return type.");
|
||||
args->ThrowTypeError("Invalid conflict handler return type.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -406,8 +406,8 @@ bool ElectronBundleMover::Move(gin_helper::ErrorThrower thrower,
|
||||
// But first, make sure that it's not running
|
||||
if (IsApplicationAtPathRunning(destinationPath)) {
|
||||
// Check for callback handler and get user choice for open/quit
|
||||
if (!ShouldContinueMove(
|
||||
thrower, BundlerMoverConflictType::kExistsAndRunning, args))
|
||||
if (!ShouldContinueMove(BundlerMoverConflictType::kExistsAndRunning,
|
||||
args))
|
||||
return false;
|
||||
|
||||
// Unless explicitly denied, give running app focus and terminate self
|
||||
@@ -420,8 +420,7 @@ bool ElectronBundleMover::Move(gin_helper::ErrorThrower thrower,
|
||||
return true;
|
||||
} else {
|
||||
// Check callback handler and get user choice for app trashing
|
||||
if (!ShouldContinueMove(thrower, BundlerMoverConflictType::kExists,
|
||||
args))
|
||||
if (!ShouldContinueMove(BundlerMoverConflictType::kExists, args))
|
||||
return false;
|
||||
|
||||
// Unless explicitly denied, attempt to trash old app
|
||||
|
||||
Reference in New Issue
Block a user