Compare commits

...

50 Commits

Author SHA1 Message Date
Electron Bot
8acbb9a3ad Bump v6.0.0-beta.3 2019-05-14 12:10:18 -07:00
trop[bot]
f5e28bc999 fix: default enable_negotiate_port to false (#18285) 2019-05-14 12:51:41 -05:00
trop[bot]
b45ad7f74e fix: destroy tray on current tick (#18218)
* fix: destroy tray on current tick

* test: add tray destroy specs

* use more idiomatic destructor syntax
2019-05-09 14:42:34 -04:00
trop[bot]
9e9238454e build: linux needs java on GN (#18217) 2019-05-09 11:05:33 -04:00
Electron Bot
3f2aba69ee Bump v6.0.0-beta.2 2019-05-07 19:51:34 -07:00
Shelley Vohr
371e804c6b Revert "Bump v6.0.0-beta.2"
This reverts commit c54b67300e.
2019-05-07 19:49:30 -07:00
trop[bot]
6131e89aa9 build: remove deprecated octokit auth calls (#18206) 2019-05-07 19:48:34 -07:00
Electron Bot
c54b67300e Bump v6.0.0-beta.2 2019-05-07 15:41:03 -07:00
John Kleinschmidt
e847f048d7 build: only delete .git directory on Mac builds (#18200) 2019-05-07 15:39:43 -07:00
Shelley Vohr
b5955fa663 Revert "Bump v6.0.0-beta.2"
This reverts commit a648e6c06d.
2019-05-07 15:00:14 -07:00
Electron Bot
a648e6c06d Bump v6.0.0-beta.2 2019-05-07 12:43:19 -07:00
Nitish Sakhawalkar
e6216da031 chore: Add patch to partially revert chromium crashpad change (#18198)
This adds a patch to support functionality that we were using but chromium changed it. Electron uses breakpad on windows, chromium uses crashpad (which is newer). So this patch is needed until we update electron to use crashpad for windows.
2019-05-07 12:35:10 -07:00
Jeremy Apthorp
5b7bd56367 chore: deprecate the 'options' argument to clearAuthCache (#18131)
The network service APIs do not support the fine-grained clearing of the auth cache. In preparation for switching to the network service in 7.x, log a warning that the options argument is deprecated. Ref #17970.

This might not be quite right as we could also potentially expose the new options that are available: namely, start and end time. #17970 does not expose those options, but it would in theory be possible to support them with the existing network service APIs. The current options object does not offer time-based cache clearing.
2019-05-07 09:55:15 -07:00
trop[bot]
01b1c0ca8b fix: crash on systemPreferences.getAccentColor() (#18195) 2019-05-07 09:51:36 -07:00
Shelley Vohr
05ced19f9f chore: deprecate shell.openExternalSync (#18179) 2019-05-07 08:19:52 -07:00
trop[bot]
b8ef669905 refactor: allow embedder overriding of internal FS calls (#17906) (#18192) 2019-05-07 08:00:40 -07:00
trop[bot]
212ce1840f docs: clarify clipboard type options (#18175) 2019-05-06 09:29:42 -07:00
trop[bot]
e090fa94d0 fix: do not mark navigations interupted with same-document navigations as aborted (#18143)
* fix: do not mark navigations interupted with same-document navigations as aborted

* spec: add tests for the loadURL promise
2019-05-03 23:08:57 -07:00
trop[bot]
a431f1a663 fix: correctly parse default_app path on windows (#18102) 2019-05-03 08:16:57 -07:00
trop[bot]
ea6815c0f7 fix: fs.promises does not work with asar paths (#18114) 2019-05-02 22:34:19 -07:00
Electron Bot
40e05eef23 chore: bump chromium to 76.0.3783.1 (6-0-x) (#18116) 2019-05-02 16:31:29 -07:00
trop[bot]
a790e702f5 build: free up space before running macos ci (#18099)
* build: free up space before running macos ci

* build: also delete 14GB of src/.git for bonus space
2019-05-01 13:48:25 -07:00
trop[bot]
be16a195fb fix: ensure the inspector agent is shutdown before cleaning up the node env (#18077)
* fix: ensure the inspector agent is shutdown before cleaning up the node env

* spec: add tests to ensure clean shutdown with connected inspector agent

* Update node_debugger.cc
2019-05-01 13:47:22 -07:00
trop[bot]
2f10c0fd6d docs: fix webContents 'new-window' event handler sample (#18098) 2019-05-01 13:44:47 -07:00
trop[bot]
276c07d3d7 docs: remove incorrectly added let for the win variable (#18095) 2019-05-01 12:41:59 -07:00
Samuel Attard
57f7c8b6b9 build: ensure consistent lock files across multiple machines (#17955) (#18071)
* build: ensure consistent package-lock across multiple machines

* build: fix linting errors and use npm ci instead of npm install

* build: use a yarn.lock and yarn instead of package-lock and npm

* chore: replace package-lock.json files with yarn.lock

* chore: replace last instance of `npm install`
2019-05-01 11:11:52 -07:00
trop[bot]
2ce22ba0e9 fix: explicitly focus window on win.show() (#18081) 2019-05-01 10:44:30 -07:00
Electron Bot
7186c62a27 Bump v6.0.0-beta.1 2019-04-30 14:46:01 -07:00
Electron Bot
bf88a13f1e Revert "Bump v6.0.0-beta.1"
This reverts commit 6e9c540baf.
2019-04-30 13:16:51 -07:00
Electron Bot
6e9c540baf Bump v6.0.0-beta.1 2019-04-30 13:11:22 -07:00
Electron Bot
24b14d55ef Revert "Bump v6.0.0-beta.1"
This reverts commit 3b8eb6c061.
2019-04-30 13:09:29 -07:00
Electron Bot
3b8eb6c061 Bump v6.0.0-beta.1 2019-04-30 13:04:14 -07:00
Electron Bot
f9b7f6389e Revert "Bump v6.0.0-beta.1"
This reverts commit 8f30faacf8.
2019-04-30 13:02:36 -07:00
Electron Bot
8f30faacf8 Bump v6.0.0-beta.1 2019-04-30 12:59:08 -07:00
trop[bot]
f631890237 chore: disable Vulkan validation layers (#18062) 2019-04-30 12:49:43 -07:00
trop[bot]
8982889a8d build: fix issues for stable release we fixed in 5-0-x (#18068)
* build: fix release notes generation

* build: fix bump-version script for stable releases
2019-04-30 12:49:25 -07:00
trop[bot]
cd3539aaf8 refactor: rewire the desktop capturer API to remove race conditions (#18042)
We now create a new instance of atom::api::DesktopCapturer for every
request instead of weirdly re-using the same instance and queuing
requests.  This means there is now a 1:1 relationship between request
and DesktopCapturer so there isn't a race condition between the observer
for one request calling back before the observer of another.  This is an
issue ever since the backing APIs moved to worker threads.

This also does a few things to ensure memory management
* Only ever listen to one event per-request, after that we wipe the emit
function to ignore all future events
* Ensures we clean up the window_capturer_, screen_capturer_ and
captured_sources_ in native land once the request is over.

This _in theory_ fixes a flake we've been seeing on CI where we try to
resolve the promise for a request that no longerr exists.
2019-04-30 07:07:56 -07:00
Samuel Attard
275e277721 feat: upgrade to Node 12 (#17838) (#18044)
* fix: add boringssl backport to support node upgrade

* fix: Update node_includes.h, add DCHECK macros

* fix: Update node Debug Options parser usage

* fix: Fix asar setup

* fix: using v8Util in isolated context

* fix: make "process" available in preload scripts

* fix: use proper options parser and remove setting of _breakFirstLine

_breakFirstLine was being set on the process, but that has changed in node 12 and so is no longer needed. Node will handle it properly when --inspect-brk is provided

* chore: update node dep sha

* fix: process.binding => _linkedBinding in sandboxed isolated preload

* fix: make original-fs work with streams

* build: override node module version

* fix: use _linkedBinding in content_script/init.js

* chore: update node ref in DEPS

* build: node_module_version should be 73
2019-04-29 15:52:31 -07:00
trop[bot]
283b1241d5 docs: Correct doc for registerFileProtocol (#18050)
In the registerFileProtocol docs the "headers" argument of the callback was described as being a list.
In fact is has to be an Object mapping header-entries to values. This can be seen in Line 326 of `/spec/api-protocol-spec.js` [fe618631f1/spec/api-protocol-spec.js (L326)].
2019-04-29 15:30:34 -07:00
trop[bot]
7bdea26085 docs: update nodeIntegration section for new defaults (#18047)
* docs: update nodeIntegration section for new defaults

* docs: update docs/tutorial/first-app.md

* Update docs/tutorial/security.md

Co-Authored-By: miniak <milan.burda@gmail.com>
2019-04-29 15:18:23 -07:00
Samuel Attard
f1fa589779 chore: upgrade chromium to 76 (#17921) 2019-04-29 12:48:28 -07:00
trop[bot]
7226ad1eba fix: crash when failed to get devices in desktopCapturer (#17973)
* fix: crash when failed to get devices in desktopCapturer

* return after emit
2019-04-26 08:05:12 -07:00
trop[bot]
d92743f0f3 docs: remove outdated refs to protocol.registerStandardSchemes (#17977) 2019-04-26 08:05:03 -07:00
trop[bot]
2c309efef4 docs: add azure vm spinup tutorial (#17975) 2019-04-25 15:49:21 -07:00
trop[bot]
0b418315a3 docs: clean up the native module tutorial (#17951) 2019-04-24 11:25:34 -07:00
trop[bot]
2f474867c7 fix: permission handler regression in default app (#17950) 2019-04-24 11:25:17 -07:00
trop[bot]
0b5acd9569 refactor: add missing constants for options (#17919) 2019-04-24 10:16:53 -07:00
Jeremy Apthorp
3419c3c730 chore: bump chromium to 75.0.3770.3 (#17883) 2019-04-23 14:29:16 -07:00
trop[bot]
754200f1b1 fix: crash when run from SMB network share (#17909) 2019-04-23 09:03:51 -07:00
Samuel Attard
37f4bd4dd0 build: reset version to 6.0.0-beta.0 in prep for 6.0.0-beta.1 2019-04-19 15:35:46 -07:00
222 changed files with 13922 additions and 16508 deletions

View File

@@ -176,6 +176,22 @@ step-restore-brew-cache: &step-restore-brew-cache
keys:
- v1-brew-cache-{{ arch }}
step-get-more-space-on-mac: &step-get-more-space-on-mac
run:
name: Free up space on MacOS
command: |
if [ "`uname`" == "Darwin" ]; then
sudo rm -rf /Library/Developer/CoreSimulator
fi
step-delete-git-directories: &step-delete-git-directories
run:
name: Delete src/.git directory on MacOS to free space
command: |
if [ "`uname`" == "Darwin" ]; then
sudo rm -rf src/.git
fi
# On macOS the npm install command during gclient sync was run on a linux
# machine and therefore installed a slightly different set of dependencies
# Notably "fsevents" is a macOS only dependency, we rerun npm install once
@@ -535,6 +551,7 @@ steps-checkout: &steps-checkout
- *step-depot-tools-get
- *step-depot-tools-add-to-path
- *step-restore-brew-cache
- *step-get-more-space-on-mac
- *step-install-gnutar-on-mac
- restore_cache:
@@ -651,9 +668,11 @@ steps-electron-build-for-publish: &steps-electron-build-for-publish
- *step-depot-tools-get
- *step-depot-tools-add-to-path
- *step-restore-brew-cache
- *step-get-more-space-on-mac
- *step-gclient-sync
- *step-setup-env-for-build
- *step-gn-gen-default
- *step-delete-git-directories
# Electron app
- *step-electron-build

View File

@@ -16,7 +16,8 @@
}],
"prefer-const": ["error", {
"destructuring": "all"
}]
}],
"node/no-deprecated-api": 0
},
"parserOptions": {
"ecmaVersion": 6,

2
.gitignore vendored
View File

@@ -37,7 +37,7 @@
/vendor/pyyaml
node_modules/
SHASUMS256.txt
**/yarn.lock
**/package-lock.json
compile_commands.json
.envrc

View File

@@ -64,7 +64,7 @@ config("branding") {
npm_action("build_electron_definitions") {
script = "gn-typescript-definitions"
args = [ rebase_path("$target_gen_dir/tsc/typings/electron.d.ts") ]
inputs = auto_filenames.api_docs + [ "package-lock.json" ]
inputs = auto_filenames.api_docs + [ "yarn.lock" ]
outputs = [
"$target_gen_dir/tsc/typings/electron.d.ts",
@@ -547,6 +547,7 @@ static_library("electron_lib") {
deps += [
"//third_party/crashpad/crashpad/client",
"//ui/accelerated_widget_mac",
"//ui/views_bridge_mac",
]
sources += [
"atom/browser/ui/views/autofill_popup_view.cc",
@@ -1067,6 +1068,7 @@ template("dist_zip") {
"deps",
"data_deps",
"data",
"testonly",
])
write_runtime_deps = _runtime_deps_file
}
@@ -1076,7 +1078,11 @@ template("dist_zip") {
deps = [
":$_runtime_deps_target",
]
forward_variables_from(invoker, [ "outputs" ])
forward_variables_from(invoker,
[
"outputs",
"testonly",
])
args = rebase_path(outputs + [ _runtime_deps_file ], root_build_dir) + [
target_cpu,
target_os,
@@ -1144,6 +1150,7 @@ dist_zip("electron_ffmpeg_zip") {
}
dist_zip("electron_chromedriver_zip") {
testonly = true
data_deps = [
"//chrome/test/chromedriver",
":licenses",

9
DEPS
View File

@@ -10,9 +10,9 @@ gclient_gn_args = [
vars = {
'chromium_version':
'75.0.3740.3',
'76.0.3783.1',
'node_version':
'2dc0f8811b2b295c08d797b8a11b030234c98502',
'a86a4a160dc520c61a602c949a32a1bc4c0fc633',
'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b',
'pyyaml_version': '3.12',
@@ -24,6 +24,9 @@ vars = {
'requests_git': 'https://github.com/kennethreitz',
'yaml_git': 'https://github.com/yaml',
# KEEP IN SYNC WITH spec-runner FILE
'yarn_version': '1.15.2',
# To be able to build clean Chromium from sources.
'apply_patches': True,
@@ -107,7 +110,7 @@ hooks = [
'action': [
'python',
'-c',
'import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python", "script/lib/npm.py", "install"]);',
'import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python", "script/lib/npx.py", "yarn@' + (Var("yarn_version")) + '", "install", "--frozen-lockfile"]);',
],
},
{

View File

@@ -1 +1 @@
6.0.0-nightly.20190404
6.0.0-beta.3

View File

@@ -25,11 +25,12 @@
version: 1.0.{build}
build_cloud: libcc-20
image: libcc-20-vs2017-15.7.4
image: libcc-20-vs2017-15.9
environment:
GIT_CACHE_PATH: C:\Users\electron\libcc_cache
DISABLE_CRASH_REPORTER_TESTS: true
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
build_script:
- ps: >-
if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
@@ -38,7 +39,7 @@ build_script:
- echo "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
- cd ..
- md src
- ps: if (Test-Path src\electron) { Remove-Item src\electron -Recurse }
- ps: Move-Item $env:APPVEYOR_BUILD_FOLDER -Destination src\electron
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: $env:SCCACHE_PATH="$pwd\src\electron\external_binaries\sccache.exe"
@@ -52,7 +53,7 @@ build_script:
--unmanaged
%GCLIENT_EXTRA_ARGS%
"https://github.com/electron/electron"
- gclient sync --with_branch_heads --with_tags
- gclient sync --with_branch_heads --with_tags --reset
- cd src
- ps: $env:BUILD_CONFIG_PATH="//electron/build/args/%GN_CONFIG%.gn"
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") %GN_EXTRA_ARGS%"

View File

@@ -18,7 +18,7 @@
#include "atom/common/node_includes.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/task/task_scheduler/task_scheduler.h"
#include "base/task/thread_pool/thread_pool.h"
#include "base/threading/thread_task_runner_handle.h"
#include "gin/array_buffer.h"
#include "gin/public/isolate_holder.h"
@@ -48,7 +48,7 @@ int NodeMain(int argc, char* argv[]) {
gin::V8Initializer::LoadV8Natives();
// V8 requires a task scheduler apparently
base::TaskScheduler::CreateAndStartWithDefaultParams("Electron");
base::ThreadPool::CreateAndStartWithDefaultParams("Electron");
// Initialize gin::IsolateHolder.
JavascriptEnvironment gin_env(loop);
@@ -101,6 +101,7 @@ int NodeMain(int argc, char* argv[]) {
}
} while (more == true);
node_debugger.Stop();
exit_code = node::EmitExit(env);
node::RunAtExit(env);
gin_env.platform()->DrainTasks(env->isolate());
@@ -112,10 +113,10 @@ int NodeMain(int argc, char* argv[]) {
// According to "src/gin/shell/gin_main.cc":
//
// gin::IsolateHolder waits for tasks running in TaskScheduler in its
// destructor and thus must be destroyed before TaskScheduler starts skipping
// gin::IsolateHolder waits for tasks running in ThreadPool in its
// destructor and thus must be destroyed before ThreadPool starts skipping
// CONTINUE_ON_SHUTDOWN tasks.
base::TaskScheduler::GetInstance()->Shutdown();
base::ThreadPool::GetInstance()->Shutdown();
v8::V8::Dispose();

View File

@@ -529,9 +529,9 @@ int ImportIntoCertStore(CertificateManagerModel* model,
}
#endif
void OnIconDataAvailable(util::Promise promise, gfx::Image* icon) {
if (icon && !icon->IsEmpty()) {
promise.Resolve(*icon);
void OnIconDataAvailable(util::Promise promise, gfx::Image icon) {
if (!icon.IsEmpty()) {
promise.Resolve(icon);
} else {
promise.RejectWithErrorMessage("Failed to get file icon.");
}
@@ -672,7 +672,7 @@ void App::OnLogin(scoped_refptr<LoginHandler> login_handler,
if (web_contents) {
prevent_default = Emit(
"login", WebContents::FromOrCreate(isolate(), web_contents),
request_details, login_handler->auth_info(),
request_details, *login_handler->auth_info(),
base::Bind(&PassLoginInformation, base::RetainedRef(login_handler)));
}
@@ -1056,7 +1056,7 @@ Browser::LoginItemSettings App::GetLoginItemSettings(mate::Arguments* args) {
#if defined(USE_NSS_CERTS)
void App::ImportCertificate(const base::DictionaryValue& options,
const net::CompletionCallback& callback) {
net::CompletionRepeatingCallback callback) {
auto browser_context = AtomBrowserContext::From("", false);
if (!certificate_manager_model_) {
auto copy = base::DictionaryValue::From(
@@ -1069,17 +1069,17 @@ void App::ImportCertificate(const base::DictionaryValue& options,
}
int rv = ImportIntoCertStore(certificate_manager_model_.get(), options);
callback.Run(rv);
std::move(callback).Run(rv);
}
void App::OnCertificateManagerModelCreated(
std::unique_ptr<base::DictionaryValue> options,
const net::CompletionCallback& callback,
net::CompletionOnceCallback callback,
std::unique_ptr<CertificateManagerModel> model) {
certificate_manager_model_ = std::move(model);
int rv =
ImportIntoCertStore(certificate_manager_model_.get(), *(options.get()));
callback.Run(rv);
std::move(callback).Run(rv);
}
#endif

View File

@@ -27,7 +27,8 @@
#include "content/public/browser/render_process_host.h"
#include "native_mate/dictionary.h"
#include "native_mate/handle.h"
#include "net/base/completion_callback.h"
#include "net/base/completion_once_callback.h"
#include "net/base/completion_repeating_callback.h"
#include "net/ssl/client_cert_identity.h"
#if defined(USE_NSS_CERTS)
@@ -78,7 +79,7 @@ class App : public AtomBrowserClient::Delegate,
#if defined(USE_NSS_CERTS)
void OnCertificateManagerModelCreated(
std::unique_ptr<base::DictionaryValue> options,
const net::CompletionCallback& callback,
net::CompletionOnceCallback callback,
std::unique_ptr<CertificateManagerModel> model);
#endif
@@ -199,7 +200,7 @@ class App : public AtomBrowserClient::Delegate,
Browser::LoginItemSettings GetLoginItemSettings(mate::Arguments* args);
#if defined(USE_NSS_CERTS)
void ImportCertificate(const base::DictionaryValue& options,
const net::CompletionCallback& callback);
net::CompletionRepeatingCallback callback);
#endif
v8::Local<v8::Promise> GetFileIcon(const base::FilePath& path,
mate::Arguments* args);

View File

@@ -64,11 +64,17 @@ void AutoUpdater::OnError(const std::string& message,
auto errorObject =
error->ToObject(isolate()->GetCurrentContext()).ToLocalChecked();
auto context = isolate()->GetCurrentContext();
// add two new params for better error handling
errorObject->Set(mate::StringToV8(isolate(), "code"),
v8::Integer::New(isolate(), code));
errorObject->Set(mate::StringToV8(isolate(), "domain"),
mate::StringToV8(isolate(), domain));
errorObject
->Set(context, mate::StringToV8(isolate(), "code"),
v8::Integer::New(isolate(), code))
.Check();
errorObject
->Set(context, mate::StringToV8(isolate(), "domain"),
mate::StringToV8(isolate(), domain))
.Check();
mate::EmitEvent(isolate(), GetWrapper(), "error", errorObject, message);
}

View File

@@ -283,7 +283,7 @@ void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
net::CanonicalCookie::CreateSanitizedCookie(
url, name, value, domain, path, creation_time, expiration_time,
last_access_time, secure, http_only,
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT));
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT));
auto completion_callback = base::BindOnce(OnSetCookie, std::move(promise));
if (!canonical_cookie || !canonical_cookie->IsCanonical()) {
std::move(completion_callback)

View File

@@ -165,8 +165,12 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
std::vector<std::string> device_names;
// Crucially, this list of device names will be in the same order as
// |media_list_sources|.
webrtc::DxgiDuplicatorController::Instance()->GetDeviceNames(
&device_names);
if (!webrtc::DxgiDuplicatorController::Instance()->GetDeviceNames(
&device_names)) {
Emit("error", "Failed to get sources.");
return;
}
int device_name_index = 0;
for (auto& source : screen_sources) {
const auto& device_name = device_names[device_name_index++];
@@ -176,13 +180,13 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
const int64_t device_id =
display::win::DisplayInfo::DeviceIdFromDeviceName(
wide_device_name.c_str());
source.display_id = base::Int64ToString(device_id);
source.display_id = base::NumberToString(device_id);
}
}
#elif defined(OS_MACOSX)
// On Mac, the IDs across the APIs match.
for (auto& source : screen_sources) {
source.display_id = base::Int64ToString(source.media_list_source.id.id);
source.display_id = base::NumberToString(source.media_list_source.id.id);
}
#endif // defined(OS_WIN)
// TODO(ajmacd): Add Linux support. The IDs across APIs differ but Chrome
@@ -222,7 +226,7 @@ void Initialize(v8::Local<v8::Object> exports,
void* priv) {
v8::Isolate* isolate = context->GetIsolate();
mate::Dictionary dict(isolate, exports);
dict.Set("desktopCapturer", atom::api::DesktopCapturer::Create(isolate));
dict.SetMethod("createDesktopCapturer", &atom::api::DesktopCapturer::Create);
}
} // namespace

View File

@@ -52,7 +52,7 @@ void MenuViews::PopupAt(TopLevelWindow* window,
std::make_unique<MenuRunner>(model(), flags, close_callback);
menu_runners_[window_id]->RunMenuAt(
native_window->widget(), NULL, gfx::Rect(location, gfx::Size()),
views::MENU_ANCHOR_TOPLEFT, ui::MENU_SOURCE_MOUSE);
views::MenuAnchorPosition::kTopLeft, ui::MENU_SOURCE_MOUSE);
}
void MenuViews::ClosePopupAt(int32_t window_id) {

View File

@@ -48,6 +48,7 @@
#include "content/public/browser/storage_partition.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "net/base/completion_repeating_callback.h"
#include "net/base/load_flags.h"
#include "net/disk_cache/disk_cache.h"
#include "net/dns/host_cache.h" // nogncheck
@@ -268,7 +269,7 @@ void DoCacheActionInIO(
// Call GetBackend and make the backend's ptr accessable in OnGetBackend.
using BackendPtr = disk_cache::Backend*;
auto** backend_ptr = new BackendPtr(nullptr);
net::CompletionCallback on_get_backend =
net::CompletionRepeatingCallback on_get_backend =
base::Bind(&OnGetBackend, base::Owned(backend_ptr), action,
util::CopyablePromise(promise));
int rv = http_cache->GetBackend(backend_ptr, on_get_backend);
@@ -365,8 +366,9 @@ void DestroyGlobalHandle(v8::Isolate* isolate,
v8::HandleScope handle_scope(isolate);
if (!global_handle.IsEmpty()) {
v8::Local<v8::Value> local_handle = global_handle.Get(isolate);
if (local_handle->IsObject()) {
v8::Local<v8::Object> object = local_handle->ToObject(isolate);
v8::Local<v8::Object> object;
if (local_handle->IsObject() &&
local_handle->ToObject(isolate->GetCurrentContext()).ToLocal(&object)) {
void* ptr = object->GetAlignedPointerFromInternalField(0);
if (!ptr)
return;

View File

@@ -15,7 +15,6 @@
#include "base/values.h"
#include "content/public/browser/download_manager.h"
#include "native_mate/handle.h"
#include "net/base/completion_callback.h"
class GURL;

View File

@@ -13,6 +13,7 @@
#include "atom/browser/mac/atom_application.h"
#include "atom/browser/mac/dict_util.h"
#include "atom/browser/ui/cocoa/NSColor+Hex.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "base/mac/scoped_cftyperef.h"
@@ -111,21 +112,6 @@ std::string ConvertAuthorizationStatus(AVAuthorizationStatusMac status) {
}
}
// Convert color to RGBA value like "aabbccdd"
std::string ToRGBA(NSColor* color) {
return base::StringPrintf(
"%02X%02X%02X%02X", (int)(color.redComponent * 0xFF),
(int)(color.greenComponent * 0xFF), (int)(color.blueComponent * 0xFF),
(int)(color.alphaComponent * 0xFF));
}
// Convert color to RGB hex value like "#ABCDEF"
std::string ToRGBHex(NSColor* color) {
return base::StringPrintf("#%02X%02X%02X", (int)(color.redComponent * 0xFF),
(int)(color.greenComponent * 0xFF),
(int)(color.blueComponent * 0xFF));
}
} // namespace
void SystemPreferences::PostNotification(const std::string& name,
@@ -405,7 +391,7 @@ std::string SystemPreferences::GetAccentColor() {
if (@available(macOS 10.14, *))
sysColor = [NSColor controlAccentColor];
return ToRGBA(sysColor);
return base::SysNSStringToUTF8([sysColor RGBAValue]);
}
std::string SystemPreferences::GetSystemColor(const std::string& color,
@@ -434,7 +420,7 @@ std::string SystemPreferences::GetSystemColor(const std::string& color,
return "";
}
return ToRGBHex(sysColor);
return base::SysNSStringToUTF8([sysColor hexadecimalValue]);
}
bool SystemPreferences::CanPromptTouchID() {
@@ -587,7 +573,7 @@ std::string SystemPreferences::GetColor(const std::string& color,
return "";
}
return ToRGBHex(sysColor);
return base::SysNSStringToUTF8([sysColor hexadecimalValue]);
}
std::string SystemPreferences::GetMediaAccessStatus(

View File

@@ -648,10 +648,11 @@ void TopLevelWindow::SetFocusable(bool focusable) {
}
void TopLevelWindow::SetMenu(v8::Isolate* isolate, v8::Local<v8::Value> value) {
auto context = isolate->GetCurrentContext();
mate::Handle<Menu> menu;
if (value->IsObject() &&
gin::V8ToString(
isolate, value->ToObject(isolate)->GetConstructorName()) == "Menu" &&
v8::Local<v8::Object> object;
if (value->IsObject() && value->ToObject(context).ToLocal(&object) &&
gin::V8ToString(isolate, object->GetConstructorName()) == "Menu" &&
mate::ConvertFromV8(isolate, value, &menu) && !menu.IsEmpty()) {
menu_.Reset(isolate, menu.ToV8());
window_->SetMenu(menu->model());

View File

@@ -59,11 +59,7 @@ Tray::Tray(v8::Isolate* isolate,
InitWith(isolate, wrapper);
}
Tray::~Tray() {
// Destroy the native tray in next tick.
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE,
tray_icon_.release());
}
Tray::~Tray() = default;
// static
mate::WrappableBase* Tray::New(mate::Handle<NativeImage> image,

View File

@@ -354,7 +354,7 @@ void URLRequest::OnReceivedRedirect(
}
void URLRequest::OnAuthenticationRequired(
scoped_refptr<const net::AuthChallengeInfo> auth_info) {
const net::AuthChallengeInfo& auth_info) {
if (request_state_.Canceled() || request_state_.Closed()) {
return;
}
@@ -364,7 +364,7 @@ void URLRequest::OnAuthenticationRequired(
return;
}
Emit("login", auth_info.get(),
Emit("login", auth_info,
base::Bind(&AtomURLRequest::PassLoginInformation, atom_request_));
}

View File

@@ -105,8 +105,7 @@ class URLRequest : public mate::EventEmitter<URLRequest> {
const std::string& method,
const GURL& url,
scoped_refptr<net::HttpResponseHeaders> response_headers);
void OnAuthenticationRequired(
scoped_refptr<const net::AuthChallengeInfo> auth_info);
void OnAuthenticationRequired(const net::AuthChallengeInfo& auth_info);
void OnResponseStarted(
scoped_refptr<net::HttpResponseHeaders> response_headers);
void OnResponseData(scoped_refptr<const net::IOBufferWithSize> data);

View File

@@ -86,6 +86,7 @@
#include "net/url_request/url_request_context.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
#include "third_party/blink/public/platform/web_cursor_info.h"
#include "third_party/blink/public/platform/web_input_event.h"
#include "ui/display/screen.h"
#include "ui/events/base_event_utils.h"
@@ -490,12 +491,14 @@ void WebContents::DestroyWebContents(bool async) {
ResetManagedWebContents(async);
}
bool WebContents::DidAddMessageToConsole(content::WebContents* source,
int32_t level,
const base::string16& message,
int32_t line_no,
const base::string16& source_id) {
return Emit("console-message", level, message, line_no, source_id);
bool WebContents::DidAddMessageToConsole(
content::WebContents* source,
blink::mojom::ConsoleMessageLevel level,
const base::string16& message,
int32_t line_no,
const base::string16& source_id) {
return Emit("console-message", static_cast<int32_t>(level), message, line_no,
source_id);
}
void WebContents::OnCreateWindow(
@@ -807,20 +810,20 @@ void WebContents::PluginCrashed(const base::FilePath& plugin_path,
}
void WebContents::MediaStartedPlaying(const MediaPlayerInfo& video_type,
const MediaPlayerId& id) {
const content::MediaPlayerId& id) {
Emit("media-started-playing");
}
void WebContents::MediaStoppedPlaying(
const MediaPlayerInfo& video_type,
const MediaPlayerId& id,
const content::MediaPlayerId& id,
content::WebContentsObserver::MediaStoppedReason reason) {
Emit("media-paused");
}
void WebContents::DidChangeThemeColor(SkColor theme_color) {
if (theme_color != SK_ColorTRANSPARENT) {
Emit("did-change-theme-color", atom::ToRGBHex(theme_color));
void WebContents::DidChangeThemeColor(base::Optional<SkColor> theme_color) {
if (theme_color) {
Emit("did-change-theme-color", atom::ToRGBHex(theme_color.value()));
} else {
Emit("did-change-theme-color", nullptr);
}
@@ -1192,7 +1195,7 @@ void WebContents::SetBackgroundThrottling(bool allowed) {
return;
}
const auto* render_view_host = contents->GetRenderViewHost();
auto* render_view_host = contents->GetRenderViewHost();
if (!render_view_host) {
return;
}
@@ -1915,10 +1918,9 @@ v8::Local<v8::Promise> WebContents::CapturePage(mate::Arguments* args) {
}
void WebContents::OnCursorChange(const content::WebCursor& cursor) {
content::CursorInfo info;
cursor.GetCursorInfo(&info);
const content::CursorInfo& info = cursor.info();
if (cursor.IsCustom()) {
if (info.type == blink::WebCursorInfo::kTypeCustom) {
Emit("cursor-changed", CursorTypeToString(info),
gfx::Image::CreateFrom1xBitmap(info.custom_image),
info.image_scale_factor,

View File

@@ -337,7 +337,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
// content::WebContentsDelegate:
bool DidAddMessageToConsole(content::WebContents* source,
int32_t level,
blink::mojom::ConsoleMessageLevel level,
const base::string16& message,
int32_t line_no,
const base::string16& source_id) override;
@@ -445,12 +445,12 @@ class WebContents : public mate::TrackableObject<WebContents>,
void PluginCrashed(const base::FilePath& plugin_path,
base::ProcessId plugin_pid) override;
void MediaStartedPlaying(const MediaPlayerInfo& video_type,
const MediaPlayerId& id) override;
const content::MediaPlayerId& id) override;
void MediaStoppedPlaying(
const MediaPlayerInfo& video_type,
const MediaPlayerId& id,
const content::MediaPlayerId& id,
content::WebContentsObserver::MediaStoppedReason reason) override;
void DidChangeThemeColor(SkColor theme_color) override;
void DidChangeThemeColor(base::Optional<SkColor> theme_color) override;
void OnInterfaceRequestFromFrame(
content::RenderFrameHost* render_frame_host,
const std::string& interface_name,

View File

@@ -52,7 +52,10 @@ void Event::FrameDeleted(content::RenderFrameHost* rfh) {
}
void Event::PreventDefault(v8::Isolate* isolate) {
GetWrapper()->Set(StringToV8(isolate, "defaultPrevented"), v8::True(isolate));
GetWrapper()
->Set(isolate->GetCurrentContext(),
StringToV8(isolate, "defaultPrevented"), v8::True(isolate))
.Check();
}
bool Event::SendReply(const base::ListValue& result) {

View File

@@ -104,8 +104,13 @@ class EventEmitter : public Wrappable<T> {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
EmitEvent(isolate(), GetWrapper(), name, event, args...);
return event->Get(StringToV8(isolate(), "defaultPrevented"))
->BooleanValue(isolate());
auto context = isolate()->GetCurrentContext();
v8::Local<v8::Value> defaultPrevented;
if (event->Get(context, StringToV8(isolate(), "defaultPrevented"))
.ToLocal(&defaultPrevented)) {
return defaultPrevented->BooleanValue(isolate());
}
return false;
}
DISALLOW_COPY_AND_ASSIGN(EventEmitter);

View File

@@ -534,7 +534,7 @@ std::string AtomBrowserClient::GetGeolocationApiKey() {
return api_key;
}
content::QuotaPermissionContext*
scoped_refptr<content::QuotaPermissionContext>
AtomBrowserClient::CreateQuotaPermissionContext() {
return new AtomQuotaPermissionContext;
}
@@ -867,7 +867,8 @@ NotificationPresenter* AtomBrowserClient::GetNotificationPresenter() {
}
content::PlatformNotificationService*
AtomBrowserClient::GetPlatformNotificationService() {
AtomBrowserClient::GetPlatformNotificationService(
content::BrowserContext* browser_context) {
if (!notification_service_) {
notification_service_.reset(new PlatformNotificationService(this));
}

View File

@@ -90,7 +90,8 @@ class AtomBrowserClient : public content::ContentBrowserClient,
base::CommandLine* command_line) override;
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
std::string GetGeolocationApiKey() override;
content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
scoped_refptr<content::QuotaPermissionContext> CreateQuotaPermissionContext()
override;
content::GeneratedCodeCacheSettings GetGeneratedCodeCacheSettings(
content::BrowserContext* context) override;
void AllowCertificateError(
@@ -144,8 +145,8 @@ class AtomBrowserClient : public content::ContentBrowserClient,
net::NetLog* GetNetLog() override;
content::MediaObserver* GetMediaObserver() override;
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
content::PlatformNotificationService* GetPlatformNotificationService()
override;
content::PlatformNotificationService* GetPlatformNotificationService(
content::BrowserContext* browser_context) override;
content::BrowserMainParts* CreateBrowserMainParts(
const content::MainFunctionParams&) override;
base::FilePath GetDefaultDownloadDirectory() override;

View File

@@ -76,7 +76,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/l10n_util_win.h"
#include "ui/display/win/dpi.h"
#include "ui/gfx/platform_font_win.h"
#include "ui/gfx/system_fonts_win.h"
#include "ui/strings/grit/app_locale_settings.h"
#endif
@@ -102,7 +102,7 @@ void Erase(T* container, typename T::iterator iter) {
#if defined(OS_WIN)
// gfx::Font callbacks
void AdjustUIFont(gfx::PlatformFontWin::FontAdjustment* font_adjustment) {
void AdjustUIFont(gfx::win::FontAdjustment* font_adjustment) {
l10n_util::NeedOverrideDefaultUIFont(&font_adjustment->font_family_override,
&font_adjustment->font_scale);
font_adjustment->font_scale *= display::win::GetAccessibilityFontScale();
@@ -380,8 +380,8 @@ void AtomBrowserMainParts::ToolkitInitialized() {
#endif
#if defined(OS_WIN)
gfx::PlatformFontWin::SetAdjustFontCallback(&AdjustUIFont);
gfx::PlatformFontWin::SetGetMinimumFontSizeCallback(&GetMinimumFontSize);
gfx::win::SetAdjustFontCallback(&AdjustUIFont);
gfx::win::SetGetMinimumFontSizeCallback(&GetMinimumFontSize);
wchar_t module_name[MAX_PATH] = {0};
if (GetModuleFileName(NULL, module_name, MAX_PATH))
@@ -469,6 +469,7 @@ void AtomBrowserMainParts::PostMainMessageLoopRun() {
ui::SetX11ErrorHandlers(X11EmptyErrorHandler, X11EmptyIOErrorHandler);
#endif
node_debugger_->Stop();
js_env_->OnMessageLoopDestroying();
#if defined(OS_MACOSX)

View File

@@ -41,8 +41,26 @@ void AtomBrowserMainParts::InitializeMainNib() {
auto application = [principalClass sharedApplication];
NSString* mainNibName = [infoDictionary objectForKey:@"NSMainNibFile"];
auto mainNib = [[NSNib alloc] initWithNibNamed:mainNibName
bundle:base::mac::FrameworkBundle()];
NSNib* mainNib;
@try {
mainNib = [[NSNib alloc] initWithNibNamed:mainNibName
bundle:base::mac::FrameworkBundle()];
// Handle failure of initWithNibNamed on SMB shares
// TODO(codebytere): Remove when
// https://bugs.chromium.org/p/chromium/issues/detail?id=932935 is fixed
} @catch (NSException* exception) {
NSString* nibPath =
[NSString stringWithFormat:@"Resources/%@.nib", mainNibName];
nibPath = [base::mac::FrameworkBundle().bundlePath
stringByAppendingPathComponent:nibPath];
NSData* data = [NSData dataWithContentsOfFile:nibPath];
mainNib = [[NSNib alloc] initWithNibData:data
bundle:base::mac::FrameworkBundle()];
}
[mainNib instantiateWithOwner:application topLevelObjects:nil];
[mainNib release];
}

View File

@@ -131,7 +131,7 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol,
void Browser::SetAppUserModelID(const base::string16& name) {}
bool Browser::SetBadgeCount(int count) {
DockSetBadgeText(count != 0 ? base::IntToString(count) : "");
DockSetBadgeText(count != 0 ? base::NumberToString(count) : "");
badge_count_ = count;
return true;
}

View File

@@ -338,3 +338,7 @@ printing::PrintJobManager* BrowserProcessImpl::print_job_manager() {
return nullptr;
#endif
}
StartupData* BrowserProcessImpl::startup_data() {
return nullptr;
}

View File

@@ -114,6 +114,7 @@ class BrowserProcessImpl : public BrowserProcess {
void SetApplicationLocale(const std::string& locale) override;
const std::string& GetApplicationLocale() override;
printing::PrintJobManager* print_job_manager() override;
StartupData* startup_data() override;
private:
#if BUILDFLAG(ENABLE_PRINTING)

View File

@@ -96,7 +96,7 @@ void Browser::Focus() {
}
void Browser::AddRecentDocument(const base::FilePath& path) {
if (base::win::GetVersion() < base::win::VERSION_WIN7)
if (base::win::GetVersion() < base::win::Version::WIN7)
return;
CComPtr<IShellItem> item;
@@ -346,7 +346,7 @@ std::string Browser::GetExecutableFileProductName() const {
bool Browser::IsEmojiPanelSupported() {
// emoji picker is supported on Windows 10's Spring 2018 update & above.
return base::win::GetVersion() >= base::win::Version::VERSION_WIN10_RS4;
return base::win::GetVersion() >= base::win::Version::WIN10_RS4;
}
void Browser::ShowEmojiPanel() {

View File

@@ -352,9 +352,8 @@ blink::WebSecurityStyle CommonWebContentsDelegate::GetSecurityStyle(
SecurityStateTabHelper* helper =
SecurityStateTabHelper::FromWebContents(web_contents);
DCHECK(helper);
security_state::SecurityInfo security_info;
helper->GetSecurityInfo(&security_info);
return security_state::GetSecurityStyle(security_info,
return security_state::GetSecurityStyle(helper->GetSecurityLevel(),
*helper->GetVisibleSecurityState(),
security_style_explanations);
}

View File

@@ -45,7 +45,7 @@ void IOThread::Init() {
auto cert_verifier = std::make_unique<net::CachingCertVerifier>(
std::make_unique<net::MultiThreadedCertVerifier>(
net::CertVerifyProc::CreateDefault()));
net::CertVerifyProc::CreateDefault(nullptr)));
builder->SetCertVerifier(std::move(cert_verifier));
// Create the network service, so that shared host resolver
@@ -70,5 +70,5 @@ void IOThread::CleanUp() {
system_request_context_->proxy_resolution_service()->OnShutdown();
if (net_log_)
net_log_->ShutDownBeforeTaskScheduler();
net_log_->ShutDownBeforeThreadPool();
}

View File

@@ -10,7 +10,7 @@
#include "atom/common/node_includes.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/task/task_scheduler/initialization_util.h"
#include "base/task/thread_pool/initialization_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/public/common/content_switches.h"
#include "gin/array_buffer.h"

View File

@@ -26,7 +26,7 @@ LoginHandler::LoginHandler(net::URLRequest* request,
net::AuthCredentials* credentials,
content::ResourceRequestInfo* resource_request_info)
: credentials_(credentials),
auth_info_(&auth_info),
auth_info_(std::make_unique<net::AuthChallengeInfo>(auth_info)),
auth_callback_(std::move(callback)),
weak_factory_(this) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);

View File

@@ -5,6 +5,8 @@
#ifndef ATOM_BROWSER_LOGIN_HANDLER_H_
#define ATOM_BROWSER_LOGIN_HANDLER_H_
#include <memory>
#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
@@ -57,7 +59,7 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler> {
net::AuthCredentials* credentials_;
// Who/where/what asked for the authentication.
scoped_refptr<const net::AuthChallengeInfo> auth_info_;
std::unique_ptr<const net::AuthChallengeInfo> auth_info_;
// WebContents associated with the login request.
content::ResourceRequestInfo::WebContentsGetter web_contents_getter_;

View File

@@ -380,6 +380,9 @@ void NativeWindowViews::Show() {
widget()->native_widget_private()->Show(GetRestoredState(), gfx::Rect());
// explicitly focus the window
widget()->Activate();
NotifyWindowShow();
#if defined(USE_X11)

View File

@@ -152,7 +152,7 @@ class CertVerifierRequest : public AtomCertVerifier::Request {
};
AtomCertVerifier::AtomCertVerifier(RequireCTDelegate* ct_delegate)
: default_cert_verifier_(net::CertVerifier::CreateDefault()),
: default_cert_verifier_(net::CertVerifier::CreateDefault(nullptr)),
ct_delegate_(ct_delegate) {}
AtomCertVerifier::~AtomCertVerifier() {}

View File

@@ -29,19 +29,19 @@ namespace atom {
const char* ResourceTypeToString(content::ResourceType type) {
switch (type) {
case content::RESOURCE_TYPE_MAIN_FRAME:
case content::ResourceType::kMainFrame:
return "mainFrame";
case content::RESOURCE_TYPE_SUB_FRAME:
case content::ResourceType::kSubFrame:
return "subFrame";
case content::RESOURCE_TYPE_STYLESHEET:
case content::ResourceType::kStylesheet:
return "stylesheet";
case content::RESOURCE_TYPE_SCRIPT:
case content::ResourceType::kScript:
return "script";
case content::RESOURCE_TYPE_IMAGE:
case content::ResourceType::kImage:
return "image";
case content::RESOURCE_TYPE_OBJECT:
case content::ResourceType::kObject:
return "object";
case content::RESOURCE_TYPE_XHR:
case content::ResourceType::kXhr:
return "xhr";
default:
return "other";

View File

@@ -347,13 +347,13 @@ void AtomURLRequest::OnReceivedRedirect(net::URLRequest* request,
}
void AtomURLRequest::OnAuthRequired(net::URLRequest* request,
net::AuthChallengeInfo* auth_info) {
const net::AuthChallengeInfo& auth_info) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
base::PostTaskWithTraits(
FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(&AtomURLRequest::InformDelegateAuthenticationRequired,
this, scoped_refptr<net::AuthChallengeInfo>(auth_info)));
this, auth_info));
}
void AtomURLRequest::OnResponseStarted(net::URLRequest* request,
@@ -468,7 +468,7 @@ void AtomURLRequest::InformDelegateReceivedRedirect(
}
void AtomURLRequest::InformDelegateAuthenticationRequired(
scoped_refptr<net::AuthChallengeInfo> auth_info) const {
const net::AuthChallengeInfo& auth_info) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (delegate_)
delegate_->OnAuthenticationRequired(auth_info);

View File

@@ -53,7 +53,7 @@ class AtomURLRequest : public base::RefCountedThreadSafe<AtomURLRequest>,
const net::RedirectInfo& info,
bool* defer_redirect) override;
void OnAuthRequired(net::URLRequest* request,
net::AuthChallengeInfo* auth_info) override;
const net::AuthChallengeInfo& auth_info) override;
void OnResponseStarted(net::URLRequest* request, int net_error) override;
void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
@@ -93,7 +93,7 @@ class AtomURLRequest : public base::RefCountedThreadSafe<AtomURLRequest>,
const GURL& url,
scoped_refptr<net::HttpResponseHeaders> response_headers) const;
void InformDelegateAuthenticationRequired(
scoped_refptr<net::AuthChallengeInfo> auth_info) const;
const net::AuthChallengeInfo& auth_info) const;
void InformDelegateResponseStarted(
scoped_refptr<net::HttpResponseHeaders>) const;
void InformDelegateResponseData(

View File

@@ -50,6 +50,8 @@ network::mojom::HttpAuthDynamicParamsPtr CreateHttpAuthDynamicParams() {
command_line->GetSwitchValueASCII(atom::switches::kAuthServerWhitelist);
auth_dynamic_params->delegate_whitelist = command_line->GetSwitchValueASCII(
atom::switches::kAuthNegotiateDelegateWhitelist);
auth_dynamic_params->enable_negotiate_port =
command_line->HasSwitch(atom::switches::kEnableAuthNegotiatePort);
return auth_dynamic_params;
}

View File

@@ -122,7 +122,7 @@ void URLRequestBufferJob::Kill() {
void URLRequestBufferJob::GetResponseInfo(net::HttpResponseInfo* info) {
std::string status("HTTP/1.1 ");
status.append(base::IntToString(status_code_));
status.append(base::NumberToString(status_code_));
status.append(" ");
status.append(net::GetHttpReasonPhrase(status_code_));
status.append("\0\0", 2);

View File

@@ -296,7 +296,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
const auto& custom_standard_schemes = atom::api::GetStandardSchemes();
cookie_schemes.insert(cookie_schemes.end(), custom_standard_schemes.begin(),
custom_standard_schemes.end());
cookie_monster->SetCookieableSchemes(cookie_schemes);
cookie_monster->SetCookieableSchemes(cookie_schemes, base::NullCallback());
// Setup handlers for custom job factory.
top_job_factory_.reset(new AtomURLRequestJobFactory);

View File

@@ -48,7 +48,7 @@ void BeforeStartInUI(base::WeakPtr<URLRequestStreamJob> job,
status_code = 200;
}
std::string status("HTTP/1.1 ");
status.append(base::IntToString(status_code));
status.append(base::NumberToString(status_code));
status.append(" ");
status.append(
net::GetHttpReasonPhrase(static_cast<net::HttpStatusCode>(status_code)));

View File

@@ -37,13 +37,13 @@ void NodeDebugger::Start() {
}
node::DebugOptions options;
node::options_parser::DebugOptionsParser options_parser;
std::vector<std::string> exec_args;
std::vector<std::string> v8_args;
std::vector<std::string> errors;
node::options_parser::DebugOptionsParser::instance.Parse(
&args, &exec_args, &v8_args, &options,
node::options_parser::kDisallowedInEnvironment, &errors);
options_parser.Parse(&args, &exec_args, &v8_args, &options,
node::options_parser::kDisallowedInEnvironment, &errors);
if (!errors.empty()) {
// TODO(jeremy): what's the appropriate behaviour here?
@@ -51,13 +51,6 @@ void NodeDebugger::Start() {
<< base::JoinString(errors, " ");
}
// Set process._debugWaitConnect if --inspect-brk was specified to stop
// the debugger on the first line
if (options.wait_for_connect()) {
mate::Dictionary process(env_->isolate(), env_->process_object());
process.Set("_breakFirstLine", true);
}
const char* path = "";
if (inspector->Start(path, options,
std::make_shared<node::HostPort>(options.host_port),
@@ -65,4 +58,10 @@ void NodeDebugger::Start() {
DCHECK(env_->inspector_agent()->IsListening());
}
void NodeDebugger::Stop() {
auto* inspector = env_->inspector_agent();
if (inspector && inspector->IsListening())
inspector->Stop();
}
} // namespace atom

View File

@@ -20,6 +20,7 @@ class NodeDebugger {
~NodeDebugger();
void Start();
void Stop();
private:
node::Environment* env_;

View File

@@ -79,7 +79,6 @@ PlatformNotificationService::~PlatformNotificationService() {}
void PlatformNotificationService::DisplayNotification(
content::RenderProcessHost* render_process_host,
content::BrowserContext* browser_context,
const std::string& notification_id,
const GURL& origin,
const blink::PlatformNotificationData& notification_data,
@@ -100,7 +99,6 @@ void PlatformNotificationService::DisplayNotification(
}
void PlatformNotificationService::DisplayPersistentNotification(
content::BrowserContext* browser_context,
const std::string& notification_id,
const GURL& service_worker_scope,
const GURL& origin,
@@ -108,11 +106,9 @@ void PlatformNotificationService::DisplayPersistentNotification(
const blink::NotificationResources& notification_resources) {}
void PlatformNotificationService::ClosePersistentNotification(
content::BrowserContext* browser_context,
const std::string& notification_id) {}
void PlatformNotificationService::CloseNotification(
content::BrowserContext* browser_context,
const std::string& notification_id) {
auto* presenter = browser_client_->GetNotificationPresenter();
if (!presenter)
@@ -121,25 +117,19 @@ void PlatformNotificationService::CloseNotification(
}
void PlatformNotificationService::GetDisplayedNotifications(
content::BrowserContext* browser_context,
DisplayedNotificationsCallback callback) {}
int64_t PlatformNotificationService::ReadNextPersistentNotificationId(
content::BrowserContext* browser_context) {
int64_t PlatformNotificationService::ReadNextPersistentNotificationId() {
// Electron doesn't support persistent notifications.
return 0;
}
void PlatformNotificationService::RecordNotificationUkmEvent(
content::BrowserContext* browser_context,
const content::NotificationDatabaseData& data) {}
void PlatformNotificationService::ScheduleTrigger(
content::BrowserContext* browser_context,
base::Time timestamp) {}
void PlatformNotificationService::ScheduleTrigger(base::Time timestamp) {}
base::Time PlatformNotificationService::ReadNextTriggerTimestamp(
content::BrowserContext* browser_context) {
base::Time PlatformNotificationService::ReadNextTriggerTimestamp() {
return base::Time::Max();
}

View File

@@ -8,7 +8,6 @@
#include <set>
#include <string>
#include "content/public/browser/browser_context.h"
#include "content/public/browser/platform_notification_service.h"
namespace atom {
@@ -25,34 +24,25 @@ class PlatformNotificationService
// content::PlatformNotificationService:
void DisplayNotification(
content::RenderProcessHost* render_process_host,
content::BrowserContext* browser_context,
const std::string& notification_id,
const GURL& origin,
const blink::PlatformNotificationData& notification_data,
const blink::NotificationResources& notification_resources) override;
void DisplayPersistentNotification(
content::BrowserContext* browser_context,
const std::string& notification_id,
const GURL& service_worker_scope,
const GURL& origin,
const blink::PlatformNotificationData& notification_data,
const blink::NotificationResources& notification_resources) override;
void ClosePersistentNotification(content::BrowserContext* browser_context,
const std::string& notification_id) override;
void CloseNotification(content::BrowserContext* browser_context,
const std::string& notification_id) override;
void ClosePersistentNotification(const std::string& notification_id) override;
void CloseNotification(const std::string& notification_id) override;
void GetDisplayedNotifications(
content::BrowserContext* browser_context,
DisplayedNotificationsCallback callback) override;
int64_t ReadNextPersistentNotificationId(
content::BrowserContext* browser_context) override;
int64_t ReadNextPersistentNotificationId() override;
void RecordNotificationUkmEvent(
content::BrowserContext* browser_context,
const content::NotificationDatabaseData& data) override;
void ScheduleTrigger(content::BrowserContext* browser_context,
base::Time timestamp) override;
base::Time ReadNextTriggerTimestamp(
content::BrowserContext* browser_context) override;
void ScheduleTrigger(base::Time timestamp) override;
base::Time ReadNextTriggerTimestamp() override;
private:
AtomBrowserClient* browser_client_;

View File

@@ -14,7 +14,7 @@
#include "atom/browser/notifications/win/windows_toast_notification.h"
#include "base/environment.h"
#include "base/files/file_util.h"
#include "base/md5.h"
#include "base/hash/md5.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
@@ -47,7 +47,7 @@ bool SaveIconToPath(const SkBitmap& bitmap, const base::FilePath& path) {
// static
NotificationPresenter* NotificationPresenter::Create() {
auto version = base::win::GetVersion();
if (version < base::win::VERSION_WIN8)
if (version < base::win::Version::WIN8)
return new NotificationPresenterWin7;
if (!WindowsToastNotification::Initialize())
return nullptr;

View File

@@ -6,6 +6,7 @@
#include <utility>
#include "base/memory/shared_memory.h"
#include "components/viz/common/resources/resource_format.h"
#include "components/viz/common/resources/resource_sizes.h"
#include "mojo/public/cpp/system/platform_handle.h"

View File

@@ -8,7 +8,7 @@
#include <memory>
#include "base/callback.h"
#include "base/memory/shared_memory.h"
#include "base/memory/shared_memory_mapping.h"
#include "components/viz/host/host_display_client.h"
#include "services/viz/privileged/interfaces/compositing/layered_window_updater.mojom.h"
#include "third_party/skia/include/core/SkBitmap.h"

View File

@@ -351,7 +351,7 @@ void OffScreenRenderWidgetHostView::SetBounds(const gfx::Rect& new_bounds) {
SetSize(new_bounds.size());
}
gfx::NativeView OffScreenRenderWidgetHostView::GetNativeView() const {
gfx::NativeView OffScreenRenderWidgetHostView::GetNativeView() {
return gfx::NativeView();
}
@@ -366,11 +366,11 @@ ui::TextInputClient* OffScreenRenderWidgetHostView::GetTextInputClient() {
void OffScreenRenderWidgetHostView::Focus() {}
bool OffScreenRenderWidgetHostView::HasFocus() const {
bool OffScreenRenderWidgetHostView::HasFocus() {
return false;
}
bool OffScreenRenderWidgetHostView::IsSurfaceAvailableForCopy() const {
bool OffScreenRenderWidgetHostView::IsSurfaceAvailableForCopy() {
return GetDelegatedFrameHost()->CanCopyFromCompositingSurface();
}
@@ -411,7 +411,7 @@ void OffScreenRenderWidgetHostView::EnsureSurfaceSynchronizedForWebTest() {
SynchronizeVisualProperties();
}
gfx::Rect OffScreenRenderWidgetHostView::GetViewBounds() const {
gfx::Rect OffScreenRenderWidgetHostView::GetViewBounds() {
if (IsPopupWidget())
return popup_position_;
@@ -429,8 +429,7 @@ void OffScreenRenderWidgetHostView::SetBackgroundColor(SkColor color) {
}
}
base::Optional<SkColor> OffScreenRenderWidgetHostView::GetBackgroundColor()
const {
base::Optional<SkColor> OffScreenRenderWidgetHostView::GetBackgroundColor() {
return background_color_;
}
@@ -438,7 +437,7 @@ void OffScreenRenderWidgetHostView::UpdateBackgroundColor() {
NOTREACHED();
}
gfx::Size OffScreenRenderWidgetHostView::GetVisibleViewportSize() const {
gfx::Size OffScreenRenderWidgetHostView::GetVisibleViewportSize() {
return size_;
}
@@ -532,8 +531,7 @@ void OffScreenRenderWidgetHostView::TextInputStateChanged(
void OffScreenRenderWidgetHostView::ImeCancelComposition() {}
void OffScreenRenderWidgetHostView::RenderProcessGone(base::TerminationStatus,
int) {
void OffScreenRenderWidgetHostView::RenderProcessGone() {
Destroy();
}
@@ -580,7 +578,7 @@ void OffScreenRenderWidgetHostView::CopyFromSurface(
}
void OffScreenRenderWidgetHostView::GetScreenInfo(
content::ScreenInfo* screen_info) const {
content::ScreenInfo* screen_info) {
screen_info->depth = 24;
screen_info->depth_per_component = 8;
screen_info->orientation_angle = 0;
@@ -621,8 +619,7 @@ void OffScreenRenderWidgetHostView::ImeCompositionRangeChanged(
const gfx::Range&,
const std::vector<gfx::Rect>&) {}
gfx::Size OffScreenRenderWidgetHostView::GetCompositorViewportPixelSize()
const {
gfx::Size OffScreenRenderWidgetHostView::GetCompositorViewportPixelSize() {
return gfx::ScaleToCeiledSize(GetRequestedRendererSize(),
current_device_scale_factor_);
}

View File

@@ -84,22 +84,22 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
void InitAsChild(gfx::NativeView) override;
void SetSize(const gfx::Size&) override;
void SetBounds(const gfx::Rect&) override;
gfx::NativeView GetNativeView(void) const override;
gfx::NativeView GetNativeView(void) override;
gfx::NativeViewAccessible GetNativeViewAccessible(void) override;
ui::TextInputClient* GetTextInputClient() override;
void Focus(void) override;
bool HasFocus(void) const override;
bool HasFocus(void) override;
uint32_t GetCaptureSequenceNumber() const override;
bool IsSurfaceAvailableForCopy(void) const override;
bool IsSurfaceAvailableForCopy(void) override;
void Show(void) override;
void Hide(void) override;
bool IsShowing(void) override;
void EnsureSurfaceSynchronizedForWebTest() override;
gfx::Rect GetViewBounds(void) const override;
gfx::Size GetVisibleViewportSize() const override;
gfx::Rect GetViewBounds(void) override;
gfx::Size GetVisibleViewportSize() override;
void SetInsets(const gfx::Insets&) override;
void SetBackgroundColor(SkColor color) override;
base::Optional<SkColor> GetBackgroundColor() const override;
base::Optional<SkColor> GetBackgroundColor() override;
void UpdateBackgroundColor() override;
bool LockMouse(void) override;
void UnlockMouse(void) override;
@@ -131,7 +131,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
void SetIsLoading(bool is_loading) override;
void TextInputStateChanged(const content::TextInputState& params) override;
void ImeCancelComposition(void) override;
void RenderProcessGone(base::TerminationStatus, int) override;
void RenderProcessGone() override;
void Destroy(void) override;
void SetTooltipText(const base::string16&) override;
content::CursorManager* GetCursorManager() override;
@@ -139,7 +139,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
const gfx::Rect& src_rect,
const gfx::Size& output_size,
base::OnceCallback<void(const SkBitmap&)> callback) override;
void GetScreenInfo(content::ScreenInfo* results) const override;
void GetScreenInfo(content::ScreenInfo* results) override;
void InitAsGuest(content::RenderWidgetHostView*,
content::RenderWidgetHostViewGuest*) override;
void TransformPointToRootSurface(gfx::PointF* point) override;
@@ -149,7 +149,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
CreateSyntheticGestureTarget() override;
void ImeCompositionRangeChanged(const gfx::Range&,
const std::vector<gfx::Rect>&) override;
gfx::Size GetCompositorViewportPixelSize() const override;
gfx::Size GetCompositorViewportPixelSize() override;
content::RenderWidgetHostViewBase* CreateViewForWidget(
content::RenderWidgetHost*,

View File

@@ -17,9 +17,9 @@
<key>CFBundleIconFile</key>
<string>electron.icns</string>
<key>CFBundleVersion</key>
<string>6.0.0-nightly.20190404</string>
<string>6.0.0-beta.3</string>
<key>CFBundleShortVersionString</key>
<string>6.0.0-nightly.20190404</string>
<string>6.0.0-beta.3</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>

View File

@@ -50,8 +50,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 6,0,0,20190404
PRODUCTVERSION 6,0,0,20190404
FILEVERSION 6,0,0,3
PRODUCTVERSION 6,0,0,3
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L

View File

@@ -10,6 +10,8 @@
#import <Cocoa/Cocoa.h>
@interface NSColor (Hex)
- (NSString*)hexadecimalValue;
- (NSString*)RGBAValue;
+ (NSColor*)colorWithHexColorString:(NSString*)hex;
@end

View File

@@ -8,17 +8,65 @@
@implementation NSColor (Hex)
- (NSString*)RGBAValue {
double redFloatValue, greenFloatValue, blueFloatValue, alphaFloatValue;
NSColor* convertedColor =
[self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
if (convertedColor) {
[convertedColor getRed:&redFloatValue
green:&greenFloatValue
blue:&blueFloatValue
alpha:&alphaFloatValue];
int redIntValue = redFloatValue * 255.99999f;
int greenIntValue = greenFloatValue * 255.99999f;
int blueIntValue = blueFloatValue * 255.99999f;
int alphaIntValue = alphaFloatValue * 255.99999f;
return
[NSString stringWithFormat:@"%02x%02x%02x%02x", redIntValue,
greenIntValue, blueIntValue, alphaIntValue];
}
return nil;
}
- (NSString*)hexadecimalValue {
double redFloatValue, greenFloatValue, blueFloatValue;
NSColor* convertedColor =
[self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
if (convertedColor) {
[convertedColor getRed:&redFloatValue
green:&greenFloatValue
blue:&blueFloatValue
alpha:NULL];
int redIntValue = redFloatValue * 255.99999f;
int greenIntValue = greenFloatValue * 255.99999f;
int blueIntValue = blueFloatValue * 255.99999f;
return [NSString stringWithFormat:@"#%02x%02x%02x", redIntValue,
greenIntValue, blueIntValue];
}
return nil;
}
+ (NSColor*)colorWithHexColorString:(NSString*)inColorString {
unsigned colorCode = 0;
unsigned char redByte, greenByte, blueByte;
if (inColorString) {
NSScanner* scanner = [NSScanner scannerWithString:inColorString];
(void)[scanner scanHexInt:&colorCode]; // ignore error
}
redByte = (unsigned char)(colorCode >> 16);
greenByte = (unsigned char)(colorCode >> 8);
blueByte = (unsigned char)(colorCode); // masks off high bits
unsigned char redByte = (unsigned char)(colorCode >> 16);
unsigned char greenByte = (unsigned char)(colorCode >> 8);
unsigned char blueByte = (unsigned char)(colorCode); // masks off high bits
return [NSColor colorWithCalibratedRed:(CGFloat)redByte / 0xff
green:(CGFloat)greenByte / 0xff

View File

@@ -41,6 +41,7 @@
#include "net/http/http_response_headers.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/cpp/simple_url_loader_stream_consumer.h"
#include "third_party/blink/public/common/logging/logging_utils.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
@@ -779,11 +780,13 @@ void InspectableWebContentsImpl::WebContentsDestroyed() {
bool InspectableWebContentsImpl::DidAddMessageToConsole(
content::WebContents* source,
int32_t level,
blink::mojom::ConsoleMessageLevel level,
const base::string16& message,
int32_t line_no,
const base::string16& source_id) {
logging::LogMessage("CONSOLE", line_no, level).stream()
logging::LogMessage("CONSOLE", line_no,
blink::ConsoleMessageLevelToLogSeverity(level))
.stream()
<< "\"" << message << "\", source: " << source_id << " (" << line_no
<< ")";
return true;

View File

@@ -143,6 +143,9 @@ class InspectableWebContentsImpl
int boundary_value) override {}
void ReadyForTest() override {}
void SetOpenNewWindowForPopups(bool value) override {}
void RecordPerformanceHistogram(const std::string& name,
double duration) override {}
void RecordUserMetricsAction(const std::string& name) override {}
// content::DevToolsFrontendHostDelegate:
void HandleMessageFromDevToolsFrontend(const std::string& message);
@@ -165,7 +168,7 @@ class InspectableWebContentsImpl
// content::WebContentsDelegate:
bool DidAddMessageToConsole(content::WebContents* source,
int32_t level,
blink::mojom::ConsoleMessageLevel level,
const base::string16& message,
int32_t line_no,
const base::string16& source_id) override;

View File

@@ -150,10 +150,10 @@ void AutofillPopupView::OnSelectedRowChanged(
if (current_row_selection) {
int selected = current_row_selection.value_or(-1);
if (selected == -1 || selected >= child_count())
if (selected == -1 || static_cast<size_t>(selected) >= children().size())
return;
child_at(selected)->NotifyAccessibilityEvent(ax::mojom::Event::kSelection,
true);
children().at(selected)->NotifyAccessibilityEvent(
ax::mojom::Event::kSelection, true);
}
}
@@ -232,7 +232,8 @@ void AutofillPopupView::DoUpdateBoundsAndRedrawPopup() {
}
void AutofillPopupView::OnPaint(gfx::Canvas* canvas) {
if (!popup_ || popup_->GetLineCount() != child_count())
if (!popup_ ||
static_cast<size_t>(popup_->GetLineCount()) != children().size())
return;
gfx::Canvas* draw_canvas = canvas;
SkBitmap bitmap;

View File

@@ -255,7 +255,7 @@ const char* MenuBar::GetClassName() const {
return kViewClassName;
}
void MenuBar::OnMenuButtonClicked(views::MenuButton* source,
void MenuBar::OnMenuButtonClicked(views::Button* source,
const gfx::Point& point,
const ui::Event* event) {
// Hide the accelerator when a submenu is activated.

View File

@@ -16,8 +16,9 @@
#include "ui/views/view.h"
namespace views {
class Button;
class MenuButton;
}
} // namespace views
namespace atom {
@@ -78,7 +79,7 @@ class MenuBar : public views::AccessiblePaneView,
const char* GetClassName() const override;
// views::MenuButtonListener:
void OnMenuButtonClicked(views::MenuButton* source,
void OnMenuButtonClicked(views::Button* source,
const gfx::Point& point,
const ui::Event* event) override;
void OnNativeThemeChanged(const ui::NativeTheme* theme) override;

View File

@@ -22,7 +22,7 @@ MenuDelegate::MenuDelegate(MenuBar* menu_bar)
MenuDelegate::~MenuDelegate() {}
void MenuDelegate::RunMenu(AtomMenuModel* model,
views::MenuButton* button,
views::Button* button,
ui::MenuSourceType source_type) {
gfx::Point screen_loc;
views::View::ConvertPointToScreen(button, &screen_loc);
@@ -43,8 +43,10 @@ void MenuDelegate::RunMenu(AtomMenuModel* model,
menu_runner_.reset(new views::MenuRunner(
item,
views::MenuRunner::CONTEXT_MENU | views::MenuRunner::HAS_MNEMONICS));
menu_runner_->RunMenuAt(button->GetWidget()->GetTopLevelWidget(), button,
bounds, views::MENU_ANCHOR_TOPRIGHT, source_type);
menu_runner_->RunMenuAt(
button->GetWidget()->GetTopLevelWidget(),
static_cast<views::MenuButton*>(button)->button_controller(), bounds,
views::MenuAnchorPosition::kTopRight, source_type);
}
void MenuDelegate::ExecuteCommand(int id) {

View File

@@ -13,7 +13,8 @@
namespace views {
class MenuRunner;
}
class Button;
} // namespace views
namespace atom {
@@ -25,7 +26,7 @@ class MenuDelegate : public views::MenuDelegate {
~MenuDelegate() override;
void RunMenu(AtomMenuModel* model,
views::MenuButton* button,
views::Button* button,
ui::MenuSourceType source_type);
class Observer {

View File

@@ -92,10 +92,10 @@ void RootView::SetMenuBarVisibility(bool visible) {
menu_bar_visible_ = visible;
if (visible) {
DCHECK_EQ(child_count(), 1);
DCHECK_EQ(children().size(), 1ul);
AddChildView(menu_bar_.get());
} else {
DCHECK_EQ(child_count(), 2);
DCHECK_EQ(children().size(), 2ul);
RemoveChildView(menu_bar_.get());
}

View File

@@ -169,7 +169,8 @@ void NotifyIcon::PopUpContextMenu(const gfx::Point& pos,
views::MenuRunner::CONTEXT_MENU | views::MenuRunner::HAS_MNEMONICS,
base::Bind(&NotifyIcon::OnContextMenuClosed,
weak_factory_.GetWeakPtr())));
menu_runner_->RunMenuAt(widget_.get(), NULL, rect, views::MENU_ANCHOR_TOPLEFT,
menu_runner_->RunMenuAt(widget_.get(), NULL, rect,
views::MenuAnchorPosition::kTopLeft,
ui::MENU_SOURCE_MOUSE);
}

View File

@@ -128,10 +128,10 @@ WebContentsPreferences::WebContentsPreferences(
SetDefaultBoolIfUndefined(options::kNativeWindowOpen, false);
SetDefaultBoolIfUndefined(options::kEnableRemoteModule, true);
SetDefaultBoolIfUndefined(options::kContextIsolation, false);
SetDefaultBoolIfUndefined("javascript", true);
SetDefaultBoolIfUndefined("images", true);
SetDefaultBoolIfUndefined("textAreasAreResizable", true);
SetDefaultBoolIfUndefined("webgl", true);
SetDefaultBoolIfUndefined(options::kJavaScript, true);
SetDefaultBoolIfUndefined(options::kImages, true);
SetDefaultBoolIfUndefined(options::kTextAreasAreResizable, true);
SetDefaultBoolIfUndefined(options::kWebGL, true);
bool webSecurity = true;
SetDefaultBoolIfUndefined(options::kWebSecurity, webSecurity);
// If webSecurity was explicity set to false, let's inherit that into
@@ -335,13 +335,13 @@ void WebContentsPreferences::AppendCommandLineSwitches(
int guest_instance_id = 0;
if (GetAsInteger(&preference_, options::kGuestInstanceID, &guest_instance_id))
command_line->AppendSwitchASCII(switches::kGuestInstanceID,
base::IntToString(guest_instance_id));
base::NumberToString(guest_instance_id));
// Pass the opener's window id.
int opener_id;
if (GetAsInteger(&preference_, options::kOpenerID, &opener_id))
command_line->AppendSwitchASCII(switches::kOpenerID,
base::IntToString(opener_id));
base::NumberToString(opener_id));
#if defined(OS_MACOSX)
// Enable scroll bounce.
@@ -405,19 +405,20 @@ void WebContentsPreferences::AppendCommandLineSwitches(
void WebContentsPreferences::OverrideWebkitPrefs(
content::WebPreferences* prefs) {
prefs->javascript_enabled = IsEnabled("javascript", true /* default_value */);
prefs->images_enabled = IsEnabled("images", true /* default_value */);
prefs->javascript_enabled =
IsEnabled(options::kJavaScript, true /* default_value */);
prefs->images_enabled = IsEnabled(options::kImages, true /* default_value */);
prefs->text_areas_are_resizable =
IsEnabled("textAreasAreResizable", true /* default_value */);
IsEnabled(options::kTextAreasAreResizable, true /* default_value */);
prefs->navigate_on_drag_drop =
IsEnabled("navigateOnDragDrop", false /* default_value */);
IsEnabled(options::kNavigateOnDragDrop, false /* default_value */);
if (!GetAsAutoplayPolicy(&preference_, "autoplayPolicy",
&prefs->autoplay_policy)) {
prefs->autoplay_policy = content::AutoplayPolicy::kNoUserGestureRequired;
}
// Check if webgl should be enabled.
bool is_webgl_enabled = IsEnabled("webgl", true /* default_value */);
bool is_webgl_enabled = IsEnabled(options::kWebGL, true /* default_value */);
prefs->webgl1_enabled = is_webgl_enabled;
prefs->webgl2_enabled = is_webgl_enabled;

View File

@@ -18,7 +18,7 @@
// The message starter should be declared in ipc/ipc_message_start.h. Since
// we don't want to patch Chromium, we just pretend to be Content Shell.
#define IPC_MESSAGE_START ShellMsgStart
#define IPC_MESSAGE_START ElectronMsgStart
IPC_STRUCT_TRAITS_BEGIN(atom::DraggableRegion)
IPC_STRUCT_TRAITS_MEMBER(draggable)

View File

@@ -117,16 +117,11 @@ class Archive : public mate::Wrappable<Archive> {
DISALLOW_COPY_AND_ASSIGN(Archive);
};
void InitAsarSupport(v8::Isolate* isolate,
v8::Local<v8::Value> source,
v8::Local<v8::Value> require) {
void InitAsarSupport(v8::Isolate* isolate, v8::Local<v8::Value> require) {
// Evaluate asar_init.js.
std::vector<v8::Local<v8::String>> asar_init_params = {
node::FIXED_ONE_BYTE_STRING(isolate, "source"),
node::FIXED_ONE_BYTE_STRING(isolate, "require")};
std::vector<v8::Local<v8::Value>> asar_init_args = {source, require};
std::vector<v8::Local<v8::Value>> asar_init_args = {require};
node::per_process::native_module_loader.CompileAndCall(
isolate->GetCurrentContext(), "electron/js2c/asar_init",
&asar_init_params, &asar_init_args, nullptr);

View File

@@ -11,7 +11,7 @@
#include "atom/common/native_mate_converters/content_converter.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/node_includes.h"
#include "base/hash.h"
#include "base/hash/hash.h"
#include "native_mate/dictionary.h"
#include "url/origin.h"
#include "v8/include/v8-profiler.h"
@@ -41,8 +41,12 @@ struct Converter<std::pair<Type1, Type2>> {
v8::Local<v8::Array> array(v8::Local<v8::Array>::Cast(val));
if (array->Length() != 2)
return false;
return Converter<Type1>::FromV8(isolate, array->Get(0), &out->first) &&
Converter<Type2>::FromV8(isolate, array->Get(1), &out->second);
auto context = isolate->GetCurrentContext();
return Converter<Type1>::FromV8(
isolate, array->Get(context, 0).ToLocalChecked(), &out->first) &&
Converter<Type2>::FromV8(
isolate, array->Get(context, 1).ToLocalChecked(), &out->second);
}
};

View File

@@ -9,7 +9,7 @@
#define ATOM_MINOR_VERSION 0
#define ATOM_PATCH_VERSION 0
// clang-format off
#define ATOM_PRE_RELEASE_VERSION -nightly.20190404
#define ATOM_PRE_RELEASE_VERSION -beta.3
// clang-format on
#ifndef ATOM_STRINGIFY

View File

@@ -139,6 +139,7 @@ void UnregisterNonABICompliantCodeRange(void* start) {
RtlDeleteFunctionTable(&record->runtime_function);
}
#endif // _WIN64
} // namespace
@@ -193,6 +194,7 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
v8::Isolate::GetCurrent()->GetCodeRange(&code_range, &size);
if (code_range && size &&
RegisterNonABICompliantCodeRange(code_range, size)) {
// FIXME(nornagon): This broke with https://crrev.com/c/1474703
gin::Debug::SetCodeRangeDeletedCallback(
UnregisterNonABICompliantCodeRange);
}

View File

@@ -92,7 +92,7 @@ bool WriteReportIDToFile(const std::wstring& dump_path,
int64_t seconds_since_epoch =
(base::Time::Now() - base::Time::UnixEpoch()).InSeconds();
std::wstring line = base::Int64ToString16(seconds_since_epoch);
std::wstring line = base::NumberToString16(seconds_since_epoch);
line += L',';
line += report_id;
line += L'\n';

View File

@@ -147,7 +147,8 @@ v8::Local<v8::Value> BindFunctionWith(v8::Isolate* isolate,
v8::Local<v8::Function> func,
v8::Local<v8::Value> arg1,
v8::Local<v8::Value> arg2) {
v8::MaybeLocal<v8::Value> bind = func->Get(mate::StringToV8(isolate, "bind"));
v8::MaybeLocal<v8::Value> bind =
func->Get(context, mate::StringToV8(isolate, "bind"));
CHECK(!bind.IsEmpty());
v8::Local<v8::Function> bind_func =
v8::Local<v8::Function>::Cast(bind.ToLocalChecked());

View File

@@ -50,15 +50,15 @@ bool CertFromData(const std::string& data,
} // namespace
// static
v8::Local<v8::Value> Converter<const net::AuthChallengeInfo*>::ToV8(
v8::Local<v8::Value> Converter<net::AuthChallengeInfo>::ToV8(
v8::Isolate* isolate,
const net::AuthChallengeInfo* val) {
const net::AuthChallengeInfo& val) {
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
dict.Set("isProxy", val->is_proxy);
dict.Set("scheme", val->scheme);
dict.Set("host", val->challenger.host());
dict.Set("port", static_cast<uint32_t>(val->challenger.port()));
dict.Set("realm", val->realm);
dict.Set("isProxy", val.is_proxy);
dict.Set("scheme", val.scheme);
dict.Set("host", val.challenger.host());
dict.Set("port", static_cast<uint32_t>(val.challenger.port()));
dict.Set("realm", val.realm);
return mate::ConvertToV8(isolate, dict);
}
@@ -210,7 +210,8 @@ bool Converter<net::HttpResponseHeaders*>::FromV8(
if (localVal->IsArray()) {
auto values = v8::Local<v8::Array>::Cast(localVal);
for (uint32_t j = 0; j < values->Length(); j++) {
if (!addHeaderFromValue(key, values->Get(j))) {
if (!addHeaderFromValue(key,
values->Get(context, j).ToLocalChecked())) {
return false;
}
}

View File

@@ -24,9 +24,9 @@ struct CertPrincipal;
namespace mate {
template <>
struct Converter<const net::AuthChallengeInfo*> {
struct Converter<net::AuthChallengeInfo> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const net::AuthChallengeInfo* val);
const net::AuthChallengeInfo& val);
};
template <>

View File

@@ -15,8 +15,9 @@ struct Converter<base::string16> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const base::string16& val) {
return v8::String::NewFromTwoByte(
isolate, reinterpret_cast<const uint16_t*>(val.data()),
v8::String::kNormalString, val.size());
isolate, reinterpret_cast<const uint16_t*>(val.data()),
v8::NewStringType::kNormal, val.size())
.ToLocalChecked();
}
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,

View File

@@ -204,6 +204,7 @@ v8::Local<v8::Value> V8ValueConverter::ToV8Array(
v8::Isolate* isolate,
const base::ListValue* val) const {
v8::Local<v8::Array> result(v8::Array::New(isolate, val->GetSize()));
auto context = isolate->GetCurrentContext();
for (size_t i = 0; i < val->GetSize(); ++i) {
const base::Value* child = nullptr;
@@ -212,7 +213,7 @@ v8::Local<v8::Value> V8ValueConverter::ToV8Array(
v8::Local<v8::Value> child_v8 = ToV8ValueImpl(isolate, child);
v8::TryCatch try_catch(isolate);
result->Set(static_cast<uint32_t>(i), child_v8);
result->Set(context, static_cast<uint32_t>(i), child_v8).Check();
if (try_catch.HasCaught())
LOG(ERROR) << "Setter for index " << i << " threw an exception.";
}
@@ -330,9 +331,10 @@ std::unique_ptr<base::Value> V8ValueConverter::FromV8ValueImpl(
if (val->IsDate()) {
v8::Date* date = v8::Date::Cast(*val);
v8::Local<v8::Value> toISOString =
date->Get(v8::String::NewFromUtf8(isolate, "toISOString",
v8::NewStringType::kNormal)
.ToLocalChecked());
date->Get(context, v8::String::NewFromUtf8(isolate, "toISOString",
v8::NewStringType::kNormal)
.ToLocalChecked())
.ToLocalChecked();
if (toISOString->IsFunction()) {
v8::MaybeLocal<v8::Value> result =
toISOString.As<v8::Function>()->Call(context, val, 0, nullptr);

View File

@@ -130,7 +130,7 @@ namespace {
// is not modified.
std::unique_ptr<const char* []> StringVectorToArgArray(
const std::vector<std::string>& vector) {
std::unique_ptr<const char* []> array(new const char*[vector.size()]);
std::unique_ptr<const char*[]> array(new const char*[vector.size()]);
for (size_t i = 0; i < vector.size(); ++i) {
array[i] = vector[i].c_str();
}
@@ -324,7 +324,7 @@ node::Environment* NodeBindings::CreateEnvironment(
.Append(FILE_PATH_LITERAL("init.js"));
args.insert(args.begin() + 1, script_path.AsUTF8Unsafe());
std::unique_ptr<const char* []> c_argv = StringVectorToArgArray(args);
std::unique_ptr<const char*[]> c_argv = StringVectorToArgArray(args);
node::Environment* env = node::CreateEnvironment(
node::CreateIsolateData(context->GetIsolate(), uv_loop_, platform),
context, args.size(), c_argv.get(), 0, nullptr);

View File

@@ -25,6 +25,13 @@
#pragma push_macro("CHECK_LE")
#pragma push_macro("CHECK_LT")
#pragma push_macro("CHECK_NE")
#pragma push_macro("DCHECK")
#pragma push_macro("DCHECK_EQ")
#pragma push_macro("DCHECK_GE")
#pragma push_macro("DCHECK_GT")
#pragma push_macro("DCHECK_LE")
#pragma push_macro("DCHECK_LT")
#pragma push_macro("DCHECK_NE")
#pragma push_macro("DISALLOW_COPY_AND_ASSIGN")
#pragma push_macro("LIKELY")
#pragma push_macro("NO_RETURN")
@@ -38,6 +45,13 @@
#undef CHECK_LE
#undef CHECK_LT
#undef CHECK_NE
#undef DCHECK
#undef DCHECK_EQ
#undef DCHECK_GE
#undef DCHECK_GT
#undef DCHECK_LE
#undef DCHECK_LT
#undef DCHECK_NE
#undef DISALLOW_COPY_AND_ASSIGN
#undef LIKELY
#undef NO_RETURN
@@ -67,6 +81,13 @@
#pragma pop_macro("CHECK_LE")
#pragma pop_macro("CHECK_LT")
#pragma pop_macro("CHECK_NE")
#pragma pop_macro("DCHECK")
#pragma pop_macro("DCHECK_EQ")
#pragma pop_macro("DCHECK_GE")
#pragma pop_macro("DCHECK_GT")
#pragma pop_macro("DCHECK_LE")
#pragma pop_macro("DCHECK_LT")
#pragma pop_macro("DCHECK_NE")
#pragma pop_macro("DISALLOW_COPY_AND_ASSIGN")
#pragma pop_macro("LIKELY")
#pragma pop_macro("NO_RETURN")

View File

@@ -160,6 +160,22 @@ const char kNodeIntegrationInSubFrames[] = "nodeIntegrationInSubFrames";
const char kDisableHtmlFullscreenWindowResize[] =
"disableHtmlFullscreenWindowResize";
// Enables JavaScript support.
const char kJavaScript[] = "javascript";
// Enables image support.
const char kImages[] = "images";
// Make TextArea elements resizable.
const char kTextAreasAreResizable[] = "textAreasAreResizable";
// Enables WebGL support.
const char kWebGL[] = "webgl";
// Whether dragging and dropping a file or link onto the page causes a
// navigation.
const char kNavigateOnDragDrop[] = "navigateOnDragDrop";
} // namespace options
namespace switches {
@@ -247,6 +263,9 @@ const char kAuthServerWhitelist[] = "auth-server-whitelist";
const char kAuthNegotiateDelegateWhitelist[] =
"auth-negotiate-delegate-whitelist";
// If set, include the port in generated Kerberos SPNs.
const char kEnableAuthNegotiatePort[] = "enable-auth-negotiate-port";
} // namespace switches
} // namespace atom

View File

@@ -77,6 +77,11 @@ extern const char kAllowRunningInsecureContent[];
extern const char kOffscreen[];
extern const char kNodeIntegrationInSubFrames[];
extern const char kDisableHtmlFullscreenWindowResize[];
extern const char kJavaScript[];
extern const char kImages[];
extern const char kTextAreasAreResizable[];
extern const char kWebGL[];
extern const char kNavigateOnDragDrop[];
} // namespace options
@@ -121,6 +126,7 @@ extern const char kDiskCacheSize[];
extern const char kIgnoreConnectionsLimit[];
extern const char kAuthServerWhitelist[];
extern const char kAuthNegotiateDelegateWhitelist[];
extern const char kEnableAuthNegotiatePort[];
} // namespace switches

View File

@@ -341,7 +341,7 @@ bool MoveItemToTrash(const base::FilePath& path) {
// Elevation prompt enabled for UAC protected files. This overrides the
// SILENT, NO_UI and NOERRORUI flags.
if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
if (base::win::GetVersion() >= base::win::Version::WIN8) {
// Windows 8 introduces the flag RECYCLEONDELETE and deprecates the
// ALLOWUNDO in favor of ADDUNDORECORD.
if (FAILED(pfo->SetOperationFlags(

View File

@@ -372,6 +372,9 @@ v8::Local<v8::Promise> ExecuteJavaScriptInIsolatedWorld(
blink::WebLocalFrame::kSynchronous;
args->GetNext(&scriptExecutionType);
// Debugging tip: if you see a crash stack trace beginning from this call,
// then it is very likely that some exception happened when executing the
// "content_script/init.js" script.
GetRenderFrame(window)->GetWebFrame()->RequestExecuteScriptInIsolatedWorld(
world_id, &sources.front(), sources.size(), has_user_gesture,
scriptExecutionType, new ScriptExecutionCallback(std::move(promise)));

View File

@@ -44,7 +44,8 @@ bool IsDevToolsExtension(content::RenderFrame* render_frame) {
}
v8::Local<v8::Object> GetModuleCache(v8::Isolate* isolate) {
mate::Dictionary global(isolate, isolate->GetCurrentContext()->Global());
auto context = isolate->GetCurrentContext();
mate::Dictionary global(isolate, context->Global());
v8::Local<v8::Value> cache;
if (!global.GetHidden(kModuleCacheKey, &cache)) {
@@ -52,7 +53,7 @@ v8::Local<v8::Object> GetModuleCache(v8::Isolate* isolate) {
global.SetHidden(kModuleCacheKey, cache);
}
return cache->ToObject(isolate);
return cache->ToObject(context).ToLocalChecked();
}
// adapted from node.cc
@@ -95,7 +96,9 @@ void InvokeHiddenCallback(v8::Handle<v8::Context> context,
const std::string& hidden_key,
const std::string& callback_name) {
auto* isolate = context->GetIsolate();
auto binding_key = mate::ConvertToV8(isolate, hidden_key)->ToString(isolate);
auto binding_key = mate::ConvertToV8(isolate, hidden_key)
->ToString(context)
.ToLocalChecked();
auto private_binding_key = v8::Private::ForApi(isolate, binding_key);
auto global_object = context->Global();
v8::Local<v8::Value> value;
@@ -103,10 +106,11 @@ void InvokeHiddenCallback(v8::Handle<v8::Context> context,
return;
if (value.IsEmpty() || !value->IsObject())
return;
auto binding = value->ToObject(isolate);
auto callback_key =
mate::ConvertToV8(isolate, callback_name)->ToString(isolate);
auto callback_value = binding->Get(callback_key);
auto binding = value->ToObject(context).ToLocalChecked();
auto callback_key = mate::ConvertToV8(isolate, callback_name)
->ToString(context)
.ToLocalChecked();
auto callback_value = binding->Get(context, callback_key).ToLocalChecked();
DCHECK(callback_value->IsFunction()); // set by sandboxed_renderer/init.js
auto callback = v8::Handle<v8::Function>::Cast(callback_value);
ignore_result(callback->Call(context, binding, 0, nullptr));
@@ -241,7 +245,7 @@ void AtomSandboxedRendererClient::SetupMainWorldOverrides(
auto* isolate = context->GetIsolate();
mate::Dictionary process = mate::Dictionary::CreateEmpty(isolate);
process.SetMethod("binding", GetBinding);
process.SetMethod("_linkedBinding", GetBinding);
std::vector<v8::Local<v8::String>> isolated_bundle_params = {
node::FIXED_ONE_BYTE_STRING(isolate, "nodeProcess"),
@@ -263,7 +267,7 @@ void AtomSandboxedRendererClient::SetupExtensionWorldOverrides(
auto* isolate = context->GetIsolate();
mate::Dictionary process = mate::Dictionary::CreateEmpty(isolate);
process.SetMethod("binding", GetBinding);
process.SetMethod("_linkedBinding", GetBinding);
std::vector<v8::Local<v8::String>> isolated_bundle_params = {
node::FIXED_ONE_BYTE_STRING(isolate, "nodeProcess"),

View File

@@ -31,13 +31,14 @@ const char kIpcKey[] = "ipcNative";
// Gets the private object under kIpcKey
v8::Local<v8::Object> GetIpcObject(v8::Local<v8::Context> context) {
auto* isolate = context->GetIsolate();
auto binding_key = mate::ConvertToV8(isolate, kIpcKey)->ToString(isolate);
auto binding_key =
mate::ConvertToV8(isolate, kIpcKey)->ToString(context).ToLocalChecked();
auto private_binding_key = v8::Private::ForApi(isolate, binding_key);
auto global_object = context->Global();
auto value =
global_object->GetPrivate(context, private_binding_key).ToLocalChecked();
DCHECK(!value.IsEmpty() && value->IsObject());
return value->ToObject(isolate);
return value->ToObject(context).ToLocalChecked();
}
void InvokeIpcCallback(v8::Local<v8::Context> context,
@@ -56,9 +57,10 @@ void InvokeIpcCallback(v8::Local<v8::Context> context,
callback_scope.reset(new node::CallbackScope(isolate, ipcNative, {0, 0}));
}
auto callback_key =
mate::ConvertToV8(isolate, callback_name)->ToString(isolate);
auto callback_value = ipcNative->Get(callback_key);
auto callback_key = mate::ConvertToV8(isolate, callback_name)
->ToString(context)
.ToLocalChecked();
auto callback_value = ipcNative->Get(context, callback_key).ToLocalChecked();
DCHECK(callback_value->IsFunction()); // set by init.ts
auto callback = v8::Local<v8::Function>::Cast(callback_value);
ignore_result(callback->Call(context, ipcNative, args.size(), args.data()));

View File

@@ -2,14 +2,21 @@ is_electron_build = true
use_jumbo_build = true
root_extra_deps = [ "//electron" ]
# Registry of NMVs --> https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json
node_module_version = 73
v8_promise_internal_field_count = 1
v8_typed_array_max_size_in_heap = 0
v8_embedder_string = "-electron.0"
# TODO: this breaks mksnapshot
v8_enable_snapshot_native_code_counters = false
enable_cdm_host_verification = false
proprietary_codecs = true
ffmpeg_branding = "Chrome"
enable_basic_printing = true
angle_enable_vulkan_validation_layers = false
is_cfi = false

View File

@@ -6,7 +6,7 @@ template("npm_action") {
action("npm_pre_flight_" + target_name) {
inputs = [
"package.json",
"package-lock.json",
"yarn.lock",
]
script = "//electron/build/npm-run.py"

View File

@@ -21,7 +21,7 @@ template("typescript_build") {
inputs = [
invoker.tsconfig,
"//electron/tsconfig.json",
"//electron/package-lock.json",
"//electron/yarn.lock",
"//electron/typings/internal-ambient.d.ts",
"//electron/typings/internal-electron.d.ts",
"//electron/typings/internal-helpers.d.ts",

View File

@@ -30,7 +30,11 @@ function isTrustedSender (webContents: Electron.WebContents) {
}
const parsedUrl = new URL(webContents.getURL())
return parsedUrl.protocol === 'file:' && parsedUrl.pathname === indexPath
const urlPath = process.platform === 'win32'
// Strip the prefixed "/" that occurs on windows
? path.resolve(parsedUrl.pathname.substr(1))
: parsedUrl.pathname
return parsedUrl.protocol === 'file:' && urlPath === indexPath
}
ipcMain.on('bootstrap', (event) => {
@@ -81,7 +85,7 @@ async function createWindow () {
cancelId: 1
}
dialog.showMessageBox(mainWindow!, options).then(response => {
dialog.showMessageBox(mainWindow!, options).then(({ response }) => {
done(response === 0)
})
})

View File

@@ -6,6 +6,19 @@ Breaking changes will be documented here, and deprecation warnings added to JS c
The `FIXME` string is used in code comments to denote things that should be fixed for future releases. See https://github.com/electron/electron/search?q=fixme
# Planned Breaking API Changes (7.0)
## `shell.openExternalSync(url[, options])`
```js
// Deprecated
shell.openExternalSync(url)
// Replace with
async function openThing (url) {
await shell.openExternal(url)
}
```
# Planned Breaking API Changes (6.0)
## `win.setMenu(null)`

View File

@@ -11,7 +11,7 @@ const { clipboard } = require('electron')
clipboard.writeText('Example String')
```
On X Window systems, there is also a selection clipboard. To manipulate it
On Linux, there is also a `selection` clipboard. To manipulate it
you need to pass `selection` to each method:
```javascript
@@ -28,53 +28,53 @@ The `clipboard` module has the following methods:
### `clipboard.readText([type])`
* `type` String (optional)
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
Returns `String` - The content in the clipboard as plain text.
### `clipboard.writeText(text[, type])`
* `text` String
* `type` String (optional)
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
Writes the `text` into the clipboard as plain text.
### `clipboard.readHTML([type])`
* `type` String (optional)
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
Returns `String` - The content in the clipboard as markup.
### `clipboard.writeHTML(markup[, type])`
* `markup` String
* `type` String (optional)
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
Writes `markup` to the clipboard.
### `clipboard.readImage([type])`
* `type` String (optional)
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
Returns [`NativeImage`](native-image.md) - The image content in the clipboard.
### `clipboard.writeImage(image[, type])`
* `image` [NativeImage](native-image.md)
* `type` String (optional)
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
Writes `image` to the clipboard.
### `clipboard.readRTF([type])`
* `type` String (optional)
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
Returns `String` - The content in the clipboard as RTF.
### `clipboard.writeRTF(text[, type])`
* `text` String
* `type` String (optional)
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
Writes the `text` into the clipboard in RTF.
@@ -93,7 +93,7 @@ bookmark is unavailable.
* `title` String
* `url` String
* `type` String (optional)
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
Writes the `title` and `url` into the clipboard as a bookmark.
@@ -123,20 +123,20 @@ synchronous IPC when called from the renderer process.
### `clipboard.clear([type])`
* `type` String (optional)
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
Clears the clipboard content.
### `clipboard.availableFormats([type])`
* `type` String (optional)
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
Returns `String[]` - An array of supported formats for the clipboard `type`.
### `clipboard.has(format[, type])` _Experimental_
* `format` String
* `type` String (optional)
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
Returns `Boolean` - Whether the clipboard supports the specified `format`.
@@ -161,7 +161,7 @@ Returns `Buffer` - Reads `format` type from the clipboard.
* `format` String
* `buffer` Buffer
* `type` String (optional)
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
Writes the `buffer` into the clipboard as `format`.
@@ -173,7 +173,7 @@ Writes the `buffer` into the clipboard as `format`.
* `image` [NativeImage](native-image.md) (optional)
* `rtf` String (optional)
* `bookmark` String (optional) - The title of the url at `text`.
* `type` String (optional)
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
```javascript
const { clipboard } = require('electron')

View File

@@ -240,7 +240,10 @@ const template = [
submenu: [
{
label: 'Learn More',
click () { require('electron').shell.openExternalSync('https://electronjs.org') }
click: async () => {
const { shell } = require('electron')
await shell.openExternal('https://electronjs.org')
}
}
]
}

View File

@@ -54,7 +54,6 @@ app.on('ready', () => {
})
})
```
Using `protocol.registerStandardSchemes` without the session will still register your custom protocol as a standard scheme.
## Methods
@@ -149,8 +148,8 @@ going to be created with `scheme`. `completion` will be called with
To handle the `request`, the `callback` should be called with either the file's
path or an object that has a `path` property, e.g. `callback(filePath)` or
`callback({ path: filePath })`. The object may also have a `headers` property
which gives a list of strings for the response headers, e.g.
`callback({ path: filePath, headers: ["Content-Security-Policy: default-src 'none'"]})`.
which gives a map of headers to values for the response headers, e.g.
`callback({ path: filePath, headers: {"Content-Security-Policy": "default-src 'none'"]})`.
When `callback` is called with nothing, a number, or an object that has an
`error` property, the `request` will fail with the `error` number you
@@ -158,9 +157,7 @@ specified. For the available error numbers you can use, please see the
[net error list][net-error].
By default the `scheme` is treated like `http:`, which is parsed differently
than protocols that follow the "generic URI syntax" like `file:`, so you
probably want to call `protocol.registerStandardSchemes` to have your scheme
treated as a standard scheme.
than protocols that follow the "generic URI syntax" like `file:`.
### `protocol.registerBufferProtocol(scheme, handler[, completion])`

View File

@@ -548,12 +548,16 @@ Clears the sessions HTTP authentication cache.
**[Deprecated Soon](modernization/promisification.md)**
#### `ses.clearAuthCache(options)`
#### `ses.clearAuthCache(options)` _(deprecated)_
* `options` ([RemovePassword](structures/remove-password.md) | [RemoveClientCertificate](structures/remove-client-certificate.md))
Returns `Promise<void>` - resolves when the sessions HTTP authentication cache has been cleared.
#### `ses.clearAuthCache()`
Returns `Promise<void>` - resolves when the sessions HTTP authentication cache has been cleared.
#### `ses.setPreloads(preloads)`
* `preloads` String[] - An array of absolute path to preload scripts

View File

@@ -44,6 +44,8 @@ Returns `Boolean` - Whether an application was available to open the URL.
Open the given external protocol URL in the desktop's default manner. (For example, mailto: URLs in the user's default mail agent).
**Deprecated**
### `shell.openExternal(url[, options])`
* `url` String - Max 2081 characters on windows.

View File

@@ -138,11 +138,16 @@ new [`BrowserWindow`](browser-window.md). If you call `event.preventDefault()` a
instance, failing to do so may result in unexpected behavior. For example:
```javascript
myBrowserWindow.webContents.on('new-window', (event, url) => {
myBrowserWindow.webContents.on('new-window', (event, url, frameName, disposition, options) => {
event.preventDefault()
const win = new BrowserWindow({ show: false })
const win = new BrowserWindow({
webContents: options.webContents, // use existing webContents if provided
show: false
})
win.once('ready-to-show', () => win.show())
win.loadURL(url)
if (!options.webContents) {
win.loadURL(url) // existing webContents will be navigated automatically
}
event.newGuest = win
})
```

Some files were not shown because too many files have changed in this diff Show More