Merge branch 'master' of https://github.com/GoooIce/electron
This commit is contained in:
commit
3ee854d9a3
51 changed files with 637 additions and 178 deletions
|
@ -13,6 +13,8 @@ Electron 프레임워크는 JavaScript, HTML 그리고 CSS를 사용하여 Cross
|
|||
|
||||
Electron에 대한 중요한 알림을 받고 싶다면 Twitter에서 [@ElectronJS](https://twitter.com/electronjs)를 팔로우 하세요.
|
||||
|
||||
이 프로젝트는 기여자 규약 1.2를 준수합니다. 이 프로젝트에 참여할 때 코드를 유지해야 합니다. 받아들일 수 없는 행동은 atom@github.com로 보고 하십시오.
|
||||
|
||||
## 다운로드
|
||||
|
||||
Linux, Windows, Mac용으로 미리 빌드된 Electron 바이너리와 디버그 심볼이 준비되어 있습니다. [releases](https://github.com/atom/electron/releases) 페이지에서 받아 볼 수 있습니다.
|
||||
|
|
16
README.md
16
README.md
|
@ -4,7 +4,7 @@
|
|||
[![devDependency Status](https://david-dm.org/atom/electron/dev-status.svg)](https://david-dm.org/atom/electron#info=devDependencies)
|
||||
[![Join the Electron Community on Slack](http://atom-slack.herokuapp.com/badge.svg)](http://atom-slack.herokuapp.com/)
|
||||
|
||||
:zap: *formerly known as Atom Shell* :zap:
|
||||
:zap: *Formerly known as Atom Shell* :zap:
|
||||
|
||||
The Electron framework lets you write cross-platform desktop applications
|
||||
using JavaScript, HTML and CSS. It is based on [io.js](http://iojs.org) and
|
||||
|
@ -15,7 +15,8 @@ Follow [@ElectronJS](https://twitter.com/electronjs) on Twitter for important
|
|||
announcements.
|
||||
|
||||
This project adheres to the [Contributor Covenant 1.2](http://contributor-covenant.org/version/1/2/0).
|
||||
By participating, you are expected to uphold this code. Please report unacceptable behavior to atom@github.com.
|
||||
By participating, you are expected to uphold this code. Please report
|
||||
unacceptable behavior to atom@github.com.
|
||||
|
||||
## Downloads
|
||||
|
||||
|
@ -54,7 +55,12 @@ contains documents describing how to build and contribute to Electron.
|
|||
|
||||
## Community
|
||||
|
||||
There is an [`electron` category on the Atom forums](http://discuss.atom.io/category/electron)
|
||||
as well as an `#atom-shell` channel on Freenode.
|
||||
You can ask questions and interact with the community in the following
|
||||
locations:
|
||||
- [`electron`](http://discuss.atom.io/category/electron) category on the Atom
|
||||
forums
|
||||
- `#atom-shell` channel on Freenode
|
||||
- [`Atom`](http://atom-slack.herokuapp.com/) channel on Slack
|
||||
|
||||
Check out [awesome-electron](https://github.com/sindresorhus/awesome-electron) for a community maintained list of useful example apps, tools and resources.
|
||||
Check out [awesome-electron](https://github.com/sindresorhus/awesome-electron)
|
||||
for a community maintained list of useful example apps, tools and resources.
|
||||
|
|
2
atom.gyp
2
atom.gyp
|
@ -4,7 +4,7 @@
|
|||
'product_name%': 'Electron',
|
||||
'company_name%': 'GitHub, Inc',
|
||||
'company_abbr%': 'github',
|
||||
'version%': '0.31.2',
|
||||
'version%': '0.32.1',
|
||||
},
|
||||
'includes': [
|
||||
'filenames.gypi',
|
||||
|
|
|
@ -38,7 +38,9 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
|
|||
#else
|
||||
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
|
||||
#endif // defined(DEBUG)
|
||||
#endif // defined(OS_WIN)
|
||||
#else // defined(OS_WIN)
|
||||
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
|
||||
#endif // !defined(OS_WIN)
|
||||
logging::InitLogging(settings);
|
||||
|
||||
// Logging with pid and timestamp.
|
||||
|
|
|
@ -78,7 +78,7 @@ class Cookies : public mate::Wrappable {
|
|||
// Must be called on IO thread.
|
||||
net::CookieStore* GetCookieStore();
|
||||
|
||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
|
||||
net::URLRequestContextGetter* request_context_getter_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Cookies);
|
||||
};
|
||||
|
|
|
@ -66,7 +66,7 @@ class Protocol : public mate::Wrappable {
|
|||
public:
|
||||
CustomProtocolHandler(
|
||||
v8::Isolate* isolate,
|
||||
scoped_refptr<net::URLRequestContextGetter> request_context,
|
||||
net::URLRequestContextGetter* request_context,
|
||||
const Handler& handler)
|
||||
: isolate_(isolate),
|
||||
request_context_(request_context),
|
||||
|
@ -83,7 +83,7 @@ class Protocol : public mate::Wrappable {
|
|||
|
||||
private:
|
||||
v8::Isolate* isolate_;
|
||||
scoped_refptr<net::URLRequestContextGetter> request_context_;
|
||||
net::URLRequestContextGetter* request_context_;
|
||||
Protocol::Handler handler_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CustomProtocolHandler);
|
||||
|
@ -172,7 +172,7 @@ class Protocol : public mate::Wrappable {
|
|||
// Convert error code to string.
|
||||
std::string ErrorCodeToString(ProtocolError error);
|
||||
|
||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
|
||||
net::URLRequestContextGetter* request_context_getter_;
|
||||
|
||||
// Map that stores the original protocols of schemes.
|
||||
using OriginalProtocolsMap = base::ScopedPtrHashMap<
|
||||
|
|
|
@ -388,7 +388,7 @@ void WebContents::DidFailProvisionalLoad(
|
|||
int error_code,
|
||||
const base::string16& error_description,
|
||||
bool was_ignored_by_handler) {
|
||||
Emit("did-fail-load", error_code, error_description);
|
||||
Emit("did-fail-load", error_code, error_description, validated_url);
|
||||
}
|
||||
|
||||
void WebContents::DidFailLoad(content::RenderFrameHost* render_frame_host,
|
||||
|
@ -396,7 +396,7 @@ void WebContents::DidFailLoad(content::RenderFrameHost* render_frame_host,
|
|||
int error_code,
|
||||
const base::string16& error_description,
|
||||
bool was_ignored_by_handler) {
|
||||
Emit("did-fail-load", error_code, error_description);
|
||||
Emit("did-fail-load", error_code, error_description, validated_url);
|
||||
}
|
||||
|
||||
void WebContents::DidStartLoading() {
|
||||
|
|
|
@ -70,14 +70,13 @@ Window::Window(v8::Isolate* isolate, const mate::Dictionary& options) {
|
|||
options.Get(switches::kWebPreferences, &web_preferences);
|
||||
|
||||
// Be compatible with old options which are now in web_preferences.
|
||||
std::string str;
|
||||
double d;
|
||||
if (options.Get(switches::kNodeIntegration, &str))
|
||||
web_preferences.Set(switches::kNodeIntegration, str);
|
||||
if (options.Get(switches::kPreloadScript, &str))
|
||||
web_preferences.Set(switches::kPreloadScript, str);
|
||||
if (options.Get(switches::kZoomFactor, &d))
|
||||
web_preferences.Set(switches::kZoomFactor, d);
|
||||
v8::Local<v8::Value> value;
|
||||
if (options.Get(switches::kNodeIntegration, &value))
|
||||
web_preferences.Set(switches::kNodeIntegration, value);
|
||||
if (options.Get(switches::kPreloadScript, &value))
|
||||
web_preferences.Set(switches::kPreloadScript, value);
|
||||
if (options.Get(switches::kZoomFactor, &value))
|
||||
web_preferences.Set(switches::kZoomFactor, value);
|
||||
|
||||
// Creates the WebContents used by BrowserWindow.
|
||||
auto web_contents = WebContents::Create(isolate, web_preferences);
|
||||
|
|
|
@ -39,8 +39,6 @@ AtomBrowserMainParts::AtomBrowserMainParts()
|
|||
}
|
||||
|
||||
AtomBrowserMainParts::~AtomBrowserMainParts() {
|
||||
for (const auto& callback : destruction_callbacks_)
|
||||
callback.Run();
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -118,4 +116,14 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() {
|
|||
#endif
|
||||
}
|
||||
|
||||
void AtomBrowserMainParts::PostMainMessageLoopRun() {
|
||||
brightray::BrowserMainParts::PostMainMessageLoopRun();
|
||||
|
||||
// Make sure destruction callbacks are called before message loop is
|
||||
// destroyed, otherwise some objects that need to be deleted on IO thread
|
||||
// won't be freed.
|
||||
for (const auto& callback : destruction_callbacks_)
|
||||
callback.Run();
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -41,6 +41,7 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
|
|||
// content::BrowserMainParts:
|
||||
void PostEarlyInitialization() override;
|
||||
void PreMainMessageLoopRun() override;
|
||||
void PostMainMessageLoopRun() override;
|
||||
#if defined(OS_MACOSX)
|
||||
void PreMainMessageLoopStart() override;
|
||||
void PostDestroyThreads() override;
|
||||
|
|
|
@ -46,7 +46,7 @@ class JsAsker : public RequestJob {
|
|||
// Called by |CustomProtocolHandler| to store handler related information.
|
||||
void SetHandlerInfo(
|
||||
v8::Isolate* isolate,
|
||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter,
|
||||
net::URLRequestContextGetter* request_context_getter,
|
||||
const JavaScriptHandler& handler) {
|
||||
isolate_ = isolate;
|
||||
request_context_getter_ = request_context_getter;
|
||||
|
@ -57,7 +57,7 @@ class JsAsker : public RequestJob {
|
|||
virtual void StartAsync(scoped_ptr<base::Value> options) = 0;
|
||||
|
||||
net::URLRequestContextGetter* request_context_getter() const {
|
||||
return request_context_getter_.get();
|
||||
return request_context_getter_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -89,7 +89,7 @@ class JsAsker : public RequestJob {
|
|||
}
|
||||
|
||||
v8::Isolate* isolate_;
|
||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
|
||||
net::URLRequestContextGetter* request_context_getter_;
|
||||
JavaScriptHandler handler_;
|
||||
|
||||
base::WeakPtrFactory<JsAsker> weak_factory_;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<key>CFBundleIconFile</key>
|
||||
<string>atom.icns</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.31.2</string>
|
||||
<string>0.32.1</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.8.0</string>
|
||||
<key>NSMainNibFile</key>
|
||||
|
|
|
@ -56,8 +56,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,31,2,0
|
||||
PRODUCTVERSION 0,31,2,0
|
||||
FILEVERSION 0,32,1,0
|
||||
PRODUCTVERSION 0,32,1,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -74,12 +74,12 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "GitHub, Inc."
|
||||
VALUE "FileDescription", "Electron"
|
||||
VALUE "FileVersion", "0.31.2"
|
||||
VALUE "FileVersion", "0.32.1"
|
||||
VALUE "InternalName", "electron.exe"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
|
||||
VALUE "OriginalFilename", "electron.exe"
|
||||
VALUE "ProductName", "Electron"
|
||||
VALUE "ProductVersion", "0.31.2"
|
||||
VALUE "ProductVersion", "0.32.1"
|
||||
VALUE "SquirrelAwareVersion", "1"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright (c) 2015 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/browser/web_view_constants.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
namespace web_view {
|
||||
|
||||
const char kPreloadUrl[] = "preloadUrl";
|
||||
const char kNodeIntegration[] = "nodeIntegration";
|
||||
const char kPlugins[] = "plugins";
|
||||
const char kDisableWebSecurity[] = "disableWebSecurity";
|
||||
const char kPartitionId[] = "partitionId";
|
||||
|
||||
const int kDefaultWidth = 300;
|
||||
const int kDefaultHeight = 300;
|
||||
|
||||
const char kWebViewInfoKeyName[] = "web_view_info";
|
||||
|
||||
} // namespace web_view
|
||||
|
||||
} // namespace atom
|
|
@ -1,27 +0,0 @@
|
|||
// Copyright (c) 2015 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_BROWSER_WEB_VIEW_CONSTANTS_H_
|
||||
#define ATOM_BROWSER_WEB_VIEW_CONSTANTS_H_
|
||||
|
||||
namespace atom {
|
||||
|
||||
namespace web_view {
|
||||
|
||||
extern const char kPreloadUrl[];
|
||||
extern const char kNodeIntegration[];
|
||||
extern const char kPlugins[];
|
||||
extern const char kDisableWebSecurity[];
|
||||
extern const char kPartitionId[];
|
||||
|
||||
extern const int kDefaultWidth;
|
||||
extern const int kDefaultHeight;
|
||||
|
||||
extern const char kWebViewInfoKeyName[];
|
||||
|
||||
} // namespace web_view
|
||||
|
||||
} // namespace atom
|
||||
|
||||
#endif // ATOM_BROWSER_WEB_VIEW_CONSTANTS_H_
|
|
@ -5,7 +5,6 @@
|
|||
#include "atom/browser/web_view_guest_delegate.h"
|
||||
|
||||
#include "atom/browser/api/atom_api_web_contents.h"
|
||||
#include "atom/browser/web_view_constants.h"
|
||||
#include "atom/common/native_mate_converters/gurl_converter.h"
|
||||
#include "content/public/browser/guest_host.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
|
@ -14,6 +13,13 @@
|
|||
|
||||
namespace atom {
|
||||
|
||||
namespace {
|
||||
|
||||
const int kDefaultWidth = 300;
|
||||
const int kDefaultHeight = 300;
|
||||
|
||||
} // namespace
|
||||
|
||||
WebViewGuestDelegate::WebViewGuestDelegate()
|
||||
: guest_opaque_(true),
|
||||
guest_host_(nullptr),
|
||||
|
@ -172,7 +178,7 @@ gfx::Size WebViewGuestDelegate::GetDefaultSize() const {
|
|||
return embedder_web_contents_->GetRenderWidgetHostView()
|
||||
->GetVisibleViewportSize();
|
||||
} else {
|
||||
return gfx::Size(web_view::kDefaultWidth, web_view::kDefaultHeight);
|
||||
return gfx::Size(kDefaultWidth, kDefaultHeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
#define ATOM_VERSION_H
|
||||
|
||||
#define ATOM_MAJOR_VERSION 0
|
||||
#define ATOM_MINOR_VERSION 31
|
||||
#define ATOM_PATCH_VERSION 2
|
||||
#define ATOM_MINOR_VERSION 32
|
||||
#define ATOM_PATCH_VERSION 1
|
||||
|
||||
#define ATOM_VERSION_IS_RELEASE 1
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ requestId = 0
|
|||
WEB_VIEW_EVENTS =
|
||||
'load-commit': ['url', 'isMainFrame']
|
||||
'did-finish-load': []
|
||||
'did-fail-load': ['errorCode', 'errorDescription']
|
||||
'did-fail-load': ['errorCode', 'errorDescription', 'validatedUrl']
|
||||
'did-frame-finish-load': ['isMainFrame']
|
||||
'did-start-loading': []
|
||||
'did-stop-loading': []
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
'xcode_settings': {
|
||||
'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
|
||||
'WARNING_CFLAGS': [
|
||||
'-Wno-unknown-warning-option',
|
||||
'-Wno-parentheses-equality',
|
||||
'-Wno-unused-function',
|
||||
'-Wno-sometimes-uninitialized',
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
## Guías
|
||||
|
||||
* [Distribución de aplicaciones](tutorial/application-distribution-es.md)
|
||||
* [Empaquetamiento de aplicaciones](tutorial/application-packaging-es.md)
|
||||
* [Utilizando módulos nativos](tutorial/using-native-node-modules-es.md)
|
||||
* [Depurando el proceso principal](tutorial/debugging-main-process-es.md)
|
||||
* [Utilizando Selenium y WebDriver](tutorial/using-selenium-and-webdriver-es.md)
|
||||
* [Extensión DevTools](tutorial/devtools-extension-es.md)
|
||||
* [Utilizando el plugin pepper flash](tutorial/using-pepper-flash-plugin-es.md)
|
||||
|
||||
## Tutoriales
|
||||
|
||||
* [Introducción](tutorial/quick-start.md)
|
||||
* [Integración con el entorno de escritorio](tutorial/desktop-environment-integration.md)
|
||||
* [Detección del evento en línea/fuera de línea](tutorial/online-offline-events.md)
|
||||
|
||||
## API
|
||||
|
||||
* [Sinopsis](api/synopsis.md)
|
||||
* [Proceso](api/process.md)
|
||||
* [Parámetros CLI soportados (Chrome)](api/chrome-command-line-switches.md)
|
||||
|
||||
Elementos DOM customizados:
|
||||
|
||||
* [Objeto `File`](api/file-object.md)
|
||||
* [Etiqueta `<webview>`](api/web-view-tag.md)
|
||||
* [Función `window.open`](api/window-open.md)
|
||||
|
||||
Módulos del proceso principal:
|
||||
|
||||
* [app](api/app.md)
|
||||
* [auto-updater](api/auto-updater.md)
|
||||
* [browser-window](api/browser-window.md)
|
||||
* [content-tracing](api/content-tracing.md)
|
||||
* [dialog](api/dialog.md)
|
||||
* [global-shortcut](api/global-shortcut.md)
|
||||
* [ipc (main process)](api/ipc-main-process.md)
|
||||
* [menu](api/menu.md)
|
||||
* [menu-item](api/menu-item.md)
|
||||
* [power-monitor](api/power-monitor.md)
|
||||
* [power-save-blocker](api/power-save-blocker.md)
|
||||
* [protocol](api/protocol.md)
|
||||
* [tray](api/tray.md)
|
||||
|
||||
Módulos del renderer (página web):
|
||||
|
||||
* [ipc (renderer)](api/ipc-renderer.md)
|
||||
* [remote](api/remote.md)
|
||||
* [web-frame](api/web-frame.md)
|
||||
|
||||
Módulos de ambos procesos:
|
||||
|
||||
* [clipboard](api/clipboard.md)
|
||||
* [crash-reporter](api/crash-reporter.md)
|
||||
* [native-image](api/native-image.md)
|
||||
* [screen](api/screen.md)
|
||||
* [shell](api/shell.md)
|
||||
|
||||
## Desarrollo
|
||||
|
||||
* [Guía de estilo](development/coding-style.md)
|
||||
* [Estructura de directorio](development/source-code-directory-structure.md)
|
||||
* [Diferencias técnicas con NW.js (anteriormente conocido como node-webkit)](development/atom-shell-vs-node-webkit.md)
|
||||
* [Sistema de compilación](development/build-system-overview.md)
|
||||
* [Instrucciones de compilación (Mac)](development/build-instructions-osx.md)
|
||||
* [Instrucciones de compilación (Windows)](development/build-instructions-windows.md)
|
||||
* [Instrucciones de compilación (Linux)](development/build-instructions-linux.md)
|
||||
* [Configurando un servidor de símbolos en el depurador](development/setting-up-symbol-server.md)
|
68
docs-translations/es/README.md
Normal file
68
docs-translations/es/README.md
Normal file
|
@ -0,0 +1,68 @@
|
|||
## Guías
|
||||
|
||||
* [Distribución de aplicaciones](tutorial/application-distribution.md)
|
||||
* [Empaquetamiento de aplicaciones](tutorial/application-packaging.md)
|
||||
* [Utilizando módulos nativos](tutorial/using-native-node-modules.md)
|
||||
* [Depurando el proceso principal](tutorial/debugging-main-process.md)
|
||||
* [Utilizando Selenium y WebDriver](tutorial/using-selenium-and-webdriver.md)
|
||||
* [Extensión DevTools](tutorial/devtools-extension.md)
|
||||
* [Utilizando el plugin pepper flash](tutorial/using-pepper-flash-plugin.md)
|
||||
|
||||
## Tutoriales
|
||||
|
||||
* [Introducción](../../docs/tutorial/quick-start.md)
|
||||
* [Integración con el entorno de escritorio](../../docs/tutorial/desktop-environment-integration.md)
|
||||
* [Detección del evento en línea/fuera de línea](../../docs/tutorial/online-offline-events.md)
|
||||
|
||||
## API
|
||||
|
||||
* [Sinopsis](../../docs/api/synopsis.md)
|
||||
* [Proceso](../../docs/api/process.md)
|
||||
* [Parámetros CLI soportados (Chrome)](../../docs/api/chrome-command-line-switches.md)
|
||||
|
||||
Elementos DOM customizados:
|
||||
|
||||
* [Objeto `File`](../../docs/api/file-object.md)
|
||||
* [Etiqueta `<webview>`](../../docs/api/web-view-tag.md)
|
||||
* [Función `window.open`](../../docs/api/window-open.md)
|
||||
|
||||
Módulos del proceso principal:
|
||||
|
||||
* [app](../../docs/api/app.md)
|
||||
* [auto-updater](../../docs/api/auto-updater.md)
|
||||
* [browser-window](../../docs/api/browser-window.md)
|
||||
* [content-tracing](../../docs/api/content-tracing.md)
|
||||
* [dialog](../../docs/api/dialog.md)
|
||||
* [global-shortcut](../../docs/api/global-shortcut.md)
|
||||
* [ipc (main process)](../../docs/api/ipc-main-process.md)
|
||||
* [menu](../../docs/api/menu.md)
|
||||
* [menu-item](../../docs/api/menu-item.md)
|
||||
* [power-monitor](../../docs/api/power-monitor.md)
|
||||
* [power-save-blocker](../../docs/api/power-save-blocker.md)
|
||||
* [protocol](../../docs/api/protocol.md)
|
||||
* [tray](../../docs/api/tray.md)
|
||||
|
||||
Módulos del renderer (página web):
|
||||
|
||||
* [ipc (renderer)](../../docs/api/ipc-renderer.md)
|
||||
* [remote](../../docs/api/remote.md)
|
||||
* [web-frame](../../docs/api/web-frame.md)
|
||||
|
||||
Módulos de ambos procesos:
|
||||
|
||||
* [clipboard](../../docs/api/clipboard.md)
|
||||
* [crash-reporter](../../docs/api/crash-reporter.md)
|
||||
* [native-image](../../docs/api/native-image.md)
|
||||
* [screen](../../docs/api/screen.md)
|
||||
* [shell](../../docs/api/shell.md)
|
||||
|
||||
## Desarrollo
|
||||
|
||||
* [Guía de estilo](../../docs/development/coding-style.md)
|
||||
* [Estructura de directorio](../../docs/development/source-code-directory-structure.md)
|
||||
* [Diferencias técnicas con NW.js (anteriormente conocido como node-webkit)](../../docs/development/atom-shell-vs-node-webkit.md)
|
||||
* [Sistema de compilación](../../docs/development/build-system-overview.md)
|
||||
* [Instrucciones de compilación (Mac)](../../docs/development/build-instructions-osx.md)
|
||||
* [Instrucciones de compilación (Windows)](../../docs/development/build-instructions-windows.md)
|
||||
* [Instrucciones de compilación (Linux)](../../docs/development/build-instructions-linux.md)
|
||||
* [Configurando un servidor de símbolos en el depurador](../../docs/development/setting-up-symbol-server.md)
|
|
@ -125,14 +125,14 @@
|
|||
<webview src="http://electron.atom.io" partition="electron"></webview>
|
||||
```
|
||||
|
||||
`webview`에서 사용하는 스토리지 파티션을 지정합니다.
|
||||
스토리지 파티션 ID를 `persist:`로 시작하도록 지정하면 앱의 모든 `webview`에서 지정한 스토리지 파티션 ID를 사용하도록 할 수 있습니다.
|
||||
만약 `persist:` 접두사가 없을 경우 `webview`는 인 메모리 스토리지 파티션을 사용합니다.
|
||||
여러 `webview`에서 같은 파티션 ID를 사용하면 같은 스토리지 파티션을 공유합니다.
|
||||
만약 스토리지 파티션 ID가 지정되지 않으면 앱의 기본 스토리지를 사용합니다.
|
||||
페이지에서 사용하는 세션을 설정합니다.
|
||||
만약 `partition` 속성이 `persist:` 접두사를 시작하면 같은 `partition` 속성을 가진 앱 내 모든 페이지가 공유하는 영구 세션을 사용합니다.
|
||||
`persist:` 접두사가 없을 경우 페이지는 인 메모리 세션을 사용합니다.
|
||||
동일한 `partition`을 지정하여 다중 페이지에서 동일한 세션을 공유할 수 있도록 할 수 있습니다.
|
||||
만약 `partition`이 지정되지 않으면 앱의 기본 세션을 사용합니다.
|
||||
|
||||
이 값은 첫 탐색 이전에만 지정할 수 있습니다.
|
||||
즉. 작동중인 랜더러 프로세스의 스토리지 파티션은 변경할 수 없습니다.
|
||||
즉. 작동중인 랜더러 프로세스의 세션은 변경할 수 없습니다.
|
||||
이후 이 값을 바꾸려고 시도하면 DOM 예외를 발생시킵니다.
|
||||
|
||||
## Methods
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## Guias
|
||||
|
||||
* [Distribuir Aplicação](../../docs/tutorial/application-distribution.md)
|
||||
* [Empacotamento da aplicação](../../docs/tutorial/application-packaging.md)
|
||||
* [Distribuir Aplicação](tutorial/application-distribution.md)
|
||||
* [Empacotamento da aplicação](tutorial/application-packaging.md)
|
||||
* [Usando módulos nativos](../../docs/tutorial/using-native-node-modules.md)
|
||||
* [Depuração do processo principal](../../docs/tutorial/debugging-main-process.md)
|
||||
* [Usando Selenium e WebDriver](../../docs/tutorial/using-selenium-and-webdriver.md)
|
118
docs-translations/pt-BR/tutorial/application-distribution.md
Normal file
118
docs-translations/pt-BR/tutorial/application-distribution.md
Normal file
|
@ -0,0 +1,118 @@
|
|||
# Distribuição de aplicações
|
||||
|
||||
Para distribuir sua aplicação com o Electron, você deve nomear o diretório que contém sua aplicação como
|
||||
`app` e dentro deste diretório colocar os recursos que você está utilizando (no OSX
|
||||
`Electron.app/Contents/Resources/`,
|
||||
no Linux e no Windows é em `resources/`):
|
||||
|
||||
No OSX:
|
||||
|
||||
```text
|
||||
electron/Electron.app/Contents/Resources/app/
|
||||
├── package.json
|
||||
├── main.js
|
||||
└── index.html
|
||||
```
|
||||
|
||||
No Windows e Linux:
|
||||
|
||||
```text
|
||||
electron/resources/app
|
||||
├── package.json
|
||||
├── main.js
|
||||
└── index.html
|
||||
```
|
||||
|
||||
Logo após execute `Electron.app` (ou `electron` no Linux e `electron.exe` no Windows),
|
||||
e o Electron iniciaria a aplicação. O diretório `electron` será utilizado para criar a distribuição para
|
||||
usuários finais.
|
||||
|
||||
## Empacotando sua aplicação em um arquivo.
|
||||
|
||||
Além de copiar todos os seus arquivos fontes para a distribuição, você também pode
|
||||
empacotar seu aplicativo em um arquivo [asar](https://github.com/atom/asar) para evitar
|
||||
de expor seu código fonte aos usuários finais.
|
||||
|
||||
Para usar um arquivo `asar` ao invés da pasta `app` você precisa mudar o nome do
|
||||
arquivo para `app.asar` e colocá-lo sob o diretório de recursos do Electron como
|
||||
mostrado abaixo, então o Electron vai ler o arquivo e iniciar a aplicação a partir dele.
|
||||
|
||||
No OSX:
|
||||
|
||||
```text
|
||||
electron/Electron.app/Contents/Resources/
|
||||
└── app.asar
|
||||
```
|
||||
|
||||
No Windows e Linux:
|
||||
|
||||
```text
|
||||
electron/resources/
|
||||
└── app.asar
|
||||
```
|
||||
|
||||
Mais detalhes podem ser encontrados em [Empacotamento da aplicação](../../../docs/tutorial/application-packaging.md).
|
||||
|
||||
## Renomeando a marca Electron na sua distribuição
|
||||
|
||||
Depois de empacotar seu aplicativo Electron, você vai querer renomear a marca Electron
|
||||
antes de distribuí-lo aos usuários.
|
||||
|
||||
### Janelas
|
||||
|
||||
Você pode renomear `electron.exe` para o nome que desejar e editar o seu ícone e outras
|
||||
informações com ferramentas como [rcedit](https://github.com/atom/rcedit) ou
|
||||
[ResEdit](http://www.resedit.net).
|
||||
|
||||
### OS X
|
||||
|
||||
Você pode renomear `Electron.app` para o nome que desejar e também pode mudar o nome
|
||||
do `CFBundleDisplayName`, `CFBundleIdentifier` e os campos em `CFBundleName`
|
||||
nos seguinte arquivos:
|
||||
|
||||
* `Electron.app/Contents/Info.plist`
|
||||
* `Electron.app/Contents/frameworks/Electron Helper.app/Contents/Info.plist`
|
||||
|
||||
Você também pode renomear o arquivo de ajuda para evitar a exibição de `Electron Helper` no
|
||||
Monitor de Atividades, mas certifique-se de também renomear o arquivo de ajuda no executável do
|
||||
aplicativo.
|
||||
|
||||
A estrutura de uma aplicação renomada seria assim:
|
||||
|
||||
```
|
||||
MyApp.app/Contents
|
||||
├── Info.plist
|
||||
├── MacOS/
|
||||
│ └── MyApp
|
||||
└── Frameworks/
|
||||
├── MyApp Helper EH.app
|
||||
| ├── Info.plist
|
||||
| └── MacOS/
|
||||
| └── MyApp Helper EH
|
||||
├── MyApp Helper NP.app
|
||||
| ├── Info.plist
|
||||
| └── MacOS/
|
||||
| └── MyApp Helper NP
|
||||
└── MyApp Helper.app
|
||||
├── Info.plist
|
||||
└── MacOS/
|
||||
└── MyApp Helper
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
Você pode renomear o executável `electron` para o nome que desejar.
|
||||
|
||||
## Renomeando a marca Electron do código fonte.
|
||||
|
||||
Também é possível fazer renomear a marca Electron do código fonte, alterando o nome do produto e
|
||||
reconstruí-lo a partir da fonte, para fazer isso você precisa modificar o arquivo `atom.gyp`.
|
||||
|
||||
### grunt-build-atom-shell
|
||||
|
||||
A modificação do código fonte do Electron para ganhar a sua marca pode ser muito complexa, por isso,
|
||||
uma tarefa para o Grunt foi criado e irá cuidar desta tarefa automaticamente para você:
|
||||
[grunt-build-atom-shell](https://github.com/paulcbetts/grunt-build-atom-shell).
|
||||
|
||||
Esta tarefa irá automaticamente editar o arquivo `.gyp`, compilar o código
|
||||
e reconstruir os módulos nativos da aplicação para utilizar o novo nome.
|
158
docs-translations/pt-BR/tutorial/application-packaging.md
Normal file
158
docs-translations/pt-BR/tutorial/application-packaging.md
Normal file
|
@ -0,0 +1,158 @@
|
|||
# Empacotamento da aplicação
|
||||
|
||||
Para proteger os recursos e o código fonte da sua aplicação você pode optar por
|
||||
empacotar a sua aplicação em um arquivo [asar](https://github.com/atom/asar), isto é possível com poucas
|
||||
alterações em seu código.
|
||||
|
||||
## Gerando um arquivo `asar`
|
||||
|
||||
Um arquivo [asar][asar] é um formato parecido com tar ou zip bem simples que concatena arquivos
|
||||
em um único arquivo. O Electron pode ler arquivos arbitrários a partir dele sem descompacatar
|
||||
o arquivo inteiro.
|
||||
|
||||
Passos para empacotar a sua aplicação em um arquivo `asar`:
|
||||
|
||||
### 1. Instale o utilitário asar
|
||||
|
||||
```bash
|
||||
$ npm install -g asar
|
||||
```
|
||||
|
||||
### 2. Empacote a sua aplicação
|
||||
|
||||
```bash
|
||||
$ asar pack your-app app.asar
|
||||
```
|
||||
|
||||
## Usando arquivos `asar`
|
||||
|
||||
No Electron existem dois conjuntos de APIs: Node APIs fornecidas pelo Node.js e Web
|
||||
APIs fornecidas pelo Chromium. Ambas as APIs suportam a leitura de arquivos `asar`.
|
||||
|
||||
### Node API
|
||||
|
||||
As API's do Node como `fs.readFile` e `require` tratam os pacotes `asar`
|
||||
como diretórios virtuais e os arquivos dentro dele como arquivos normais.
|
||||
|
||||
Por exemplo, temos um arquivo `example.asar` sob `/path/to`:
|
||||
|
||||
```bash
|
||||
$ asar list /path/to/example.asar
|
||||
/app.js
|
||||
/file.txt
|
||||
/dir/module.js
|
||||
/static/index.html
|
||||
/static/main.css
|
||||
/static/jquery.min.js
|
||||
```
|
||||
|
||||
Lendo um arquivo em pacote `asar`:
|
||||
|
||||
```javascript
|
||||
var fs = require('fs');
|
||||
fs.readFileSync('/path/to/example.asar/file.txt');
|
||||
```
|
||||
|
||||
Listando todos os arquivos a partir da raiz:
|
||||
|
||||
```javascript
|
||||
var fs = require('fs');
|
||||
fs.readdirSync('/path/to/example.asar');
|
||||
```
|
||||
|
||||
Utilizando um módulo dentro do pacote `asar`:
|
||||
|
||||
```javascript
|
||||
require('/path/to/example.asar/dir/module.js');
|
||||
```
|
||||
|
||||
Você também pode renderizar uma página web apartir de um arquivo `asar` utilizando o módulo `BrowserWindow`:
|
||||
|
||||
```javascript
|
||||
var BrowserWindow = require('browser-window');
|
||||
var win = new BrowserWindow({width: 800, height: 600});
|
||||
win.loadUrl('file:///path/to/example.asar/static/index.html');
|
||||
```
|
||||
|
||||
### API Web
|
||||
|
||||
Em uma página web, arquivos em um pacote `asar` pode ser solicitado com o protocolo `file:`.
|
||||
Como a API Node, arquivos `asar` são tratadas como diretórios.
|
||||
|
||||
Por exemplo, para obter um arquivo com `$ .get`:
|
||||
|
||||
```html
|
||||
<script>
|
||||
var $ = require('./jquery.min.js');
|
||||
$.get('file:///path/to/example.asar/file.txt', function(data) {
|
||||
console.log(data);
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
### Tratando um pacote `asar` como um arquivo normal
|
||||
|
||||
Para alguns casos, precisamos verificar o checksum de um pacote `asar`, para fazer isto, precisamos ler
|
||||
o arquivo `asar` como um arquivo normal. Para isto, você pode usar o built-in
|
||||
`original-fs` que fornece a API `fs`, sem apoio a arquivos asar`:
|
||||
|
||||
```javascript
|
||||
var originalFs = require('original-fs');
|
||||
originalFs.readFileSync('/path/to/example.asar');
|
||||
```
|
||||
|
||||
## Limitaçõs na API Node
|
||||
|
||||
Mesmo fazendo grandes esforços para pacotes `asar` ser tratado no Node como diretórios,
|
||||
ainda existem limitações devido a natureza de baixo nível do Node
|
||||
|
||||
### Arquivos `asar` são somente leitura
|
||||
|
||||
Os arquivos `asar` não podem ser modificados.
|
||||
|
||||
### Diretório de trabalho não pode ser comportar como diretório de arquivos
|
||||
|
||||
Embora pacotes `asar` são tratadas como diretórios, não há
|
||||
diretórios reais no sistema de arquivos, assim você nunca pode definir o diretório de trabalho para
|
||||
diretórios em pacotes `asar`, passando-os como a opção `cwd` de algumas APIs
|
||||
também irá causar erros.
|
||||
|
||||
### Descompactação extra em algumas APIs
|
||||
|
||||
A maioria das APIs `fs` pode ler um arquivo ou obter informações de um arquivo a partir de pacotes `asar`
|
||||
sem descompacta-lo, mas para algumas APIs da rota real o Electron irá extrair o arquivo necessário para um
|
||||
arquivo temporário e passar o caminho do arquivo temporário para as APIs,
|
||||
isso adiciona um pouco de sobrecarga para essas APIs.
|
||||
|
||||
APIs que requer descompactação extras são:
|
||||
|
||||
* `child_process.execFile`
|
||||
* `fs.open`
|
||||
* `fs.openSync`
|
||||
* `process.dlopen` - Usado por `require` em módulos nativos
|
||||
|
||||
### Falsas informações de status do módulo `fs.stat`
|
||||
|
||||
O objeto `Stats` retornado por` fs.stat` e outras funções relacionadas não são informações confiáveis,
|
||||
você não deve confiar no objeto `Stats` exceto para obter o
|
||||
tamanho do arquivo e verificação de tipo de arquivo.
|
||||
|
||||
## Adicionando arquivos em um pacote `asar`
|
||||
|
||||
Como dito acima, algumas APIs deo Node irá descompactar o arquivo para quando o filesystem
|
||||
requsistar, além dos problemas de desempenho, ele também pode levar a falsos alertas
|
||||
de vírus.
|
||||
|
||||
Para contornar isso, você pode descompactar alguns arquivos usando a
|
||||
opção `--unpack`, um exemplo de exclusão de bibliotecas compartilhadas de módulos nativos
|
||||
é:
|
||||
|
||||
```bash
|
||||
$ asar pack app app.asar --unpack *.node
|
||||
```
|
||||
|
||||
Depois de executar o comando, além do `app.asar`, há também
|
||||
`app.asar.unpacked` pasta gerada que contém os arquivos descompactados, você
|
||||
deve copiá-lo juntamente com `app.asar` quando enviá-lo para os usuários.
|
||||
|
||||
Mais informações no repositório [asar](https://github.com/atom/asar)
|
28
docs-translations/zh-TW/api/file-object.md
Normal file
28
docs-translations/zh-TW/api/file-object.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
# `File` object
|
||||
|
||||
DOM's File 介面提供一個將本地文件抽象化,並可以讓使用者對本地文件直接使用 HTML5 檔案 API
|
||||
Electron 可以添加一個 `path` 屬性至 `File` 接口進而顯示檔案在檔案系統內的真實路徑。
|
||||
|
||||
範例,獲得一個檔案之真實路徑,將檔案拖拉至應用程式 (dragged-onto-the-app):
|
||||
|
||||
```html
|
||||
<div id="holder">
|
||||
Drag your file here
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var holder = document.getElementById('holder');
|
||||
holder.ondragover = function () {
|
||||
return false;
|
||||
};
|
||||
holder.ondragleave = holder.ondragend = function () {
|
||||
return false;
|
||||
};
|
||||
holder.ondrop = function (e) {
|
||||
e.preventDefault();
|
||||
var file = e.dataTransfer.files[0];
|
||||
console.log('File you dragged here is', file.path);
|
||||
return false;
|
||||
};
|
||||
</script>
|
||||
```
|
36
docs-translations/zh-TW/api/power-monitor.md
Normal file
36
docs-translations/zh-TW/api/power-monitor.md
Normal file
|
@ -0,0 +1,36 @@
|
|||
# power-monitor
|
||||
|
||||
`power-monitor` 模組用來監看電源狀態的改變。你只能在主行程 (main process) 裡面使用。
|
||||
你應該要等到 `ready` 在 `app` 模組裡的事件被觸發 (emit),再使用這個模組。
|
||||
|
||||
舉例來說:
|
||||
|
||||
```javascript
|
||||
var app = require('app');
|
||||
|
||||
app.on('ready', function() {
|
||||
require('power-monitor').on('suspend', function() {
|
||||
console.log('The system is going to sleep');
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## 事件 (Events)
|
||||
|
||||
`power-monitor` 模組會觸發 (emits) 以下幾個事件:
|
||||
|
||||
### 事件: 'suspend'
|
||||
|
||||
當系統進入 睡眠 (suspend) 時觸發。
|
||||
|
||||
### 事件: 'resume'
|
||||
|
||||
當系統 resume 時觸發。
|
||||
|
||||
### 事件: 'on-ac'
|
||||
|
||||
當系統改變使用交流電源 (AC) 時觸發。
|
||||
|
||||
### 事件: 'on-battery'
|
||||
|
||||
當系統改變使用電池店員時觸發。
|
47
docs-translations/zh-TW/api/power-save-blocker.md
Normal file
47
docs-translations/zh-TW/api/power-save-blocker.md
Normal file
|
@ -0,0 +1,47 @@
|
|||
# powerSaveBlocker
|
||||
|
||||
`power-save-blocker` 模組是用來防止系統進入省電模式 low-power (sleep) mode
|
||||
因此讓應用程式可以保持系統和螢幕的活躍 (active)。
|
||||
|
||||
舉例來說:
|
||||
|
||||
```javascript
|
||||
var powerSaveBlocker = require('power-save-blocker');
|
||||
|
||||
var id = powerSaveBlocker.start('prevent-display-sleep');
|
||||
console.log(powerSaveBlocker.isStarted(id));
|
||||
|
||||
powerSaveBlocker.stop(id);
|
||||
```
|
||||
|
||||
## 方法 (Methods)
|
||||
|
||||
`power-save-blocker` 模組有以下幾個方法:
|
||||
|
||||
### `powerSaveBlocker.start(type)`
|
||||
|
||||
* `type` String - Power save blocker type.
|
||||
* `prevent-app-suspension` - 防止一個應用程式進入睡眠 (suspended)。 將保持系統活躍,
|
||||
但允許螢幕被關閉。 使用案例:下載一個檔案或是播放音樂。
|
||||
* `prevent-display-sleep`- 防止螢幕進入睡眠。將保持系統和螢幕的活躍。
|
||||
使用案例:播放影片
|
||||
|
||||
當防止系統進入省電模式 low-power (sleep) mode 。 會回傳一個識別的整數來代表 power save blocker
|
||||
|
||||
**注意:** `prevent-display-sleep` 比 `prevent-app-suspension` 擁有較高的優先權。
|
||||
只有高的優先全力才會有效,換句話說 `prevent-display-sleep` 總是會優先於 `prevent-app-suspension`
|
||||
|
||||
例如,一個 API 呼叫 A 請求去做 `prevent-app-suspension`,而另外一個 B 請求去做 `prevent-display-sleep`
|
||||
`prevent-display-sleep` 將會被使用,直到 B 停止他的請求,`prevent-app-suspension` 才會被使用。
|
||||
|
||||
### `powerSaveBlocker.stop(id)`
|
||||
|
||||
* `id` Integer - power save blocker 會回傳 id 透過 `powerSaveBlocker.start`.
|
||||
|
||||
將指定的 id 停止 power save blocker
|
||||
|
||||
### `powerSaveBlocker.isStarted(id)`
|
||||
|
||||
* `id` Integer - power save blocker 會回傳 id 透過 `powerSaveBlocker.start`.
|
||||
|
||||
不管對應的 `powerSaveBlocker` 是否已經啟動,將會回傳一個布林值 (boolean)
|
23
docs-translations/zh-TW/api/process.md
Normal file
23
docs-translations/zh-TW/api/process.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
# process
|
||||
|
||||
在 Electron 裡的 `process` 物件具有以下幾個與 upstream node 的不同點:
|
||||
|
||||
* `process.type` String - Process 的型態,可以是 `browser` (i.e. 主行程) 或 `renderer`.
|
||||
* `process.versions['electron']` String - Electron 的版本
|
||||
* `process.versions['chrome']` String - Chromium 的版本
|
||||
* `process.resourcesPath` String - JavaScript 源碼的路徑
|
||||
|
||||
# 方法 (Methods)
|
||||
|
||||
`process` 物件具有以下的方法:
|
||||
|
||||
### `process.hang`
|
||||
|
||||
會導致目前行程的主執行緒停住
|
||||
|
||||
## process.setFdLimit(maxDescriptors) _OS X_ _Linux_
|
||||
|
||||
* `maxDescriptors` Integer
|
||||
|
||||
設置文件描述符 (file descriptor) soft limit `maxDescriptors` 或 OS hard
|
||||
limit ,以較低者為準當目前的行程。
|
41
docs-translations/zh-TW/api/synopsis.md
Normal file
41
docs-translations/zh-TW/api/synopsis.md
Normal file
|
@ -0,0 +1,41 @@
|
|||
# Synopsis
|
||||
|
||||
所有的 [Node.js's 內建模組](http://nodejs.org/api/) 都可以在 Electron 使用,而且
|
||||
第三方的 node 模組同樣的全部支援(包含[原生模組](../tutorial/using-native-node-modules.md))
|
||||
|
||||
Electron 也提供一些額外的內建模組用來開發原生桌面應用程式,一些模組只可以使用在主行程上
|
||||
(main process) 一些只可以使用在渲染行程 (renderer process) 上 (網頁) ,另外還有一些
|
||||
模組在兩邊的行程都可以使用。
|
||||
|
||||
基本的規則是: 如果一個模組是 [GUI](https://zh.wikipedia.org/wiki/%E5%9B%BE%E5%BD%A2%E7%94%A8%E6%88%B7%E7%95%8C%E9%9D%A2)
|
||||
或者是 low-level 與系統相關的,那麼它就應該只能在主行程上使用 (main process) 你必須要對熟悉 [main process vs. renderer process](../tutorial/quick-start.md#the-main-process) 的觀念,才能去使用這些模組。
|
||||
|
||||
主行程 (main process) 腳本是一個像一般 Node.js 的腳本:
|
||||
|
||||
```javascript
|
||||
var app = require('app');
|
||||
var BrowserWindow = require('browser-window');
|
||||
|
||||
var window = null;
|
||||
|
||||
app.on('ready', function() {
|
||||
window = new BrowserWindow({width: 800, height: 600});
|
||||
window.loadUrl('https://github.com');
|
||||
});
|
||||
```
|
||||
|
||||
渲染行程 (renderer process) 跟一般正常的網頁沒有差別,而且還能有使用 node 模組的能力:
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
var remote = require('remote');
|
||||
console.log(remote.require('app').getVersion());
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
執行你的應用程式,請閱讀[Run your app](../tutorial/quick-start.md#run-your-app).
|
|
@ -32,6 +32,7 @@ Returns:
|
|||
* `event` Event
|
||||
* `errorCode` Integer
|
||||
* `errorDescription` String
|
||||
* `validatedUrl` String
|
||||
|
||||
This event is like `did-finish-load` but emitted when the load failed or was
|
||||
cancelled, e.g. `window.stop()` is invoked.
|
||||
|
|
|
@ -384,6 +384,7 @@ Returns:
|
|||
|
||||
* `errorCode` Integer
|
||||
* `errorDescription` String
|
||||
* `validatedUrl` String
|
||||
|
||||
This event is like `did-finish-load`, but fired when the load failed or was
|
||||
cancelled, e.g. `window.stop()` is invoked.
|
||||
|
|
|
@ -230,8 +230,6 @@
|
|||
'atom/browser/web_contents_preferences.h',
|
||||
'atom/browser/web_dialog_helper.cc',
|
||||
'atom/browser/web_dialog_helper.h',
|
||||
'atom/browser/web_view_constants.cc',
|
||||
'atom/browser/web_view_constants.h',
|
||||
'atom/browser/web_view_guest_delegate.cc',
|
||||
'atom/browser/web_view_guest_delegate.h',
|
||||
'atom/browser/web_view_manager.cc',
|
||||
|
|
|
@ -162,13 +162,16 @@ def create_chrome_version_h():
|
|||
version = f.read()
|
||||
with open(template_file, 'r') as f:
|
||||
template = f.read()
|
||||
if sys.platform in ['win32', 'cygwin']:
|
||||
open_mode = 'wb+'
|
||||
else:
|
||||
open_mode = 'w+'
|
||||
with open(target_file, open_mode) as f:
|
||||
content = template.replace('{PLACEHOLDER}', version.strip())
|
||||
if f.read() != content:
|
||||
content = template.replace('{PLACEHOLDER}', version.strip())
|
||||
|
||||
# We update the file only if the content has changed (ignoring line ending
|
||||
# differences).
|
||||
should_write = True
|
||||
if os.path.isfile(target_file):
|
||||
with open(target_file, 'r') as f:
|
||||
should_write = f.read().replace('r', '') != content.replace('r', '')
|
||||
if should_write:
|
||||
with open(target_file, 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
|
||||
|
|
|
@ -36,11 +36,20 @@ describe 'chromium feature', ->
|
|||
|
||||
describe 'window.open', ->
|
||||
it 'returns a BrowserWindowProxy object', ->
|
||||
b = window.open 'about:blank', 'test', 'show=no'
|
||||
b = window.open 'about:blank', '', 'show=no'
|
||||
assert.equal b.closed, false
|
||||
assert.equal b.constructor.name, 'BrowserWindowProxy'
|
||||
b.close()
|
||||
|
||||
it 'accepts "node-integration" as feature', (done) ->
|
||||
listener = (event) ->
|
||||
window.removeEventListener 'message', listener
|
||||
b.close()
|
||||
assert.equal event.data, 'undefined'
|
||||
done()
|
||||
window.addEventListener 'message', listener
|
||||
b = window.open "file://#{fixtures}/pages/window-opener-node.html", '', 'node-integration=no,show=no'
|
||||
|
||||
describe 'window.opener', ->
|
||||
ipc = remote.require 'ipc'
|
||||
url = "file://#{fixtures}/pages/window-opener.html"
|
||||
|
@ -58,19 +67,21 @@ describe 'chromium feature', ->
|
|||
w.loadUrl url
|
||||
|
||||
it 'is not null for window opened by window.open', (done) ->
|
||||
b = window.open url, 'test2', 'show=no'
|
||||
b = window.open url, '', 'show=no'
|
||||
ipc.on 'opener', (event, opener) ->
|
||||
b.close()
|
||||
done(if opener isnt null then undefined else opener)
|
||||
|
||||
describe 'window.opener.postMessage', ->
|
||||
it 'sets source and origin correctly', (done) ->
|
||||
b = window.open "file://#{fixtures}/pages/window-opener-postMessage.html", 'test', 'show=no'
|
||||
window.addEventListener 'message', (event) ->
|
||||
listener = (event) ->
|
||||
window.removeEventListener 'message', listener
|
||||
b.close()
|
||||
assert.equal event.source.guestId, b.guestId
|
||||
assert.equal event.origin, 'file://'
|
||||
done()
|
||||
window.addEventListener 'message', listener
|
||||
b = window.open "file://#{fixtures}/pages/window-opener-postMessage.html", '', 'show=no'
|
||||
|
||||
describe 'creating a Uint8Array under browser side', ->
|
||||
it 'does not crash', ->
|
||||
|
|
7
spec/fixtures/pages/window-opener-node.html
vendored
Normal file
7
spec/fixtures/pages/window-opener-node.html
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
<html>
|
||||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
window.opener.postMessage(typeof process, '*')
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -133,3 +133,11 @@ describe 'node feature', ->
|
|||
b = new Buffer(p.innerText)
|
||||
assert.equal b.toString(), 'Jøhänñéß'
|
||||
assert.equal Buffer.byteLength(p.innerText), 13
|
||||
|
||||
describe 'process.stdout', ->
|
||||
it 'should not throw exception', ->
|
||||
process.stdout
|
||||
|
||||
# Not reliable on some machines
|
||||
xit 'should have isTTY defined', ->
|
||||
assert.equal typeof(process.stdout.isTTY), 'boolean'
|
||||
|
|
|
@ -10,6 +10,11 @@ process.port = 0; // will be used by crash-reporter spec.
|
|||
app.commandLine.appendSwitch('js-flags', '--expose_gc');
|
||||
app.commandLine.appendSwitch('ignore-certificate-errors');
|
||||
|
||||
// Accessing stdout in the main process will result in the process.stdout
|
||||
// throwing UnknownSystemError in renderer process sometimes. This line makes
|
||||
// sure we can reproduce it in renderer process.
|
||||
process.stdout;
|
||||
|
||||
ipc.on('message', function(event, arg) {
|
||||
event.sender.send('message', arg);
|
||||
});
|
||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 8d64120b51b48be46eaa419957b965c0ccfc6c8f
|
||||
Subproject commit 9b3695cfd5c48a4cdc90e84a863851001ce8dd10
|
2
vendor/node
vendored
2
vendor/node
vendored
|
@ -1 +1 @@
|
|||
Subproject commit c8962e460f3bf03d405489a8380a5571730f5f8d
|
||||
Subproject commit 9da7dd871c313d318bc1447a83ba3c7618bbbc18
|
Loading…
Reference in a new issue