mirror of
https://github.com/electron/electron.git
synced 2026-02-26 03:01:17 -05:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dcd216984f | ||
|
|
e012f61aee | ||
|
|
50e3a2ae20 | ||
|
|
b4413e9398 | ||
|
|
25df0f5d31 | ||
|
|
6b91371b6e | ||
|
|
8e6d332e96 | ||
|
|
eebd7cfa05 | ||
|
|
a4d73be9c5 | ||
|
|
0e9214a82b | ||
|
|
24c7365bef | ||
|
|
686aefb2cd | ||
|
|
0e0a1421fd | ||
|
|
c4e8c0fd0e |
@@ -930,6 +930,8 @@ step-ninja-summary: &step-ninja-summary
|
||||
run:
|
||||
name: Print ninja summary
|
||||
command: |
|
||||
set +e
|
||||
set +o pipefail
|
||||
python depot_tools/post_build_ninja_summary.py -C src/out/Default
|
||||
|
||||
step-ninja-report: &step-ninja-report
|
||||
|
||||
@@ -1 +1 @@
|
||||
11.1.0
|
||||
11.1.1
|
||||
@@ -9,7 +9,7 @@ with the operating system so that you can customize the operations for various
|
||||
shortcuts.
|
||||
|
||||
**Note:** The shortcut is global; it will work even if the app does
|
||||
not have the keyboard focus. You should not use this module until the `ready`
|
||||
not have the keyboard focus. This module cannot be used before the `ready`
|
||||
event of the app module is emitted.
|
||||
|
||||
```javascript
|
||||
|
||||
@@ -1796,7 +1796,7 @@ Returns `Boolean` - If *offscreen rendering* is enabled returns whether it is cu
|
||||
* `fps` Integer
|
||||
|
||||
If *offscreen rendering* is enabled sets the frame rate to the specified number.
|
||||
Only values between 1 and 60 are accepted.
|
||||
Only values between 1 and 240 are accepted.
|
||||
|
||||
#### `contents.getFrameRate()`
|
||||
|
||||
@@ -1894,7 +1894,7 @@ The zoom factor is the zoom percent divided by 100, so 300% = 3.0.
|
||||
#### `contents.frameRate`
|
||||
|
||||
An `Integer` property that sets the frame rate of the web contents to the specified number.
|
||||
Only values between 1 and 60 are accepted.
|
||||
Only values between 1 and 240 are accepted.
|
||||
|
||||
Only applicable if *offscreen rendering* is enabled.
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Two modes of rendering can be used and only the dirty area is passed in the
|
||||
`'paint'` event to be more efficient. The rendering can be stopped, continued
|
||||
and the frame rate can be set. The specified frame rate is a top limit value,
|
||||
when there is nothing happening on a webpage, no frames are generated. The
|
||||
maximum frame rate is 60, because above that there is no benefit, only
|
||||
maximum frame rate is 240, because above that there is no benefit, only
|
||||
performance loss.
|
||||
|
||||
**Note:** An offscreen window is always created as a [Frameless Window](../api/frameless-window.md).
|
||||
|
||||
@@ -612,9 +612,10 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
if (options.withFileTypes) {
|
||||
const dirents = [];
|
||||
for (const file of files) {
|
||||
const stats = archive.stat(file);
|
||||
const childPath = path.join(filePath, file);
|
||||
const stats = archive.stat(childPath);
|
||||
if (!stats) {
|
||||
const error = createError(AsarError.NOT_FOUND, { asarPath, filePath: file });
|
||||
const error = createError(AsarError.NOT_FOUND, { asarPath, filePath: childPath });
|
||||
nextTick(callback!, [error]);
|
||||
return;
|
||||
}
|
||||
@@ -654,9 +655,10 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
if (options && (options as any).withFileTypes) {
|
||||
const dirents = [];
|
||||
for (const file of files) {
|
||||
const stats = archive.stat(file);
|
||||
const childPath = path.join(filePath, file);
|
||||
const stats = archive.stat(childPath);
|
||||
if (!stats) {
|
||||
throw createError(AsarError.NOT_FOUND, { asarPath, filePath: file });
|
||||
throw createError(AsarError.NOT_FOUND, { asarPath, filePath: childPath });
|
||||
}
|
||||
if (stats.isFile) {
|
||||
dirents.push(new fs.Dirent(file, fs.constants.UV_DIRENT_FILE));
|
||||
|
||||
@@ -17,8 +17,12 @@ Object.setPrototypeOf(protocol, new Proxy({}, {
|
||||
|
||||
ownKeys () {
|
||||
if (!app.isReady()) return [];
|
||||
return Reflect.ownKeys(session.defaultSession!.protocol);
|
||||
},
|
||||
|
||||
return Object.getOwnPropertyNames(Object.getPrototypeOf(session.defaultSession!.protocol));
|
||||
has: (target, property: string) => {
|
||||
if (!app.isReady()) return false;
|
||||
return Reflect.has(session.defaultSession!.protocol, property);
|
||||
},
|
||||
|
||||
getOwnPropertyDescriptor () {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { EventEmitter } from 'events';
|
||||
const { createScreen } = process._linkedBinding('electron_common_screen');
|
||||
|
||||
let _screen: Electron.Screen;
|
||||
@@ -36,5 +37,11 @@ export default new Proxy({}, {
|
||||
getOwnPropertyDescriptor: (target, property: string) => {
|
||||
createScreenIfNeeded();
|
||||
return Reflect.getOwnPropertyDescriptor(_screen, property);
|
||||
},
|
||||
getPrototypeOf: () => {
|
||||
// This is necessary as a result of weirdness with EventEmitterMixin
|
||||
// and FunctionTemplate - we need to explicitly ensure it's returned
|
||||
// in the prototype.
|
||||
return EventEmitter.prototype;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -48,6 +48,9 @@ export const getSourcesImpl = (event: Electron.IpcMainEvent | null, args: Electr
|
||||
}
|
||||
// Remove from currentlyRunning once we resolve or reject
|
||||
currentlyRunning = currentlyRunning.filter(running => running.options !== options);
|
||||
if (event) {
|
||||
event.sender.removeListener('destroyed', stopRunning);
|
||||
}
|
||||
};
|
||||
|
||||
capturer._onerror = (error: string) => {
|
||||
@@ -66,7 +69,7 @@ export const getSourcesImpl = (event: Electron.IpcMainEvent | null, args: Electr
|
||||
// reference to emit and the capturer itself so that it never dispatches
|
||||
// back to the renderer
|
||||
if (event) {
|
||||
event.sender.once('destroyed', () => stopRunning());
|
||||
event.sender.once('destroyed', stopRunning);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "electron",
|
||||
"version": "11.1.0",
|
||||
"version": "11.1.1",
|
||||
"repository": "https://github.com/electron/electron",
|
||||
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
|
||||
"devDependencies": {
|
||||
|
||||
@@ -5,7 +5,6 @@ feat_add_uv_loop_watcher_queue_code.patch
|
||||
feat_initialize_asar_support.patch
|
||||
expose_get_builtin_module_function.patch
|
||||
fix_build_and_expose_inspector_agent.patch
|
||||
fix_expose_internalcallbackscope.patch
|
||||
build_add_gn_build_files.patch
|
||||
fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch
|
||||
feat_add_new_built_with_electron_variable_to_config_gypi.patch
|
||||
@@ -13,7 +12,6 @@ feat_add_flags_for_low-level_hooks_and_exceptions.patch
|
||||
fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch
|
||||
pass_all_globals_through_require.patch
|
||||
call_process_log_from_fallback_stream_on_windows.patch
|
||||
fixme_remove_async_id_assertion_check.patch
|
||||
fixme_comment_trace_event_macro.patch
|
||||
fix_key_gen_apis_are_not_available_in_boringssl.patch
|
||||
build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch
|
||||
@@ -47,3 +45,5 @@ crypto_update_certdata_to_nss_3_56.patch
|
||||
n-api_src_provide_asynchronous_cleanup_hooks.patch
|
||||
fix_add_v8_enable_reverse_jsargs_defines_in_common_gypi.patch
|
||||
chore_expose_v8_initialization_isolate_callbacks.patch
|
||||
fix_add_safeforterminationscopes_for_sigint_interruptions.patch
|
||||
allow_preventing_preparestacktracecallback.patch
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Mon, 7 Dec 2020 16:54:23 -0800
|
||||
Subject: Allow preventing PrepareStackTraceCallback
|
||||
|
||||
Node.js sets a stack trace handler specific to the v8::Context
|
||||
corresponding to the current Environment. When we're running in a
|
||||
non-Node.js v8::Context, there will be no correspondent Environment - we
|
||||
therefore need to prevent this handler being set so that Blink falls back to its
|
||||
default handling and displays the correct stacktrace.
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index e42416b4807fcc9d35a93399b916968b45ed0c7a..adf033f2e1855ad1c9738f9746677566aabedd87 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -226,9 +226,11 @@ void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
|
||||
s.fatal_error_callback : OnFatalError;
|
||||
isolate->SetFatalErrorHandler(fatal_error_cb);
|
||||
|
||||
- auto* prepare_stack_trace_cb = s.prepare_stack_trace_callback ?
|
||||
- s.prepare_stack_trace_callback : Environment::PrepareStackTraceCallback;
|
||||
- isolate->SetPrepareStackTraceCallback(prepare_stack_trace_cb);
|
||||
+ if ((s.flags & SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK) == 0) {
|
||||
+ auto* prepare_stack_trace_cb = s.prepare_stack_trace_callback ?
|
||||
+ s.prepare_stack_trace_callback : Environment::PrepareStackTraceCallback;
|
||||
+ isolate->SetPrepareStackTraceCallback(prepare_stack_trace_cb);
|
||||
+ }
|
||||
}
|
||||
|
||||
void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index 4c4e55e338d7b42c36818a45f6b41170c495adde..ad2727fbab366df0dcc60d7562951c953f952ae3 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -305,7 +305,8 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {
|
||||
enum IsolateSettingsFlags {
|
||||
MESSAGE_LISTENER_WITH_ERROR_LEVEL = 1 << 0,
|
||||
DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1,
|
||||
- SHOULD_SET_PROMISE_REJECTION_CALLBACK = 1 << 2
|
||||
+ SHOULD_SET_PROMISE_REJECTION_CALLBACK = 1 << 2,
|
||||
+ SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK = 1 << 3
|
||||
};
|
||||
|
||||
struct IsolateSettings {
|
||||
@@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Thu, 10 Dec 2020 14:39:33 -0800
|
||||
Subject: fix: add SafeForTerminationScopes for SIGINT interruptions
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
We start Node.js with only_terminate_in_safe_scope set to true becuase
|
||||
it's set by gin’s IsolateHolder. In those cases, parts of the API that
|
||||
expect execution termination to happen need to be marked as able to
|
||||
receive those events.
|
||||
|
||||
Upstreamed at https://github.com/nodejs/node/pull/36344.
|
||||
|
||||
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
|
||||
index 97403eb54c9445e170aad25764513a51f82e555c..096b85b8a39ce9227c94c31d824a633e12c6622e 100644
|
||||
--- a/src/module_wrap.cc
|
||||
+++ b/src/module_wrap.cc
|
||||
@@ -332,6 +332,7 @@ void ModuleWrap::Evaluate(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
ShouldNotAbortOnUncaughtScope no_abort_scope(env);
|
||||
TryCatchScope try_catch(env);
|
||||
+ Isolate::SafeForTerminationScope safe_for_termination(env->isolate());
|
||||
|
||||
bool timed_out = false;
|
||||
bool received_signal = false;
|
||||
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
|
||||
index b90b369d1b379c0e909fd6722d315dcac765a330..69cf0f17cff66d33164c2a31cc1e4feeb1c791fd 100644
|
||||
--- a/src/node_contextify.cc
|
||||
+++ b/src/node_contextify.cc
|
||||
@@ -908,6 +908,7 @@ bool ContextifyScript::EvalMachine(Environment* env,
|
||||
return false;
|
||||
}
|
||||
TryCatchScope try_catch(env);
|
||||
+ Isolate::SafeForTerminationScope safe_for_termination(env->isolate());
|
||||
ContextifyScript* wrapped_script;
|
||||
ASSIGN_OR_RETURN_UNWRAP(&wrapped_script, args.Holder(), false);
|
||||
Local<UnboundScript> unbound_script =
|
||||
@@ -1,20 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: deepak1556 <hop2deep@gmail.com>
|
||||
Date: Sat, 6 Jan 2018 18:28:10 +0530
|
||||
Subject: fix: expose InternalCallbackScope
|
||||
|
||||
This commit exposes InternalCallbackScope in order to allow us access to its internal flags.
|
||||
|
||||
diff --git a/src/node_internals.h b/src/node_internals.h
|
||||
index c1555b312e2f22e191d91d34a348d2e163d85b5b..084ecfa73657d1958d7552baa896e170934639c8 100644
|
||||
--- a/src/node_internals.h
|
||||
+++ b/src/node_internals.h
|
||||
@@ -209,7 +209,7 @@ v8::MaybeLocal<v8::Value> InternalMakeCallback(
|
||||
v8::Local<v8::Value> argv[],
|
||||
async_context asyncContext);
|
||||
|
||||
-class InternalCallbackScope {
|
||||
+class NODE_EXTERN InternalCallbackScope {
|
||||
public:
|
||||
enum Flags {
|
||||
kNoFlags = 0,
|
||||
@@ -7,7 +7,7 @@ This broke the build at some point. Does it still? We should probably remove
|
||||
this patch and find out!
|
||||
|
||||
diff --git a/src/node_internals.h b/src/node_internals.h
|
||||
index 084ecfa73657d1958d7552baa896e170934639c8..cb388f3a9f12949fd3ecb0406f7b550f4ca5ca7c 100644
|
||||
index c1555b312e2f22e191d91d34a348d2e163d85b5b..b92cc7edbfb60ec8182db5083f8b7aebd5c5da94 100644
|
||||
--- a/src/node_internals.h
|
||||
+++ b/src/node_internals.h
|
||||
@@ -375,10 +375,11 @@ class TraceEventScope {
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Thu, 13 Sep 2018 09:08:10 -0700
|
||||
Subject: FIXME: remove async_id assertion check
|
||||
|
||||
async hooks are hella broken in Electron. This was checking that they weren't,
|
||||
but they are, so we just disabled the check. YOLO.
|
||||
|
||||
diff --git a/src/api/callback.cc b/src/api/callback.cc
|
||||
index 9f52c25cf0d9005c2e70b76eb52eae1bd15f0a53..e151871dc90b6c29dc3fc3db162e24baeb45923d 100644
|
||||
--- a/src/api/callback.cc
|
||||
+++ b/src/api/callback.cc
|
||||
@@ -117,12 +117,14 @@ void InternalCallbackScope::Close() {
|
||||
perform_stopping_check();
|
||||
}
|
||||
|
||||
+#if 0 // FIXME(codebytere): figure out why this check fails/causes crash
|
||||
// Make sure the stack unwound properly. If there are nested MakeCallback's
|
||||
// then it should return early and not reach this code.
|
||||
if (env_->async_hooks()->fields()[AsyncHooks::kTotals]) {
|
||||
CHECK_EQ(env_->execution_async_id(), 0);
|
||||
CHECK_EQ(env_->trigger_async_id(), 0);
|
||||
}
|
||||
+#endif
|
||||
|
||||
if (!tick_info->has_tick_scheduled() && !tick_info->has_rejection_to_warn()) {
|
||||
return;
|
||||
@@ -9,7 +9,7 @@ be overridden. This patch can be removed once the relevant version of V8
|
||||
makes its way into Node.js.
|
||||
|
||||
diff --git a/src/node_internals.h b/src/node_internals.h
|
||||
index cb388f3a9f12949fd3ecb0406f7b550f4ca5ca7c..f4b5c9bb7058da2355204a7285e5f7cc70c4ffda 100644
|
||||
index b92cc7edbfb60ec8182db5083f8b7aebd5c5da94..294bed9175125bbd544c7aa7df4229d182ca442d 100644
|
||||
--- a/src/node_internals.h
|
||||
+++ b/src/node_internals.h
|
||||
@@ -115,7 +115,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator {
|
||||
|
||||
@@ -145,7 +145,6 @@
|
||||
"parallel/test-v8-flags",
|
||||
"parallel/test-vm-module-basic",
|
||||
"parallel/test-vm-parse-abort-on-uncaught-exception",
|
||||
"parallel/test-vm-sigint",
|
||||
"parallel/test-vm-sigint-existing-handler",
|
||||
"parallel/test-vm-timeout",
|
||||
"parallel/test-whatwg-encoding-custom-textdecoder",
|
||||
|
||||
@@ -243,14 +243,8 @@ int NodeMain(int argc, char* argv[]) {
|
||||
NodeDebugger node_debugger(env);
|
||||
node_debugger.Start();
|
||||
|
||||
// TODO(codebytere): we should try to handle this upstream.
|
||||
{
|
||||
v8::HandleScope scope(isolate);
|
||||
node::InternalCallbackScope callback_scope(
|
||||
env, v8::Object::New(isolate), {1, 0},
|
||||
node::InternalCallbackScope::kSkipAsyncHooks);
|
||||
node::LoadEnvironment(env);
|
||||
}
|
||||
v8::HandleScope scope(isolate);
|
||||
node::LoadEnvironment(env);
|
||||
|
||||
env->set_trace_sync_io(env->options()->trace_sync_io);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "gin/dictionary.h"
|
||||
#include "gin/object_template_builder.h"
|
||||
#include "shell/browser/api/electron_api_system_preferences.h"
|
||||
#include "shell/browser/browser.h"
|
||||
#include "shell/common/gin_converters/accelerator_converter.h"
|
||||
#include "shell/common/gin_converters/callback_converter.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
@@ -84,6 +85,11 @@ void GlobalShortcut::OnKeyPressed(const ui::Accelerator& accelerator) {
|
||||
bool GlobalShortcut::RegisterAll(
|
||||
const std::vector<ui::Accelerator>& accelerators,
|
||||
const base::Closure& callback) {
|
||||
if (!electron::Browser::Get()->is_ready()) {
|
||||
gin_helper::ErrorThrower(JavascriptEnvironment::GetIsolate())
|
||||
.ThrowError("globalShortcut cannot be used before the app is ready");
|
||||
return false;
|
||||
}
|
||||
std::vector<ui::Accelerator> registered;
|
||||
|
||||
for (auto& accelerator : accelerators) {
|
||||
@@ -100,6 +106,11 @@ bool GlobalShortcut::RegisterAll(
|
||||
|
||||
bool GlobalShortcut::Register(const ui::Accelerator& accelerator,
|
||||
const base::Closure& callback) {
|
||||
if (!electron::Browser::Get()->is_ready()) {
|
||||
gin_helper::ErrorThrower(JavascriptEnvironment::GetIsolate())
|
||||
.ThrowError("globalShortcut cannot be used before the app is ready");
|
||||
return false;
|
||||
}
|
||||
#if defined(OS_MAC)
|
||||
if (Command::IsMediaKey(accelerator)) {
|
||||
if (RegisteringMediaKeyForUntrustedClient(accelerator))
|
||||
@@ -119,6 +130,11 @@ bool GlobalShortcut::Register(const ui::Accelerator& accelerator,
|
||||
}
|
||||
|
||||
void GlobalShortcut::Unregister(const ui::Accelerator& accelerator) {
|
||||
if (!electron::Browser::Get()->is_ready()) {
|
||||
gin_helper::ErrorThrower(JavascriptEnvironment::GetIsolate())
|
||||
.ThrowError("globalShortcut cannot be used before the app is ready");
|
||||
return;
|
||||
}
|
||||
if (accelerator_callback_map_.erase(accelerator) == 0)
|
||||
return;
|
||||
|
||||
@@ -145,6 +161,11 @@ bool GlobalShortcut::IsRegistered(const ui::Accelerator& accelerator) {
|
||||
}
|
||||
|
||||
void GlobalShortcut::UnregisterAll() {
|
||||
if (!electron::Browser::Get()->is_ready()) {
|
||||
gin_helper::ErrorThrower(JavascriptEnvironment::GetIsolate())
|
||||
.ThrowError("globalShortcut cannot be used before the app is ready");
|
||||
return;
|
||||
}
|
||||
accelerator_callback_map_.clear();
|
||||
GlobalShortcutListener::GetInstance()->UnregisterAccelerators(this);
|
||||
}
|
||||
|
||||
@@ -21,11 +21,15 @@ Event::Event() {}
|
||||
Event::~Event() {
|
||||
if (callback_) {
|
||||
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
auto message = gin::DataObjectBuilder(isolate)
|
||||
.Set("error", "reply was never sent")
|
||||
.Build();
|
||||
SendReply(isolate, message);
|
||||
// If there's no current context, it means we're shutting down, so we don't
|
||||
// need to send an event.
|
||||
if (!isolate->GetCurrentContext().IsEmpty()) {
|
||||
v8::HandleScope scope(isolate);
|
||||
auto message = gin::DataObjectBuilder(isolate)
|
||||
.Set("error", "reply was never sent")
|
||||
.Build();
|
||||
SendReply(isolate, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +66,7 @@ gin::ObjectTemplateBuilder Event::GetObjectTemplateBuilder(
|
||||
}
|
||||
|
||||
const char* Event::GetTypeName() {
|
||||
return "WebRequest";
|
||||
return "Event";
|
||||
}
|
||||
|
||||
// static
|
||||
|
||||
@@ -90,7 +90,6 @@ class ElectronBrowserMainParts : public content::BrowserMainParts {
|
||||
|
||||
Browser* browser() { return browser_.get(); }
|
||||
BrowserProcessImpl* browser_process() { return fake_browser_process_.get(); }
|
||||
NodeEnvironment* node_env() { return node_env_.get(); }
|
||||
|
||||
protected:
|
||||
// content::BrowserMainParts:
|
||||
|
||||
@@ -29,11 +29,9 @@ void MicrotasksRunner::DidProcessTask(const base::PendingTask& pending_task) {
|
||||
// up Node.js dealying its callbacks. To fix this, now we always lets Node.js
|
||||
// handle the checkpoint in the browser process.
|
||||
{
|
||||
auto* node_env = electron::ElectronBrowserMainParts::Get()->node_env();
|
||||
v8::HandleScope scope(isolate_);
|
||||
node::InternalCallbackScope microtasks_scope(
|
||||
node_env->env(), v8::Object::New(isolate_), {0, 0},
|
||||
node::InternalCallbackScope::kNoFlags);
|
||||
node::CallbackScope microtasks_scope(isolate_, v8::Object::New(isolate_),
|
||||
{0, 0});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 11,1,0,0
|
||||
PRODUCTVERSION 11,1,0,0
|
||||
FILEVERSION 11,1,1,0
|
||||
PRODUCTVERSION 11,1,1,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -68,12 +68,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "GitHub, Inc."
|
||||
VALUE "FileDescription", "Electron"
|
||||
VALUE "FileVersion", "11.1.0"
|
||||
VALUE "FileVersion", "11.1.1"
|
||||
VALUE "InternalName", "electron.exe"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
|
||||
VALUE "OriginalFilename", "electron.exe"
|
||||
VALUE "ProductName", "Electron"
|
||||
VALUE "ProductVersion", "11.1.0"
|
||||
VALUE "ProductVersion", "11.1.1"
|
||||
VALUE "SquirrelAwareVersion", "1"
|
||||
END
|
||||
END
|
||||
|
||||
@@ -115,9 +115,8 @@ void ElectronBindings::OnCallNextTick(uv_async_t* handle) {
|
||||
gin_helper::Locker locker(env->isolate());
|
||||
v8::Context::Scope context_scope(env->context());
|
||||
v8::HandleScope handle_scope(env->isolate());
|
||||
node::InternalCallbackScope scope(env, v8::Object::New(env->isolate()),
|
||||
{0, 0},
|
||||
node::InternalCallbackScope::kNoFlags);
|
||||
node::CallbackScope scope(env->isolate(), v8::Object::New(env->isolate()),
|
||||
{0, 0});
|
||||
}
|
||||
|
||||
self->pending_next_ticks_.clear();
|
||||
|
||||
@@ -173,14 +173,18 @@ void ErrorMessageListener(v8::Local<v8::Message> message,
|
||||
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
||||
node::Environment* env = node::Environment::GetCurrent(isolate);
|
||||
|
||||
// TODO(codebytere): properly emit the after() hooks now
|
||||
// that the exception has been handled.
|
||||
// See node/lib/internal/process/execution.js#L176-L180
|
||||
|
||||
// Ensure that the async id stack is properly cleared so the async
|
||||
// hook stack does not become corrupted.
|
||||
|
||||
if (env) {
|
||||
// Emit the after() hooks now that the exception has been handled.
|
||||
// Analogous to node/lib/internal/process/execution.js#L176-L180
|
||||
if (env->async_hooks()->fields()[node::AsyncHooks::kAfter]) {
|
||||
while (env->async_hooks()->fields()[node::AsyncHooks::kStackLength]) {
|
||||
node::AsyncWrap::EmitAfter(env, env->execution_async_id());
|
||||
env->async_hooks()->pop_async_context(env->execution_async_id());
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure that the async id stack is properly cleared so the async
|
||||
// hook stack does not become corrupted.
|
||||
env->async_hooks()->clear_async_id_stack();
|
||||
}
|
||||
}
|
||||
@@ -502,6 +506,13 @@ node::Environment* NodeBindings::CreateEnvironment(
|
||||
// context. We need to use the one Blink already provides.
|
||||
is.flags &=
|
||||
~node::IsolateSettingsFlags::SHOULD_SET_PROMISE_REJECTION_CALLBACK;
|
||||
|
||||
// We do not want to use the stack trace callback that Node.js uses,
|
||||
// because it relies on Node.js being aware of the current Context and
|
||||
// that's not always the case. We need to use the one Blink already
|
||||
// provides.
|
||||
is.flags |=
|
||||
node::IsolateSettingsFlags::SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK;
|
||||
}
|
||||
|
||||
// This needs to be called before the inspector is initialized.
|
||||
|
||||
@@ -7,7 +7,7 @@ import { ipcMain, BrowserWindow } from 'electron/main';
|
||||
import { emittedOnce } from './events-helpers';
|
||||
import { NativeImage } from 'electron/common';
|
||||
import { serialize, deserialize } from '../lib/common/type-utils';
|
||||
import { nativeImage } from 'electron';
|
||||
import { protocol, nativeImage } from 'electron';
|
||||
|
||||
const features = process._linkedBinding('electron_common_features');
|
||||
|
||||
@@ -635,6 +635,16 @@ ifdescribe(features.isRemoteModuleEnabled())('remote module', () => {
|
||||
const { functionWithToStringProperty } = require('electron').remote.require(path.join(fixtures, 'module', 'to-string-non-function.js'));
|
||||
expect(functionWithToStringProperty.toString).to.equal('hello');
|
||||
});
|
||||
|
||||
const protocolKeys = Object.getOwnPropertyNames(protocol);
|
||||
remotely.it(protocolKeys)('remote.protocol returns all keys', (protocolKeys: [string]) => {
|
||||
const protocol = require('electron').remote.protocol;
|
||||
const remoteKeys = Object.getOwnPropertyNames(protocol);
|
||||
expect(remoteKeys).to.deep.equal(protocolKeys);
|
||||
for (const key of remoteKeys) {
|
||||
expect(typeof (protocol as any)[key]).to.equal('function');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('remote object in renderer', () => {
|
||||
|
||||
@@ -920,6 +920,16 @@ describe('asar package', function () {
|
||||
expect(names).to.deep.equal(['dir1', 'dir2', 'dir3', 'file1', 'file2', 'file3', 'link1', 'link2', 'ping.js']);
|
||||
});
|
||||
|
||||
it('supports withFileTypes for a deep directory', function () {
|
||||
const p = path.join(asarDir, 'a.asar', 'dir3');
|
||||
const dirs = fs.readdirSync(p, { withFileTypes: true });
|
||||
for (const dir of dirs) {
|
||||
expect(dir instanceof fs.Dirent).to.be.true();
|
||||
}
|
||||
const names = dirs.map(a => a.name);
|
||||
expect(names).to.deep.equal(['file1', 'file2', 'file3']);
|
||||
});
|
||||
|
||||
it('reads dirs from a linked dir', function () {
|
||||
const p = path.join(asarDir, 'a.asar', 'link2', 'link2');
|
||||
const dirs = fs.readdirSync(p);
|
||||
|
||||
Reference in New Issue
Block a user