Compare commits

...

33 Commits

Author SHA1 Message Date
John Kleinschmidt
3c5ba35d63 Bump v2.0.0-beta.3 2018-03-09 09:15:39 -05:00
Cheng Zhao
0f143fdba0 Merge pull request #12182 from electron/update-libcc-2-0-x
Update to latest libchromiumcontent for 2-0-x
2018-03-09 10:16:43 +09:00
John Kleinschmidt
99ae56b782 Add configurable mocha timeout
Adding an environment variable, MOCHA_TIMEOUT that can be set for slower CI platforms
2018-03-08 16:29:31 -05:00
Aleš Pergl
5471bc313f Use content origin in screen coordinates for calculating popup menu position (#12181) 2018-03-09 05:55:31 +09:00
John Kleinschmidt
b0077241ee Update to latest libchromiumcontent for 2-0-x 2018-03-08 15:12:29 -05:00
John Kleinschmidt
bb40bc4aca Add logic to support automatic releases (#12177) 2018-03-09 02:46:06 +09:00
John Kleinschmidt
76fb7ee87c Allow CI testing on arm64 hardware for 2-0-x (#12178)
* Allow CI building on arm64 hardware

* Use bundled freetype from Chromium

(cherry picked from commit 51f89048d6)
2018-03-09 02:21:55 +09:00
Alexey Kuzmin
bfc0e3f266 Merge pull request #12174 from electron/cp-2-0-x/12059
Merge pull request #12059 from electron/add-tabbedwindow-warning
2018-03-08 15:13:37 +01:00
Alexey Kuzmin
48e068997b More vibrancy fixes (#12157) (#12171)
* Only set title bar to transparent when vibrant with a custom titlebar
* Correctly set the transparent state of the GpuSwitcher so vibrancy works on reload
* Document case where using frame: false without custom titleBarStyle and vibrant

(cherry picked from commit 8c138e74be)
2018-03-08 08:51:36 -05:00
Alexey Kuzmin
f443974f3d Merge pull request #12043 from kaylieEB/fix-menu-item (#12170)
Fix context menu click callback

(cherry picked from commit cc608a3fb0)
2018-03-08 08:43:38 -05:00
shelley vohr
36505ae00e Merge pull request #12059 from electron/add-tabbedwindow-warning
add warning when addTabbedWindow is called on self

(cherry picked from commit dfa1dc43df)
2018-03-08 14:33:10 +01:00
Charles Kerr
b330ff8004 Removals come >=1 major release after deprecation. (#12164) 2018-03-08 11:18:36 +09:00
John Kleinschmidt
6cda9460ea Merge pull request #12161 from electron/backport-flake-fixes
Backport flake fixes (2-0-x)
2018-03-07 14:09:14 -05:00
Charles Kerr
2cac654974 Exit gracefully on linux (#12139)
* Fix timing issue in singleton fixture.

Singleton now sends the "we've started" message out only after it's
received a `'ready'` event from `app`. Previously it sent the message
out immediately, resulting in the parent test trying to manipulate it
before Singleton's event loop was fully bootstrapped.

* Check for graceful exits on Linux, too.

Rewrite the "exits gracefully on macos" spec to run on Linux too.

* Check for graceful exits everywhere.

* Tweak comment

* Better error logging in api-app-spec.js. (#12122)

In the 'exits gracefully' test for app.exit(exitCode),
print the relevant error information if the test fails.

* Run the exit-gracefully test on macOS and Linux.

Windows does not support sending signals, but Node.js offers some
emulation with process.kill(), and subprocess.kill(). Sending signal 0
can be used to test for the existence of a process. Sending SIGINT,
SIGTERM, and SIGKILL cause the unconditional termination of the target
process.

So, we'll need a different approach if we want to test this in win32.
2018-03-07 12:45:26 -05:00
shelley vohr
5a210f3d7a Merge pull request #12137 from electron/deprecate-getMenuBatHeight-2.0.x
Deprecate screen.getMenuBarHeight (2.0.x)
2018-03-06 07:38:53 -08:00
Alexey Kuzmin
4bb10c10e4 Merge pull request #12133 from electron/update-libcc
Update libchromiumcontent for 2-0-x
2018-03-06 12:51:58 +01:00
Shelley Vohr
c0076d9c52 remove screen.getMenuBarHeight spec 2018-03-05 21:00:55 -05:00
Shelley Vohr
95539c5b63 deprecate screen.getMenuBarHeight 2018-03-05 21:00:50 -05:00
John Kleinschmidt
4f8ca2f03a Update to latest libchromiumcontent
Update to get electron/libchromiumcontent#463 security fix
2018-03-05 15:12:02 -05:00
John Kleinschmidt
c9b92aebd3 Bump v2.0.0-beta.2 2018-03-05 13:14:27 -05:00
Cheng Zhao
6d3f60374e Merge pull request #12087 from electron/fix-dock-menu-gc-2-0-x
Fix crash when setting dock menu (2.0.x)
2018-03-02 08:39:03 +09:00
Cheng Zhao
8703298e9d spec: Test garbage collecting dock menu 2018-03-01 09:48:39 +09:00
Cheng Zhao
a42057aabd Fix dockMenu not being referenced in JavaScript 2018-03-01 09:48:39 +09:00
Cheng Zhao
bd2ab27c25 Merge pull request #12053 from electron/network-delegate-race
Fix network delegate race condition in 2-0-x
2018-02-27 08:47:20 +09:00
Cheng Zhao
1e6d7295cf Move the arguments instead of const referrencing
Safer and more efficient.
2018-02-26 09:34:49 -08:00
Cheng Zhao
1918da7c2e Remove the evil URLRequestContextGetter::network_delegate 2018-02-26 09:34:40 -08:00
Cheng Zhao
38345c7267 Fix race condition when getting network delegate 2018-02-26 09:34:32 -08:00
shelley vohr
c4742df1ee Merge pull request #12016 from electron/backport-release-updates
Backport fixes from running 2.0.0-beta.1 release to 2-0-x
2018-02-22 15:27:05 -05:00
John Kleinschmidt
5fc485043b Fixes from running 2.0.0-beta.1 release
This provides the following fixes:
1. Remove logic to delete release branch because that branch is no longer used.
2. Fix --validateRelease to not verifyShasums when release is in draft mode.

(cherry picked from commit fa6510a90c)
2018-02-22 11:26:30 -05:00
shelley vohr
967dcd3471 Merge pull request #12014 from electron/backport-version-fix
Fix deprecated API in tools/dump-version-info.js for 2-0-x
2018-02-22 09:28:52 -05:00
John Kleinschmidt
96f800552c Fix deprecated API in tools/dump-version-info.js 2018-02-22 09:00:37 -05:00
John Kleinschmidt
afcbb589b6 Bump v2.0.0-beta.1 2018-02-21 14:45:36 -05:00
John Kleinschmidt
4159103467 Use new release job 2018-02-21 14:41:18 -05:00
40 changed files with 372 additions and 165 deletions

View File

@@ -58,6 +58,29 @@ jobs:
else
echo 'Skipping upload distribution because build is not for release'
fi
- run:
name: Optionally finish release
shell: /bin/sh
command: |
if [ "$ELECTRON_RELEASE" == "1" ] && [ "$AUTO_RELEASE" == "true" ]; then
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 8
nvm use 8
node script/release.js --automaticRelease
releaseExitCode=$?
if [ $? -eq 0 ]; then
echo 'Release successful, now publishing to npm'
echo "//registry.npmjs.org/:_authToken=$ELECTRON_NPM_TOKEN" >> ~/.npmrc
nvm use system
npm run publish
else
echo 'Release is not complete, skipping publish for now.'
fi
else
echo 'Skipping release check'
fi
- run:
name: Zip out directory
command: |

63
Dockerfile.arm64v8 Normal file
View File

@@ -0,0 +1,63 @@
FROM arm64v8/ubuntu:16.04
RUN groupadd --gid 1000 builduser \
&& useradd --uid 1000 --gid builduser --shell /bin/bash --create-home builduser
RUN groupadd --gid 114 jenkins \
&& useradd --uid 110 --gid jenkins --shell /bin/bash --create-home jenkins
# Set up TEMP directory
ENV TEMP=/tmp
RUN chmod a+rwx /tmp
RUN apt-get update && apt-get install -y\
bison \
build-essential \
clang \
curl \
gperf \
git \
libasound2 \
libasound2-dev \
libcap-dev \
libcups2-dev \
libdbus-1-dev \
libgconf-2-4 \
libgconf2-dev \
libgnome-keyring-dev \
libgtk2.0-0 \
libgtk2.0-dev \
libgtk-3-0 \
libgtk-3-dev \
libnotify-dev \
libnss3 \
libnss3-dev \
libx11-xcb-dev \
libxss1 \
libxtst-dev \
libxtst6 \
lsb-release \
locales \
ninja \
python-setuptools \
python-pip \
python-dbusmock \
wget \
xvfb
# Install node.js
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN apt-get update && apt-get install -y nodejs
# Install crcmod
RUN pip install -U crcmod
ADD tools/xvfb-init.sh /etc/init.d/xvfb
RUN chmod a+x /etc/init.d/xvfb
# Install ninja in /usr/local
RUN cd /usr/local && git clone https://github.com/martine/ninja.git -b v1.5.3
RUN cd /usr/local/ninja && ./configure.py --bootstrap
USER builduser
WORKDIR /home/builduser

36
Jenkinsfile.arm64 Normal file
View File

@@ -0,0 +1,36 @@
pipeline {
agent {
docker {
image 'electronbuilds/arm64v8:0.0.1'
args '--privileged'
}
}
environment {
TARGET_ARCH='arm64'
DISPLAY=':99.0'
MOCHA_TIMEOUT='60000'
}
stages {
stage('Bootstrap') {
steps {
sh 'script/bootstrap.py -v --dev --target_arch=$TARGET_ARCH'
}
}
stage('Build') {
steps {
sh 'script/build.py -c D --ninja-path /usr/local/ninja/ninja'
}
}
stage('Test') {
steps {
sh '/etc/init.d/xvfb start'
sh 'script/test.py --ci'
}
}
}
post {
always {
cleanWs()
}
}
}

View File

@@ -23,20 +23,16 @@ MenuViews::MenuViews(v8::Isolate* isolate, v8::Local<v8::Object> wrapper)
void MenuViews::PopupAt(Window* window, int x, int y, int positioning_item,
const base::Closure& callback) {
NativeWindow* native_window = static_cast<NativeWindow*>(window->window());
auto* native_window = static_cast<NativeWindowViews*>(window->window());
if (!native_window)
return;
auto* web_contents = native_window->inspectable_web_contents();
if (!web_contents)
return;
// (-1, -1) means showing on mouse location.
gfx::Point location;
if (x == -1 || y == -1) {
location = display::Screen::GetScreen()->GetCursorScreenPoint();
} else {
auto* view = web_contents->GetView()->GetWebView();
gfx::Point origin = view->bounds().origin();
gfx::Point origin = native_window->GetContentBounds().origin();
location = gfx::Point(origin.x() + x, origin.y() + y);
}
@@ -52,7 +48,7 @@ void MenuViews::PopupAt(Window* window, int x, int y, int positioning_item,
menu_runners_[window_id] = std::unique_ptr<MenuRunner>(new MenuRunner(
model(), flags, close_callback));
menu_runners_[window_id]->RunMenuAt(
static_cast<NativeWindowViews*>(window->window())->widget(),
native_window->widget(),
NULL,
gfx::Rect(location, gfx::Size()),
views::MENU_ANCHOR_TOPLEFT,

View File

@@ -9,6 +9,7 @@ namespace atom {
namespace api {
//TODO(codebytere): deprecated; remove in 3.0
int Screen::getMenuBarHeight() {
return [[NSApp mainMenu] menuBarHeight];
}

View File

@@ -441,14 +441,15 @@ void DownloadIdCallback(content::DownloadManager* download_manager,
}
void SetDevToolsNetworkEmulationClientIdInIO(
brightray::URLRequestContextGetter* context_getter,
brightray::URLRequestContextGetter* url_request_context_getter,
const std::string& client_id) {
if (!context_getter)
if (!url_request_context_getter)
return;
auto network_delegate =
static_cast<AtomNetworkDelegate*>(context_getter->network_delegate());
if (network_delegate)
network_delegate->SetDevToolsNetworkEmulationClientId(client_id);
net::URLRequestContext* context =
url_request_context_getter->GetURLRequestContext();
AtomNetworkDelegate* network_delegate =
static_cast<AtomNetworkDelegate*>(context->network_delegate());
network_delegate->SetDevToolsNetworkEmulationClientId(client_id);
}
} // namespace

View File

@@ -37,6 +37,26 @@ namespace atom {
namespace api {
namespace {
template<typename Method, typename Event, typename Listener>
void CallNetworkDelegateMethod(
brightray::URLRequestContextGetter* url_request_context_getter,
Method method,
Event type,
URLPatterns patterns,
Listener listener) {
// Force creating network delegate.
net::URLRequestContext* context =
url_request_context_getter->GetURLRequestContext();
// Then call the method.
AtomNetworkDelegate* network_delegate =
static_cast<AtomNetworkDelegate*>(context->network_delegate());
(network_delegate->*method)(type, std::move(patterns), std::move(listener));
}
} // namespace
WebRequest::WebRequest(v8::Isolate* isolate,
AtomBrowserContext* browser_context)
: browser_context_(browser_context) {
@@ -74,16 +94,15 @@ void WebRequest::SetListener(Method method, Event type, mate::Arguments* args) {
return;
}
auto url_request_context_getter =
brightray::URLRequestContextGetter* url_request_context_getter =
browser_context_->url_request_context_getter();
if (!url_request_context_getter)
return;
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(method,
base::Unretained(static_cast<AtomNetworkDelegate*>(
url_request_context_getter->network_delegate())),
type, patterns, listener));
base::Bind(&CallNetworkDelegateMethod<Method, Event, Listener>,
base::RetainedRef(url_request_context_getter),
method, type, std::move(patterns), std::move(listener)));
}
// static

View File

@@ -952,8 +952,11 @@ void Window::ToggleTabBar() {
window_->ToggleTabBar();
}
void Window::AddTabbedWindow(NativeWindow* window) {
window_->AddTabbedWindow(window);
void Window::AddTabbedWindow(NativeWindow* window,
mate::Arguments* args) {
const bool windowAdded = window_->AddTabbedWindow(window);
if (!windowAdded)
args->ThrowError("AddTabbedWindow cannot be called by a window on itself.");
}
void Window::SetVibrancy(mate::Arguments* args) {

View File

@@ -222,7 +222,7 @@ class Window : public mate::TrackableObject<Window>,
void MergeAllWindows();
void MoveTabToNewWindow();
void ToggleTabBar();
void AddTabbedWindow(NativeWindow* window);
void AddTabbedWindow(NativeWindow* window, mate::Arguments* args);
void SetVibrancy(mate::Arguments* args);
void SetTouchBar(const std::vector<mate::PersistentDictionary>& items);

View File

@@ -362,7 +362,8 @@ void NativeWindow::MoveTabToNewWindow() {
void NativeWindow::ToggleTabBar() {
}
void NativeWindow::AddTabbedWindow(NativeWindow* window) {
bool NativeWindow::AddTabbedWindow(NativeWindow* window) {
return true; // for non-Mac platforms
}
void NativeWindow::SetVibrancy(const std::string& filename) {

View File

@@ -193,7 +193,7 @@ class NativeWindow : public base::SupportsUserData,
virtual void MergeAllWindows();
virtual void MoveTabToNewWindow();
virtual void ToggleTabBar();
virtual void AddTabbedWindow(NativeWindow* window);
virtual bool AddTabbedWindow(NativeWindow* window);
// Webview APIs.
virtual void FocusOnWebView();

View File

@@ -111,7 +111,7 @@ class NativeWindowMac : public NativeWindow,
void MergeAllWindows() override;
void MoveTabToNewWindow() override;
void ToggleTabBar() override;
void AddTabbedWindow(NativeWindow* window) override;
bool AddTabbedWindow(NativeWindow* window) override;
void SetVibrancy(const std::string& type) override;
void SetTouchBar(

View File

@@ -31,6 +31,7 @@
#include "skia/ext/skia_utils_mac.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/gfx/skia_util.h"
#include "ui/gl/gpu_switching_manager.h"
namespace {
@@ -1677,10 +1678,14 @@ void NativeWindowMac::ToggleTabBar() {
}
}
void NativeWindowMac::AddTabbedWindow(NativeWindow* window) {
if ([window_ respondsToSelector:@selector(addTabbedWindow:ordered:)]) {
[window_ addTabbedWindow:window->GetNativeWindow() ordered:NSWindowAbove];
bool NativeWindowMac::AddTabbedWindow(NativeWindow* window) {
if (window_.get() == window->GetNativeWindow()) {
return false;
} else {
if ([window_ respondsToSelector:@selector(addTabbedWindow:ordered:)])
[window_ addTabbedWindow:window->GetNativeWindow() ordered:NSWindowAbove];
}
return true;
}
void NativeWindowMac::SetRenderWidgetHostOpaque(bool opaque) {
@@ -1712,6 +1717,7 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
[vibrant_view removeFromSuperview];
[window_ setVibrantView:nil];
ui::GpuSwitchingManager::SetTransparent(transparent());
return;
}
@@ -1719,9 +1725,12 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
SetRenderWidgetHostOpaque(false);
background_color_before_vibrancy_.reset([window_ backgroundColor]);
transparency_before_vibrancy_ = [window_ titlebarAppearsTransparent];
ui::GpuSwitchingManager::SetTransparent(true);
[window_ setTitlebarAppearsTransparent:YES];
[window_ setBackgroundColor:[NSColor clearColor]];
if (title_bar_style_ != NORMAL) {
[window_ setTitlebarAppearsTransparent:YES];
[window_ setBackgroundColor:[NSColor clearColor]];
}
NSVisualEffectView* effect_view = (NSVisualEffectView*)vibrant_view;
if (effect_view == nil) {

View File

@@ -227,22 +227,22 @@ AtomNetworkDelegate::~AtomNetworkDelegate() {
void AtomNetworkDelegate::SetSimpleListenerInIO(
SimpleEvent type,
const URLPatterns& patterns,
const SimpleListener& callback) {
URLPatterns patterns,
SimpleListener callback) {
if (callback.is_null())
simple_listeners_.erase(type);
else
simple_listeners_[type] = { patterns, callback };
simple_listeners_[type] = { std::move(patterns), std::move(callback) };
}
void AtomNetworkDelegate::SetResponseListenerInIO(
ResponseEvent type,
const URLPatterns& patterns,
const ResponseListener& callback) {
URLPatterns patterns,
ResponseListener callback) {
if (callback.is_null())
response_listeners_.erase(type);
else
response_listeners_[type] = { patterns, callback };
response_listeners_[type] = { std::move(patterns), std::move(callback) };
}
void AtomNetworkDelegate::SetDevToolsNetworkEmulationClientId(

View File

@@ -62,11 +62,11 @@ class AtomNetworkDelegate : public brightray::NetworkDelegate {
~AtomNetworkDelegate() override;
void SetSimpleListenerInIO(SimpleEvent type,
const URLPatterns& patterns,
const SimpleListener& callback);
URLPatterns patterns,
SimpleListener callback);
void SetResponseListenerInIO(ResponseEvent type,
const URLPatterns& patterns,
const ResponseListener& callback);
URLPatterns patterns,
ResponseListener callback);
void SetDevToolsNetworkEmulationClientId(const std::string& client_id);

View File

@@ -17,9 +17,9 @@
<key>CFBundleIconFile</key>
<string>electron.icns</string>
<key>CFBundleVersion</key>
<string>1.8.2</string>
<string>2.0.0</string>
<key>CFBundleShortVersionString</key>
<string>1.8.2</string>
<string>2.0.0</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>

View File

@@ -56,8 +56,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,8,2,2
PRODUCTVERSION 1,8,2,2
FILEVERSION 2,0,0,3
PRODUCTVERSION 2,0,0,3
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -74,12 +74,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "GitHub, Inc."
VALUE "FileDescription", "Electron"
VALUE "FileVersion", "1.8.2"
VALUE "FileVersion", "2.0.0"
VALUE "InternalName", "electron.exe"
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
VALUE "OriginalFilename", "electron.exe"
VALUE "ProductName", "Electron"
VALUE "ProductVersion", "1.8.2"
VALUE "ProductVersion", "2.0.0"
VALUE "SquirrelAwareVersion", "1"
END
END

View File

@@ -9,12 +9,15 @@
#include "base/logging.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/browser_thread.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/accelerators/platform_accelerator_cocoa.h"
#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/events/cocoa/cocoa_event_utils.h"
#include "ui/gfx/image/image.h"
using content::BrowserThread;
namespace {
struct Role {
@@ -335,7 +338,11 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
if (isMenuOpen_) {
isMenuOpen_ = NO;
model_->MenuWillClose();
closeCallback.Run();
// Post async task so that itemSelected runs before the close callback
// deletes the controller from the map which deallocates it
if (!closeCallback.is_null()) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, closeCallback);
}
}
}

View File

@@ -5,10 +5,10 @@
#ifndef ATOM_COMMON_ATOM_VERSION_H_
#define ATOM_COMMON_ATOM_VERSION_H_
#define ATOM_MAJOR_VERSION 1
#define ATOM_MINOR_VERSION 8
#define ATOM_PATCH_VERSION 2
#define ATOM_PRE_RELEASE_VERSION -beta.2
#define ATOM_MAJOR_VERSION 2
#define ATOM_MINOR_VERSION 0
#define ATOM_PATCH_VERSION 0
#define ATOM_PRE_RELEASE_VERSION -beta.3
#ifndef ATOM_STRINGIFY
#define ATOM_STRINGIFY(n) ATOM_STRINGIFY_HELPER(n)

View File

@@ -157,7 +157,6 @@
'-ldl',
'-lresolv',
'-lfontconfig',
'-lfreetype',
'-lexpat',
],
},
@@ -169,14 +168,6 @@
],
},
}],
# On ARM64 libchromiumcontent always links to system libfreetype
['target_arch=="arm64"', {
'link_settings': {
'libraries': [
'-lfreetype',
],
},
}],
],
}], # OS=="linux"
['OS=="mac"', {

View File

@@ -80,11 +80,6 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
net::HostResolver* host_resolver();
net::URLRequestJobFactory* job_factory() const { return job_factory_; }
net::NetworkDelegate* network_delegate() const {
if (url_request_context_)
return url_request_context_->network_delegate();
return nullptr;
}
private:
Delegate* delegate_;

View File

@@ -235,7 +235,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
window shadow and window animations. Default is `true`.
* `vibrancy` String (optional) - Add a type of vibrancy effect to the window, only on
macOS. Can be `appearance-based`, `light`, `dark`, `titlebar`, `selection`,
`menu`, `popover`, `sidebar`, `medium-light` or `ultra-dark`.
`menu`, `popover`, `sidebar`, `medium-light` or `ultra-dark`. Please note that
using `frame: false` in combination with a vibrancy value requires that you use a
non-default `titleBarStyle` as well.
* `zoomToPageWidth` Boolean (optional) - Controls the behavior on macOS when
option-clicking the green stoplight button on the toolbar or by clicking the
Window > Zoom menu item. If `true`, the window will grow to the preferred

View File

@@ -3,7 +3,7 @@
The following list includes the APIs that will be removed in Electron 2.0.
There is no timetable for when this release will occur but deprecation
warnings will be added at least 90 days beforehand.
warnings will be added at least [one major version](electron-versioning.md#semver) beforehand.
## `app`

View File

@@ -4,7 +4,7 @@
'product_name%': 'Electron',
'company_name%': 'GitHub, Inc',
'company_abbr%': 'github',
'version%': '1.8.2-beta.2',
'version%': '2.0.0-beta.3',
'js2c_input_dir': '<(SHARED_INTERMEDIATE_DIR)/js2c',
},
'includes': [

View File

@@ -10,6 +10,8 @@ const electron = require('electron')
const {deprecate, Menu} = electron
const {EventEmitter} = require('events')
let dockMenu = null
// App is an EventEmitter.
Object.setPrototypeOf(App.prototype, EventEmitter.prototype)
EventEmitter.call(app)
@@ -49,7 +51,13 @@ if (process.platform === 'darwin') {
hide: bindings.dockHide,
show: bindings.dockShow,
isVisible: bindings.dockIsVisible,
setMenu: bindings.dockSetMenu,
setMenu (menu) {
dockMenu = menu
bindings.dockSetMenu(menu)
},
getMenu () {
return dockMenu
},
setIcon: bindings.dockSetIcon
}
}

View File

@@ -1,8 +1,17 @@
const {EventEmitter} = require('events')
const {deprecate} = require('electron')
const {screen, Screen} = process.atomBinding('screen')
// Screen is an EventEmitter.
Object.setPrototypeOf(Screen.prototype, EventEmitter.prototype)
EventEmitter.call(screen)
const nativeFn = screen.getMenuBarHeight
screen.getMenuBarHeight = function () {
if (!process.noDeprecations) {
deprecate.warn('screen.getMenuBarHeight', 'screen.getPrimaryDisplay().workArea')
}
return nativeFn.call(this)
}
module.exports = screen

View File

@@ -1,6 +1,6 @@
{
"name": "electron",
"version": "1.8.2-beta.2",
"version": "2.0.0-beta.3",
"repository": "https://github.com/electron/electron",
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
"devDependencies": {

View File

@@ -28,6 +28,8 @@ def main():
ninja += '.exe'
args = parse_args()
if args.ninja_path:
ninja = args.ninja_path
if args.libcc:
if ('D' not in args.configuration
or not os.path.exists(GCLIENT_DONE)
@@ -67,6 +69,9 @@ def parse_args():
'-d --debug_libchromiumcontent.'
),
action='store_true', default=False)
parser.add_argument('--ninja-path',
help='Path of ninja command to use.',
required=False)
return parser.parse_args()

View File

@@ -12,8 +12,7 @@ const circleCIJobs = [
]
const jenkinsJobs = [
'electron-mas-x64-release',
'electron-osx-x64-release'
'electron-release'
]
async function makeRequest (requestOptions, parseResponse) {
@@ -38,7 +37,7 @@ async function makeRequest (requestOptions, parseResponse) {
})
}
async function circleCIcall (buildUrl, targetBranch, job, ghRelease) {
async function circleCIcall (buildUrl, targetBranch, job, options) {
assert(process.env.CIRCLE_TOKEN, 'CIRCLE_TOKEN not found in environment')
console.log(`Triggering CircleCI to run build job: ${job} on branch: ${targetBranch} with release flag.`)
let buildRequest = {
@@ -47,12 +46,16 @@ async function circleCIcall (buildUrl, targetBranch, job, ghRelease) {
}
}
if (ghRelease) {
if (options.ghRelease) {
buildRequest.build_parameters.ELECTRON_RELEASE = 1
} else {
buildRequest.build_parameters.RUN_RELEASE_BUILD = 'true'
}
if (options.automaticRelease) {
buildRequest.build_parameters.AUTO_RELEASE = 'true'
}
let circleResponse = await makeRequest({
method: 'POST',
url: buildUrl,
@@ -67,17 +70,21 @@ async function circleCIcall (buildUrl, targetBranch, job, ghRelease) {
console.log(`Check ${circleResponse.build_url} for status. (${job})`)
}
async function buildAppVeyor (targetBranch, ghRelease) {
async function buildAppVeyor (targetBranch, options) {
console.log(`Triggering AppVeyor to run build on branch: ${targetBranch} with release flag.`)
assert(process.env.APPVEYOR_TOKEN, 'APPVEYOR_TOKEN not found in environment')
let environmentVariables = {}
if (ghRelease) {
if (options.ghRelease) {
environmentVariables.ELECTRON_RELEASE = 1
} else {
environmentVariables.RUN_RELEASE_BUILD = 'true'
}
if (options.automaticRelease) {
environmentVariables.AUTO_RELEASE = 'true'
}
const requestOpts = {
url: buildAppVeyorURL,
auth: {
@@ -101,27 +108,27 @@ async function buildAppVeyor (targetBranch, ghRelease) {
console.log(`AppVeyor release build request successful. Check build status at ${buildUrl}`)
}
function buildCircleCI (targetBranch, ghRelease, job) {
function buildCircleCI (targetBranch, options) {
const circleBuildUrl = `https://circleci.com/api/v1.1/project/github/electron/electron/tree/${targetBranch}?circle-token=${process.env.CIRCLE_TOKEN}`
if (job) {
assert(circleCIJobs.includes(job), `Unknown CI job name: ${job}.`)
circleCIcall(circleBuildUrl, targetBranch, job, ghRelease)
if (options.job) {
assert(circleCIJobs.includes(options.job), `Unknown CI job name: ${options.job}.`)
circleCIcall(circleBuildUrl, targetBranch, options.job, options)
} else {
circleCIJobs.forEach((job) => circleCIcall(circleBuildUrl, targetBranch, job, ghRelease))
circleCIJobs.forEach((job) => circleCIcall(circleBuildUrl, targetBranch, job, options))
}
}
async function buildJenkins (targetBranch, ghRelease, job) {
async function buildJenkins (targetBranch, options) {
assert(process.env.JENKINS_AUTH_TOKEN, 'JENKINS_AUTH_TOKEN not found in environment')
assert(process.env.JENKINS_BUILD_TOKEN, 'JENKINS_BUILD_TOKEN not found in environment')
let jenkinsCrumb = await getJenkinsCrumb()
if (job) {
assert(jenkinsJobs.includes(job), `Unknown CI job name: ${job}.`)
callJenkinsBuild(job, jenkinsCrumb, targetBranch, ghRelease)
if (options.job) {
assert(jenkinsJobs.includes(options.job), `Unknown CI job name: ${options.job}.`)
callJenkinsBuild(options.job, jenkinsCrumb, targetBranch, options)
} else {
jenkinsJobs.forEach((job) => {
callJenkinsBuild(job, jenkinsCrumb, targetBranch, ghRelease)
callJenkinsBuild(job, jenkinsCrumb, targetBranch, options)
})
}
}
@@ -144,15 +151,18 @@ async function callJenkins (path, requestParameters, requestHeaders) {
return jenkinsResponse
}
async function callJenkinsBuild (job, jenkinsCrumb, targetBranch, ghRelease) {
async function callJenkinsBuild (job, jenkinsCrumb, targetBranch, options) {
console.log(`Triggering Jenkins to run build job: ${job} on branch: ${targetBranch} with release flag.`)
let jenkinsParams = {
token: process.env.JENKINS_BUILD_TOKEN,
BRANCH: targetBranch
}
if (!ghRelease) {
if (!options.ghRelease) {
jenkinsParams.RUN_RELEASE_BUILD = 1
}
if (options.automaticRelease) {
jenkinsParams.AUTO_RELEASE = 'true'
}
await callJenkins(`job/${job}/buildWithParameters`, jenkinsParams, jenkinsCrumb)
.catch(err => {
console.log(`Error calling Jenkins build`, err)
@@ -177,33 +187,35 @@ function runRelease (targetBranch, options) {
if (options.ci) {
switch (options.ci) {
case 'CircleCI': {
buildCircleCI(targetBranch, options.ghRelease, options.job)
buildCircleCI(targetBranch, options)
break
}
case 'AppVeyor': {
buildAppVeyor(targetBranch, options.ghRelease)
buildAppVeyor(targetBranch, options)
break
}
case 'Jenkins': {
buildJenkins(targetBranch, options.ghRelease, options.job)
buildJenkins(targetBranch, options)
break
}
}
} else {
buildCircleCI(targetBranch, options.ghRelease, options.job)
buildAppVeyor(targetBranch, options.ghRelease)
buildJenkins(targetBranch, options.ghRelease, options.job)
buildCircleCI(targetBranch, options)
buildAppVeyor(targetBranch, options)
buildJenkins(targetBranch, options)
}
}
module.exports = runRelease
if (require.main === module) {
const args = require('minimist')(process.argv.slice(2), { boolean: 'ghRelease' })
const args = require('minimist')(process.argv.slice(2), {
boolean: ['ghRelease', 'automaticRelease']
})
const targetBranch = args._[0]
if (args._.length < 1) {
console.log(`Trigger CI to build release builds of electron.
Usage: ci-release-build.js [--job=CI_JOB_NAME] [--ci=CircleCI|AppVeyor|Jenkins] [--ghRelease] TARGET_BRANCH
Usage: ci-release-build.js [--job=CI_JOB_NAME] [--ci=CircleCI|AppVeyor|Jenkins] [--ghRelease] [--automaticRelease] TARGET_BRANCH
`)
process.exit(0)
}

View File

@@ -1,7 +1,9 @@
#!/usr/bin/env node
require('colors')
const args = require('minimist')(process.argv.slice(2))
const args = require('minimist')(process.argv.slice(2), {
boolean: ['automaticRelease', 'notesOnly', 'stable']
})
const assert = require('assert')
const ciReleaseBuild = require('./ci-release-build')
const { execSync } = require('child_process')
@@ -20,7 +22,7 @@ const versionType = args._[0]
assert(process.env.ELECTRON_GITHUB_TOKEN, 'ELECTRON_GITHUB_TOKEN not found in environment')
if (!versionType && !args.notesOnly) {
console.log(`Usage: prepare-release versionType [major | minor | patch | beta]` +
` (--stable) (--notesOnly)`)
` (--stable) (--notesOnly) (--automaticRelease)`)
process.exit(1)
}
@@ -76,7 +78,10 @@ async function getReleaseNotes (currentBranch) {
base: `v${pkg.version}`,
head: currentBranch
}
let releaseNotes = '(placeholder)\n'
let releaseNotes = ''
if (!args.automaticRelease) {
releaseNotes = '(placeholder)\n'
}
console.log(`Checking for commits from ${pkg.version} to ${currentBranch}`)
let commitComparison = await github.repos.compareCommits(githubOpts)
.catch(err => {
@@ -85,10 +90,21 @@ async function getReleaseNotes (currentBranch) {
process.exit(1)
})
if (commitComparison.data.commits.length === 0) {
console.log(`${pass} There are no commits from ${pkg.version} to ` +
`${currentBranch}, skipping release.`)
process.exit(0)
}
commitComparison.data.commits.forEach(commitEntry => {
let commitMessage = commitEntry.commit.message
if (commitMessage.toLowerCase().indexOf('merge') > -1) {
releaseNotes += `${commitMessage} \n`
let mergeRE = /Merge pull request (#\d+) from .*\n/
let prMatch = commitMessage.match(mergeRE)
commitMessage = commitMessage.replace(mergeRE, '').replace('\n', '')
if (commitMessage.substr(commitMessage.length - 1, commitMessage.length) !== '.') {
commitMessage += '.'
}
releaseNotes += `${commitMessage} ${prMatch[1]} \n\n`
}
})
console.log(`${pass} Done generating release notes for ${currentBranch}.`)
@@ -152,7 +168,8 @@ async function pushRelease () {
async function runReleaseBuilds (branch) {
await ciReleaseBuild(branch, {
ghRelease: true
ghRelease: true,
automaticRelease: args.automaticRelease
})
}
@@ -193,6 +210,11 @@ async function promptForVersion (version) {
}
async function prepareRelease (isBeta, notesOnly) {
if (args.automaticRelease && (pkg.version.indexOf('beta') === -1 ||
versionType !== 'beta')) {
console.log(`${fail} Automatic release is only supported for beta releases`)
process.exit(1)
}
let currentBranch = await getCurrentBranch(gitDir)
if (notesOnly) {
let releaseNotes = await getReleaseNotes(currentBranch)

View File

@@ -6,7 +6,6 @@ const assert = require('assert')
const fs = require('fs')
const { execSync } = require('child_process')
const GitHub = require('github')
const { GitProcess } = require('dugite')
const nugget = require('nugget')
const pkg = require('../package.json')
const pkgVersion = `v${pkg.version}`
@@ -24,7 +23,6 @@ const github = new GitHub({
followRedirects: false
})
github.authenticate({type: 'token', token: process.env.ELECTRON_GITHUB_TOKEN})
const gitDir = path.resolve(__dirname, '..')
async function getDraftRelease (version, skipValidation) {
let releaseInfo = await github.repos.getReleases({owner: 'electron', repo: 'electron'})
@@ -62,16 +60,18 @@ async function validateReleaseAssets (release, validatingRelease) {
})
check((failureCount === 0), `All required GitHub assets exist for release`, true)
if (release.draft) {
await verifyAssets(release)
} else {
await verifyShasums(downloadUrls)
.catch(err => {
console.log(`${fail} error verifyingShasums`, err)
})
if (!validatingRelease || !release.draft) {
if (release.draft) {
await verifyAssets(release)
} else {
await verifyShasums(downloadUrls)
.catch(err => {
console.log(`${fail} error verifyingShasums`, err)
})
}
const s3Urls = s3UrlsForVersion(release.tag_name)
await verifyShasums(s3Urls, true)
}
const s3Urls = s3UrlsForVersion(release.tag_name)
await verifyShasums(s3Urls, true)
}
function check (condition, statement, exitIfFail = false) {
@@ -148,7 +148,11 @@ function s3UrlsForVersion (version) {
function checkVersion () {
console.log(`Verifying that app version matches package version ${pkgVersion}.`)
let startScript = path.join(__dirname, 'start.py')
let appVersion = runScript(startScript, ['--version']).trim()
let scriptArgs = ['--version']
if (args.automaticRelease) {
scriptArgs.unshift('-R')
}
let appVersion = runScript(startScript, scriptArgs).trim()
check((pkgVersion.indexOf(appVersion) === 0), `App version ${appVersion} matches ` +
`package version ${pkgVersion}.`, true)
}
@@ -276,7 +280,6 @@ async function makeRelease (releaseToValidate) {
draftRelease = await getDraftRelease(pkgVersion, true)
await validateReleaseAssets(draftRelease)
await publishRelease(draftRelease)
await cleanupReleaseBranch()
console.log(`${pass} SUCCESS!!! Release has been published. Please run ` +
`"npm run publish-to-npm" to publish release to npm.`)
}
@@ -444,25 +447,4 @@ async function validateChecksums (validationArgs) {
`shasums defined in ${validationArgs.shaSumFile}.`)
}
async function cleanupReleaseBranch () {
console.log(`Cleaning up release branch.`)
let errorMessage = `Could not delete local release branch.`
let successMessage = `Successfully deleted local release branch.`
await callGit(['branch', '-D', 'release'], errorMessage, successMessage)
errorMessage = `Could not delete remote release branch.`
successMessage = `Successfully deleted remote release branch.`
return callGit(['push', 'origin', ':release'], errorMessage, successMessage)
}
async function callGit (args, errorMessage, successMessage) {
let gitResult = await GitProcess.exec(args, gitDir)
if (gitResult.exitCode === 0) {
console.log(`${pass} ${successMessage}`)
return true
} else {
console.log(`${fail} ${errorMessage} ${gitResult.stderr}`)
process.exit(1)
}
}
makeRelease(args.validateRelease)

View File

@@ -24,6 +24,7 @@ STAMP_FILE="${LLVM_DIR}/../llvm-build/cr_build_revision"
LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project}
CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang
S3_URL=https://s3.amazonaws.com/gh-contractor-zcbenz/clang
# Die if any command dies, error on undefined variable expansions.
@@ -49,7 +50,12 @@ CDS_FILE="clang-${PACKAGE_VERSION}.tgz"
CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX)
CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}"
if [ "${OS}" = "Linux" ]; then
CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}"
ARCH="$(uname -m)"
if [ "${ARCH}" = "aarch64" ]; then
CDS_FULL_URL="${S3_URL}/arm64/${CDS_FILE}"
else
CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}"
fi
elif [ "${OS}" = "Darwin" ]; then
CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}"
fi

View File

@@ -7,7 +7,7 @@ const path = require('path')
const {ipcRenderer, remote} = require('electron')
const {closeWindow} = require('./window-helpers')
const {app, BrowserWindow, ipcMain} = remote
const {app, BrowserWindow, Menu, ipcMain} = remote
const isCI = remote.getGlobal('isCi')
@@ -158,21 +158,23 @@ describe('app module', () => {
})
})
it('exits gracefully on macos', function (done) {
if (process.platform !== 'darwin') {
it('exits gracefully', function (done) {
if (!['darwin', 'linux'].includes(process.platform)) {
this.skip()
}
const appPath = path.join(__dirname, 'fixtures', 'api', 'singleton')
const electronPath = remote.getGlobal('process').execPath
const appPath = path.join(__dirname, 'fixtures', 'api', 'singleton')
appProcess = ChildProcess.spawn(electronPath, [appPath])
appProcess.stdout.once('data', () => {
// The apple script will try to terminate the app
// If there's an error terminating the app, then it will print to stderr
ChildProcess.exec('osascript -e \'quit app "Electron"\'', (err, stdout, stderr) => {
assert(!err)
assert(!stderr.trim())
done()
})
// Singleton will send us greeting data to let us know it's running.
// After that, ask it to exit gracefully and confirm that it does.
appProcess.stdout.on('data', (data) => appProcess.kill())
appProcess.on('exit', (code, sig) => {
let message = ['code:', code, 'sig:', sig].join('\n')
assert.equal(code, 0, message)
assert.equal(sig, null, message)
done()
})
})
})
@@ -881,4 +883,18 @@ describe('app module', () => {
}, /before app is ready/)
})
})
describe('dock.setMenu', () => {
before(function () {
if (process.platform !== 'darwin') {
this.skip()
}
})
it('keeps references to the menu', () => {
app.dock.setMenu(new Menu())
const v8Util = process.atomBinding('v8_util')
v8Util.requestGarbageCollectionForTesting()
})
})
})

View File

@@ -733,6 +733,12 @@ describe('BrowserWindow module', () => {
done()
})
})
it('throws when called on itself', () => {
assert.throws(() => {
w.addTabbedWindow(w)
}, /AddTabbedWindow cannot be called by a window on itself./)
})
})
describe('BrowserWindow.setVibrancy(type)', () => {

View File

@@ -18,17 +18,4 @@ describe('screen module', () => {
assert(display.size.height > 0)
})
})
describe('screen.getMenuBarHeight()', () => {
before(function () {
if (process.platform !== 'darwin') {
this.skip()
}
})
it('returns an integer', () => {
const screenHeight = screen.getMenuBarHeight()
assert.equal(typeof screenHeight, 'number')
})
})
})

View File

@@ -1,6 +1,8 @@
const {app} = require('electron')
console.log('started') // ping parent
app.once('ready', () => {
console.log('started') // ping parent
})
const shouldExit = app.makeSingleInstance(() => {
process.nextTick(() => app.exit(0))

View File

@@ -30,7 +30,8 @@ describe('modules support', () => {
describe('ffi', () => {
before(function () {
if (!nativeModulesEnabled || process.platform === 'win32') {
if (!nativeModulesEnabled || process.platform === 'win32' ||
process.arch === 'arm64') {
this.skip()
}
})

View File

@@ -51,7 +51,11 @@
if (!process.env.MOCHA_REPORTER) {
mocha.ui('bdd').reporter(isCi ? 'tap' : 'html')
}
mocha.timeout(isCi ? 30000 : 10000)
if (process.env.MOCHA_TIMEOUT && process.env.MOCHA_TIMEOUT > 0) {
mocha.timeout(process.env.MOCHA_TIMEOUT)
} else {
mocha.timeout(isCi ? 30000 : 10000)
}
const query = Mocha.utils.parseQuery(window.location.search || '')
if (query.grep) mocha.grep(query.grep)

View File

@@ -16,7 +16,7 @@ function getDate () {
function getInfoForCurrentVersion () {
var json = {}
json.version = process.versions['atom-shell']
json.version = process.versions.electron
json.date = getDate()
var names = ['node', 'v8', 'uv', 'zlib', 'openssl', 'modules', 'chrome']