mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
26 Commits
miniak/get
...
v1.8.2-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1f23064e1 | ||
|
|
64ede04002 | ||
|
|
dab7f7f18d | ||
|
|
9ceef5f1d3 | ||
|
|
a250089a40 | ||
|
|
6efa33043a | ||
|
|
445781ce33 | ||
|
|
ec088c7940 | ||
|
|
71034f8008 | ||
|
|
c9d2b071ab | ||
|
|
d0ca62b173 | ||
|
|
6982fb6dd0 | ||
|
|
be46ba1849 | ||
|
|
5eefde63b9 | ||
|
|
2a97f2636a | ||
|
|
ab3811e6dd | ||
|
|
686dd664de | ||
|
|
1e5ba47731 | ||
|
|
7ef262cab3 | ||
|
|
19d70e5f1f | ||
|
|
d0a9379b37 | ||
|
|
0ac7106e6c | ||
|
|
f19f125f68 | ||
|
|
79385dcb74 | ||
|
|
a71a20ee32 | ||
|
|
99a1161fe4 |
@@ -10,7 +10,7 @@
|
||||
#if defined(OS_MACOSX)
|
||||
extern "C" {
|
||||
__attribute__((visibility("default")))
|
||||
int AtomMain(int argc, const char* argv[]);
|
||||
int AtomMain(int argc, char* argv[]);
|
||||
|
||||
__attribute__((visibility("default")))
|
||||
int AtomInitializeICUandStartNode(int argc, char *argv[]);
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
#include "content/public/app/content_main.h"
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
int AtomMain(int argc, const char* argv[]) {
|
||||
int AtomMain(int argc, char* argv[]) {
|
||||
atom::AtomMainDelegate delegate;
|
||||
content::ContentMainParams params(&delegate);
|
||||
params.argc = argc;
|
||||
params.argv = argv;
|
||||
params.argv = const_cast<const char**>(argv);
|
||||
atom::AtomCommandLine::Init(argc, argv);
|
||||
return content::ContentMain(params);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
#include "atom/app/atom_main.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h> // windows.h must be included first
|
||||
@@ -15,9 +16,11 @@
|
||||
#include <tchar.h>
|
||||
|
||||
#include "atom/app/atom_main_delegate.h"
|
||||
#include "atom/app/command_line_args.h"
|
||||
#include "atom/common/crash_reporter/win/crash_service_main.h"
|
||||
#include "base/environment.h"
|
||||
#include "base/process/launch.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/win/windows_version.h"
|
||||
#include "content/public/app/sandbox_helper_win.h"
|
||||
#include "sandbox/win/src/sandbox_types.h"
|
||||
@@ -52,18 +55,23 @@ bool IsEnvSet(const char* name) {
|
||||
|
||||
#if defined(OS_WIN)
|
||||
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
|
||||
int argc = 0;
|
||||
wchar_t** wargv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
|
||||
struct Arguments {
|
||||
int argc = 0;
|
||||
wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
|
||||
|
||||
bool run_as_node = IsEnvSet(kRunAsNode);
|
||||
~Arguments() { LocalFree(argv); }
|
||||
} arguments;
|
||||
|
||||
if (!arguments.argv)
|
||||
return -1;
|
||||
|
||||
#ifdef _DEBUG
|
||||
// Don't display assert dialog boxes in CI test runs
|
||||
static const auto kCI = "ELECTRON_CI";
|
||||
bool is_ci = IsEnvSet(kCI);
|
||||
if (!is_ci) {
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
if (!_wcsicmp(wargv[i], L"--ci")) {
|
||||
for (int i = 0; i < arguments.argc; ++i) {
|
||||
if (!_wcsicmp(arguments.argv[i], L"--ci")) {
|
||||
is_ci = true;
|
||||
_putenv_s(kCI, "1"); // set flag for child processes
|
||||
break;
|
||||
@@ -81,44 +89,12 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
|
||||
}
|
||||
#endif
|
||||
|
||||
bool run_as_node = IsEnvSet(kRunAsNode);
|
||||
|
||||
// Make sure the output is printed to console.
|
||||
if (run_as_node || !IsEnvSet("ELECTRON_NO_ATTACH_CONSOLE"))
|
||||
base::RouteStdioToConsole(false);
|
||||
|
||||
// Convert argv to to UTF8
|
||||
char** argv = new char*[argc];
|
||||
for (int i = 0; i < argc; i++) {
|
||||
// Compute the size of the required buffer
|
||||
DWORD size = WideCharToMultiByte(CP_UTF8,
|
||||
0,
|
||||
wargv[i],
|
||||
-1,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
if (size == 0) {
|
||||
// This should never happen.
|
||||
fprintf(stderr, "Could not convert arguments to utf8.");
|
||||
exit(1);
|
||||
}
|
||||
// Do the actual conversion
|
||||
argv[i] = new char[size];
|
||||
DWORD result = WideCharToMultiByte(CP_UTF8,
|
||||
0,
|
||||
wargv[i],
|
||||
-1,
|
||||
argv[i],
|
||||
size,
|
||||
NULL,
|
||||
NULL);
|
||||
if (result == 0) {
|
||||
// This should never happen.
|
||||
fprintf(stderr, "Could not convert arguments to utf8.");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DEBUG
|
||||
// Chromium has its own TLS subsystem which supports automatic destruction
|
||||
// of thread-local data, and also depends on memory allocation routines
|
||||
@@ -139,14 +115,23 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
|
||||
#endif
|
||||
|
||||
if (run_as_node) {
|
||||
// Now that argv conversion is done, we can finally start.
|
||||
std::vector<char*> argv(arguments.argc);
|
||||
std::transform(
|
||||
arguments.argv, arguments.argv + arguments.argc, argv.begin(),
|
||||
[](auto& a) { return _strdup(base::WideToUTF8(a).c_str()); });
|
||||
|
||||
base::AtExitManager atexit_manager;
|
||||
base::i18n::InitializeICU();
|
||||
return atom::NodeMain(argc, argv);
|
||||
auto ret = atom::NodeMain(argv.size(), argv.data());
|
||||
std::for_each(argv.begin(), argv.end(), free);
|
||||
return ret;
|
||||
} else if (IsEnvSet("ELECTRON_INTERNAL_CRASH_SERVICE")) {
|
||||
return crash_service::Main(cmd);
|
||||
}
|
||||
|
||||
if (!atom::CheckCommandLineArguments(arguments.argc, arguments.argv))
|
||||
return -1;
|
||||
|
||||
sandbox::SandboxInterfaceInfo sandbox_info = {0};
|
||||
content::InitializeSandboxInfo(&sandbox_info);
|
||||
atom::AtomMainDelegate delegate;
|
||||
@@ -154,33 +139,32 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
|
||||
content::ContentMainParams params(&delegate);
|
||||
params.instance = instance;
|
||||
params.sandbox_info = &sandbox_info;
|
||||
atom::AtomCommandLine::Init(argc, argv);
|
||||
atom::AtomCommandLine::InitW(argc, wargv);
|
||||
atom::AtomCommandLine::Init(arguments.argc, arguments.argv);
|
||||
return content::ContentMain(params);
|
||||
}
|
||||
|
||||
#elif defined(OS_LINUX) // defined(OS_WIN)
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
int main(int argc, char* argv[]) {
|
||||
if (IsEnvSet(kRunAsNode)) {
|
||||
base::i18n::InitializeICU();
|
||||
base::AtExitManager atexit_manager;
|
||||
return atom::NodeMain(argc, const_cast<char**>(argv));
|
||||
return atom::NodeMain(argc, argv);
|
||||
}
|
||||
|
||||
atom::AtomMainDelegate delegate;
|
||||
content::ContentMainParams params(&delegate);
|
||||
params.argc = argc;
|
||||
params.argv = argv;
|
||||
params.argv = const_cast<const char**>(argv);
|
||||
atom::AtomCommandLine::Init(argc, argv);
|
||||
return content::ContentMain(params);
|
||||
}
|
||||
|
||||
#else // defined(OS_LINUX)
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
int main(int argc, char* argv[]) {
|
||||
if (IsEnvSet(kRunAsNode)) {
|
||||
return AtomInitializeICUandStartNode(argc, const_cast<char**>(argv));
|
||||
return AtomInitializeICUandStartNode(argc, argv);
|
||||
}
|
||||
|
||||
return AtomMain(argc, argv);
|
||||
|
||||
1411
atom/app/command_line_args.cc
Normal file
1411
atom/app/command_line_args.cc
Normal file
File diff suppressed because it is too large
Load Diff
17
atom/app/command_line_args.h
Normal file
17
atom/app/command_line_args.h
Normal file
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) 2018 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_APP_COMMAND_LINE_ARGS_H_
|
||||
#define ATOM_APP_COMMAND_LINE_ARGS_H_
|
||||
|
||||
#include "base/command_line.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
bool CheckCommandLineArguments(int argc, base::CommandLine::CharType** argv);
|
||||
|
||||
} // namespace atom
|
||||
|
||||
#endif // ATOM_APP_COMMAND_LINE_ARGS_H_
|
||||
|
||||
@@ -861,11 +861,7 @@ bool App::Relaunch(mate::Arguments* js_args) {
|
||||
}
|
||||
|
||||
if (!override_argv) {
|
||||
#if defined(OS_WIN)
|
||||
const relauncher::StringVector& argv = atom::AtomCommandLine::wargv();
|
||||
#else
|
||||
const relauncher::StringVector& argv = atom::AtomCommandLine::argv();
|
||||
#endif
|
||||
return relauncher::RelaunchApp(argv);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "content/public/browser/resource_dispatcher_host.h"
|
||||
#include "content/public/browser/site_instance.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/content_paths.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "content/public/common/web_preferences.h"
|
||||
@@ -243,6 +244,11 @@ void AtomBrowserClient::OverrideSiteInstanceForNavigation(
|
||||
void AtomBrowserClient::AppendExtraCommandLineSwitches(
|
||||
base::CommandLine* command_line,
|
||||
int process_id) {
|
||||
// Make sure we're about to launch a known executable
|
||||
base::FilePath child_path;
|
||||
PathService::Get(content::CHILD_PROCESS_EXE, &child_path);
|
||||
CHECK(base::MakeAbsoluteFilePath(command_line->GetProgram()) == child_path);
|
||||
|
||||
std::string process_type =
|
||||
command_line->GetSwitchValueASCII(::switches::kProcessType);
|
||||
if (process_type != ::switches::kRendererProcess)
|
||||
|
||||
@@ -42,7 +42,7 @@ void NodeDebugger::Start() {
|
||||
// the debugger on the first line
|
||||
if (options.wait_for_connect()) {
|
||||
mate::Dictionary process(env_->isolate(), env_->process_object());
|
||||
process.Set("_debugWaitConnect", true);
|
||||
process.Set("_breakFirstLine", true);
|
||||
}
|
||||
|
||||
inspector->Start(platform_.get(), nullptr, options);
|
||||
|
||||
@@ -140,11 +140,7 @@ bool RelaunchAppWithHelper(const base::FilePath& helper,
|
||||
}
|
||||
|
||||
int RelauncherMain(const content::MainFunctionParams& main_parameters) {
|
||||
#if defined(OS_WIN)
|
||||
const StringVector& argv = atom::AtomCommandLine::wargv();
|
||||
#else
|
||||
const StringVector& argv = atom::AtomCommandLine::argv();
|
||||
#endif
|
||||
|
||||
if (argv.size() < 4 || argv[1] != internal::kRelauncherTypeArg) {
|
||||
LOG(ERROR) << "relauncher process invoked with unexpected arguments";
|
||||
|
||||
@@ -56,8 +56,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,8,2,2
|
||||
PRODUCTVERSION 1,8,2,2
|
||||
FILEVERSION 1,8,2,4
|
||||
PRODUCTVERSION 1,8,2,4
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
||||
@@ -3,12 +3,16 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/browser/ui/win/atom_desktop_native_widget_aura.h"
|
||||
#include "ui/views/corewm/tooltip_controller.h"
|
||||
#include "ui/wm/public/tooltip_client.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
AtomDesktopNativeWidgetAura::AtomDesktopNativeWidgetAura(
|
||||
views::internal::NativeWidgetDelegate* delegate)
|
||||
: views::DesktopNativeWidgetAura(delegate) {
|
||||
// This is to enable the override of OnWindowActivated
|
||||
aura::client::SetActivationChangeObserver(GetNativeWindow(), this);
|
||||
}
|
||||
|
||||
void AtomDesktopNativeWidgetAura::Activate() {
|
||||
@@ -19,4 +23,23 @@ void AtomDesktopNativeWidgetAura::Activate() {
|
||||
views::DesktopNativeWidgetAura::Activate();
|
||||
}
|
||||
|
||||
void AtomDesktopNativeWidgetAura::OnWindowActivated(
|
||||
aura::client::ActivationChangeObserver::ActivationReason reason,
|
||||
aura::Window* gained_active,
|
||||
aura::Window* lost_active) {
|
||||
views::DesktopNativeWidgetAura::OnWindowActivated(
|
||||
reason, gained_active, lost_active);
|
||||
if (lost_active != nullptr) {
|
||||
auto* tooltip_controller = static_cast<views::corewm::TooltipController*>(
|
||||
aura::client::GetTooltipClient(lost_active->GetRootWindow()));
|
||||
|
||||
// This will cause the tooltip to be hidden when a window is deactivated,
|
||||
// as it should be.
|
||||
// TODO(brenca): Remove this fix when the chromium issue is fixed.
|
||||
// crbug.com/724538
|
||||
if (tooltip_controller != nullptr)
|
||||
tooltip_controller->OnCancelMode(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
||||
@@ -19,6 +19,10 @@ class AtomDesktopNativeWidgetAura : public views::DesktopNativeWidgetAura {
|
||||
void Activate() override;
|
||||
|
||||
private:
|
||||
void OnWindowActivated(
|
||||
aura::client::ActivationChangeObserver::ActivationReason reason,
|
||||
aura::Window* gained_active,
|
||||
aura::Window* lost_active) override;
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomDesktopNativeWidgetAura);
|
||||
};
|
||||
|
||||
|
||||
@@ -10,31 +10,22 @@
|
||||
namespace atom {
|
||||
|
||||
// static
|
||||
std::vector<std::string> AtomCommandLine::argv_;
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// static
|
||||
std::vector<std::wstring> AtomCommandLine::wargv_;
|
||||
#endif
|
||||
base::CommandLine::StringVector AtomCommandLine::argv_;
|
||||
|
||||
// static
|
||||
void AtomCommandLine::Init(int argc, const char* const* argv) {
|
||||
void AtomCommandLine::Init(int argc, base::CommandLine::CharType** argv) {
|
||||
DCHECK(argv_.empty());
|
||||
|
||||
// NOTE: uv_setup_args does nothing on Windows, so we don't need to call it.
|
||||
// Otherwise we'd have to convert the arguments from UTF16.
|
||||
#if !defined(OS_WIN)
|
||||
// Hack around with the argv pointer. Used for process.title = "blah"
|
||||
char** new_argv = uv_setup_args(argc, const_cast<char**>(argv));
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
argv_.push_back(new_argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// static
|
||||
void AtomCommandLine::InitW(int argc, const wchar_t* const* argv) {
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
wargv_.push_back(argv[i]);
|
||||
}
|
||||
}
|
||||
argv = uv_setup_args(argc, argv);
|
||||
#endif
|
||||
|
||||
argv_.assign(argv, argv + argc);
|
||||
}
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
// static
|
||||
void AtomCommandLine::InitializeFromCommandLine() {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/macros.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
@@ -16,13 +17,9 @@ namespace atom {
|
||||
// Singleton to remember the original "argc" and "argv".
|
||||
class AtomCommandLine {
|
||||
public:
|
||||
static void Init(int argc, const char* const* argv);
|
||||
static std::vector<std::string> argv() { return argv_; }
|
||||
static const base::CommandLine::StringVector& argv() { return argv_; }
|
||||
|
||||
#if defined(OS_WIN)
|
||||
static void InitW(int argc, const wchar_t* const* argv);
|
||||
static std::vector<std::wstring> wargv() { return wargv_; }
|
||||
#endif
|
||||
static void Init(int argc, base::CommandLine::CharType** argv);
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
// On Linux the command line has to be read from base::CommandLine since
|
||||
@@ -31,11 +28,7 @@ class AtomCommandLine {
|
||||
#endif
|
||||
|
||||
private:
|
||||
static std::vector<std::string> argv_;
|
||||
|
||||
#if defined(OS_WIN)
|
||||
static std::vector<std::wstring> wargv_;
|
||||
#endif
|
||||
static base::CommandLine::StringVector argv_;
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(AtomCommandLine);
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define ATOM_MAJOR_VERSION 1
|
||||
#define ATOM_MINOR_VERSION 8
|
||||
#define ATOM_PATCH_VERSION 2
|
||||
#define ATOM_PRE_RELEASE_VERSION -beta.2
|
||||
#define ATOM_PRE_RELEASE_VERSION -beta.4
|
||||
|
||||
#ifndef ATOM_PRE_RELEASE_VERSION
|
||||
# define ATOM_PRE_RELEASE_VERSION ""
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "atom/common/node_bindings.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -17,6 +18,7 @@
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "base/trace_event/trace_event.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
@@ -150,7 +152,14 @@ void NodeBindings::Initialize() {
|
||||
|
||||
node::Environment* NodeBindings::CreateEnvironment(
|
||||
v8::Handle<v8::Context> context) {
|
||||
#if defined(OS_WIN)
|
||||
auto& atom_args = AtomCommandLine::argv();
|
||||
std::vector<std::string> args(atom_args.size());
|
||||
std::transform(atom_args.cbegin(), atom_args.cend(), args.begin(),
|
||||
[](auto& a) { return base::WideToUTF8(a); });
|
||||
#else
|
||||
auto args = AtomCommandLine::argv();
|
||||
#endif
|
||||
|
||||
// Feed node the path to initialization script.
|
||||
base::FilePath::StringType process_type;
|
||||
@@ -170,8 +179,7 @@ node::Environment* NodeBindings::CreateEnvironment(
|
||||
resources_path.Append(FILE_PATH_LITERAL("electron.asar"))
|
||||
.Append(process_type)
|
||||
.Append(FILE_PATH_LITERAL("init.js"));
|
||||
std::string script_path_str = script_path.AsUTF8Unsafe();
|
||||
args.insert(args.begin() + 1, script_path_str.c_str());
|
||||
args.insert(args.begin() + 1, script_path.AsUTF8Unsafe());
|
||||
|
||||
std::unique_ptr<const char*[]> c_argv = StringVectorToArgArray(args);
|
||||
node::Environment* env = node::CreateEnvironment(
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "atom/renderer/api/atom_api_spell_check_client.h"
|
||||
#include "base/memory/memory_pressure_listener.h"
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
#include "content/public/renderer/render_frame_visitor.h"
|
||||
#include "content/public/renderer/render_view.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "native_mate/object_template_builder.h"
|
||||
@@ -58,6 +59,30 @@ class ScriptExecutionCallback : public blink::WebScriptExecutionCallback {
|
||||
DISALLOW_COPY_AND_ASSIGN(ScriptExecutionCallback);
|
||||
};
|
||||
|
||||
class FrameSpellChecker : public content::RenderFrameVisitor {
|
||||
public:
|
||||
explicit FrameSpellChecker(SpellCheckClient* spell_check_client,
|
||||
content::RenderFrame* main_frame)
|
||||
: spell_check_client_(spell_check_client), main_frame_(main_frame) {}
|
||||
~FrameSpellChecker() override {
|
||||
spell_check_client_ = nullptr;
|
||||
main_frame_ = nullptr;
|
||||
}
|
||||
bool Visit(content::RenderFrame* render_frame) override {
|
||||
auto view = render_frame->GetRenderView();
|
||||
if (view->GetMainRenderFrame() == main_frame_ ||
|
||||
(render_frame->IsMainFrame() && render_frame == main_frame_)) {
|
||||
render_frame->GetWebFrame()->SetTextCheckClient(spell_check_client_);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
SpellCheckClient* spell_check_client_;
|
||||
content::RenderFrame* main_frame_;
|
||||
DISALLOW_COPY_AND_ASSIGN(FrameSpellChecker);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
WebFrame::WebFrame(v8::Isolate* isolate)
|
||||
@@ -139,10 +164,15 @@ void WebFrame::SetSpellCheckProvider(mate::Arguments* args,
|
||||
return;
|
||||
}
|
||||
|
||||
spell_check_client_.reset(new SpellCheckClient(
|
||||
std::unique_ptr<SpellCheckClient> client(new SpellCheckClient(
|
||||
language, auto_spell_correct_turned_on, args->isolate(), provider));
|
||||
// Set spellchecker for all live frames in the same process or
|
||||
// in the sandbox mode for all live sub frames to this WebFrame.
|
||||
FrameSpellChecker spell_checker(
|
||||
client.get(), content::RenderFrame::FromWebFrame(web_frame_));
|
||||
content::RenderFrame::ForEach(&spell_checker);
|
||||
spell_check_client_.swap(client);
|
||||
web_frame_->View()->SetSpellCheckClient(spell_check_client_.get());
|
||||
web_frame_->SetTextCheckClient(spell_check_client_.get());
|
||||
}
|
||||
|
||||
void WebFrame::RegisterURLSchemeAsSecure(const std::string& scheme) {
|
||||
|
||||
@@ -241,9 +241,16 @@
|
||||
# perform FPO regardless, so we must explicitly disable.
|
||||
# We still want the false setting above to avoid having
|
||||
# "/Oy /Oy-" and warnings about overriding.
|
||||
'AdditionalOptions': ['/Oy-'],
|
||||
'AdditionalOptions': ['/Oy-', '/d2guard4'],
|
||||
},
|
||||
'VCLinkerTool': {
|
||||
# Control Flow Guard is a security feature in Windows
|
||||
# 8.1 and higher designed to prevent exploitation of
|
||||
# indirect calls in executables.
|
||||
# Control Flow Guard is enabled using the /d2guard4
|
||||
# compiler setting in combination with the /guard:cf
|
||||
# linker setting.
|
||||
'AdditionalOptions': ['/guard:cf'],
|
||||
# Turn off incremental linking to save binary size.
|
||||
'LinkIncremental': '1', # /INCREMENTAL:NO
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
'product_name%': 'Electron',
|
||||
'company_name%': 'GitHub, Inc',
|
||||
'company_abbr%': 'github',
|
||||
'version%': '1.8.2-beta.2',
|
||||
'version%': '1.8.2-beta.4',
|
||||
'js2c_input_dir': '<(SHARED_INTERMEDIATE_DIR)/js2c',
|
||||
},
|
||||
'includes': [
|
||||
|
||||
@@ -98,6 +98,8 @@
|
||||
'atom/app/atom_main_delegate.cc',
|
||||
'atom/app/atom_main_delegate.h',
|
||||
'atom/app/atom_main_delegate_mac.mm',
|
||||
'atom/app/command_line_args.cc',
|
||||
'atom/app/command_line_args.h',
|
||||
'atom/app/node_main.cc',
|
||||
'atom/app/node_main.h',
|
||||
'atom/app/uv_task_runner.cc',
|
||||
|
||||
@@ -44,20 +44,23 @@ Menu.prototype._init = function () {
|
||||
}
|
||||
|
||||
Menu.prototype.popup = function (window, x, y, positioningItem) {
|
||||
let asyncPopup
|
||||
let asyncPopup, opts
|
||||
let [newX, newY, newPosition, newWindow] = [x, y, positioningItem, window]
|
||||
|
||||
// menu.popup(x, y, positioningItem)
|
||||
if (!window) {
|
||||
// shift over values
|
||||
if (typeof window !== 'object' || window.constructor !== BrowserWindow) {
|
||||
[newPosition, newY, newX, newWindow] = [y, x, window, null]
|
||||
}
|
||||
if (window != null && !(window instanceof BrowserWindow)) {
|
||||
[newPosition, newY, newX, newWindow] = [y, x, window, null]
|
||||
}
|
||||
|
||||
// menu.popup({})
|
||||
if (window != null && window.constructor === Object) {
|
||||
opts = window
|
||||
// menu.popup(window, {})
|
||||
if (x && typeof x === 'object') {
|
||||
const opts = x
|
||||
} else if (x && typeof x === 'object') {
|
||||
opts = x
|
||||
}
|
||||
|
||||
if (opts) {
|
||||
newX = opts.x
|
||||
newY = opts.y
|
||||
newPosition = opts.positioningItem
|
||||
@@ -65,13 +68,28 @@ Menu.prototype.popup = function (window, x, y, positioningItem) {
|
||||
}
|
||||
|
||||
// set defaults
|
||||
if (typeof x !== 'number') newX = -1
|
||||
if (typeof y !== 'number') newY = -1
|
||||
if (typeof positioningItem !== 'number') newPosition = -1
|
||||
if (!window) newWindow = BrowserWindow.getFocusedWindow()
|
||||
if (typeof newX !== 'number') newX = -1
|
||||
if (typeof newY !== 'number') newY = -1
|
||||
if (typeof newPosition !== 'number') newPosition = -1
|
||||
if (typeof asyncPopup !== 'boolean') asyncPopup = false
|
||||
if (!newWindow || (newWindow && newWindow.constructor !== BrowserWindow)) {
|
||||
newWindow = BrowserWindow.getFocusedWindow()
|
||||
|
||||
// No window focused?
|
||||
if (!newWindow) {
|
||||
const browserWindows = BrowserWindow.getAllWindows()
|
||||
|
||||
if (browserWindows && browserWindows.length > 0) {
|
||||
newWindow = browserWindows[0]
|
||||
} else {
|
||||
throw new Error(`Cannot open Menu without a BrowserWindow present`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.popupAt(newWindow, newX, newY, newPosition, asyncPopup)
|
||||
|
||||
return { browserWindow: newWindow, x: newX, y: newY, position: newPosition, async: asyncPopup }
|
||||
}
|
||||
|
||||
Menu.prototype.closePopup = function (window) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "electron",
|
||||
"version": "1.8.2-beta.2",
|
||||
"version": "1.8.2-beta.4",
|
||||
"repository": "https://github.com/electron/electron",
|
||||
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
|
||||
"devDependencies": {
|
||||
|
||||
@@ -531,6 +531,54 @@ describe('app module', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('app launch through uri', () => {
|
||||
before(function () {
|
||||
if (process.platform !== 'win32') {
|
||||
this.skip()
|
||||
}
|
||||
})
|
||||
|
||||
it('does not launch for blacklisted argument', function (done) {
|
||||
const appPath = path.join(__dirname, 'fixtures', 'api', 'quit-app')
|
||||
// App should exit with non 123 code.
|
||||
const first = ChildProcess.spawn(remote.process.execPath, [appPath, 'electron-test://?', '--no-sandbox', '--gpu-launcher=cmd.exe /c start calc'])
|
||||
first.once('exit', (code) => {
|
||||
assert.notEqual(code, 123)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('launches successfully for multiple uris in cmd args', function (done) {
|
||||
const appPath = path.join(__dirname, 'fixtures', 'api', 'quit-app')
|
||||
// App should exit with code 123.
|
||||
const first = ChildProcess.spawn(remote.process.execPath, [appPath, 'http://electronjs.org', 'electron-test://testdata'])
|
||||
first.once('exit', (code) => {
|
||||
assert.equal(code, 123)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('does not launch for encoded space', function (done) {
|
||||
const appPath = path.join(__dirname, 'fixtures', 'api', 'quit-app')
|
||||
// App should exit with non 123 code.
|
||||
const first = ChildProcess.spawn(remote.process.execPath, [appPath, 'electron-test://?', '--no-sandbox', '--gpu-launcher%20"cmd.exe /c start calc'])
|
||||
first.once('exit', (code) => {
|
||||
assert.notEqual(code, 123)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('launches successfully for argnames similar to blacklisted ones', function (done) {
|
||||
const appPath = path.join(__dirname, 'fixtures', 'api', 'quit-app')
|
||||
// inspect is blacklisted, but inspector should work, and app launch should succeed
|
||||
const first = ChildProcess.spawn(remote.process.execPath, [appPath, 'electron-test://?', '--inspector'])
|
||||
first.once('exit', (code) => {
|
||||
assert.equal(code, 123)
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('getFileIcon() API', () => {
|
||||
const iconPath = path.join(__dirname, 'fixtures/assets/icon.ico')
|
||||
const sizes = {
|
||||
|
||||
@@ -279,14 +279,26 @@ describe('Menu module', () => {
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
menu.closePopup()
|
||||
menu.closePopup(w)
|
||||
return closeWindow(w).then(() => { w = null })
|
||||
})
|
||||
|
||||
describe('when called with async: true', () => {
|
||||
it('returns immediately', () => {
|
||||
menu.popup(w, {x: 100, y: 100, async: true})
|
||||
menu.closePopup(w)
|
||||
})
|
||||
it('returns immediately', () => {
|
||||
const { browserWindow, x, y, async } = menu.popup(w, {x: 100, y: 101, async: true})
|
||||
|
||||
assert.equal(browserWindow, w)
|
||||
assert.equal(x, 100)
|
||||
assert.equal(y, 101)
|
||||
assert.equal(async, true)
|
||||
})
|
||||
|
||||
it('works without a given BrowserWindow and options', () => {
|
||||
const { browserWindow, x, y } = menu.popup({x: 100, y: 101, async: true})
|
||||
|
||||
assert.equal(browserWindow.constructor.name, 'BrowserWindow')
|
||||
assert.equal(x, 100)
|
||||
assert.equal(y, 101)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -293,6 +293,20 @@ describe('node feature', () => {
|
||||
buffer = new Buffer(new Array(4097).join(' '))
|
||||
assert.equal(buffer.length, 4096)
|
||||
})
|
||||
|
||||
it('does not crash for crypto operations', () => {
|
||||
const crypto = require('crypto')
|
||||
const data = 'lG9E+/g4JmRmedDAnihtBD4Dfaha/GFOjd+xUOQI05UtfVX3DjUXvrS98p7kZQwY3LNhdiFo7MY5rGft8yBuDhKuNNag9vRx/44IuClDhdQ='
|
||||
const key = 'q90K9yBqhWZnAMCMTOJfPQ=='
|
||||
const cipherText = '{"error_code":114,"error_message":"Tham số không hợp lệ","data":null}'
|
||||
for (let i = 0; i < 10000; ++i) {
|
||||
let iv = Buffer.from('0'.repeat(32), 'hex')
|
||||
let input = Buffer.from(data, 'base64')
|
||||
let decipher = crypto.createDecipheriv('aes-128-cbc', Buffer.from(key, 'base64'), iv)
|
||||
let result = Buffer.concat([decipher.update(input), decipher.final()])
|
||||
assert.equal(cipherText, result)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('process.stdout', () => {
|
||||
|
||||
2
vendor/libchromiumcontent
vendored
2
vendor/libchromiumcontent
vendored
Submodule vendor/libchromiumcontent updated: eb1db5393c...1cd005e43f
2
vendor/node
vendored
2
vendor/node
vendored
Submodule vendor/node updated: dc8fe9d390...b6a9b91826
Reference in New Issue
Block a user