Merge remote-tracking branch 'atom/master'
This commit is contained in:
commit
ce8eb4a32c
42 changed files with 281 additions and 53 deletions
2
atom.gyp
2
atom.gyp
|
@ -4,7 +4,7 @@
|
||||||
'product_name%': 'Electron',
|
'product_name%': 'Electron',
|
||||||
'company_name%': 'GitHub, Inc',
|
'company_name%': 'GitHub, Inc',
|
||||||
'company_abbr%': 'github',
|
'company_abbr%': 'github',
|
||||||
'version%': '0.32.2',
|
'version%': '0.32.3',
|
||||||
},
|
},
|
||||||
'includes': [
|
'includes': [
|
||||||
'filenames.gypi',
|
'filenames.gypi',
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "atom/common/atom_version.h"
|
||||||
#include "atom/common/chrome_version.h"
|
#include "atom/common/chrome_version.h"
|
||||||
#include "atom/common/options_switches.h"
|
#include "atom/common/options_switches.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
|
@ -14,6 +15,7 @@
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "content/public/common/content_constants.h"
|
#include "content/public/common/content_constants.h"
|
||||||
#include "content/public/common/pepper_plugin_info.h"
|
#include "content/public/common/pepper_plugin_info.h"
|
||||||
|
#include "content/public/common/user_agent.h"
|
||||||
#include "ppapi/shared_impl/ppapi_permissions.h"
|
#include "ppapi/shared_impl/ppapi_permissions.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
@ -72,6 +74,12 @@ std::string AtomContentClient::GetProduct() const {
|
||||||
return "Chrome/" CHROME_VERSION_STRING;
|
return "Chrome/" CHROME_VERSION_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string AtomContentClient::GetUserAgent() const {
|
||||||
|
return content::BuildUserAgentFromProduct(
|
||||||
|
"Chrome/" CHROME_VERSION_STRING " "
|
||||||
|
ATOM_PRODUCT_NAME "/" ATOM_VERSION_STRING);
|
||||||
|
}
|
||||||
|
|
||||||
void AtomContentClient::AddAdditionalSchemes(
|
void AtomContentClient::AddAdditionalSchemes(
|
||||||
std::vector<std::string>* standard_schemes,
|
std::vector<std::string>* standard_schemes,
|
||||||
std::vector<std::string>* savable_schemes) {
|
std::vector<std::string>* savable_schemes) {
|
||||||
|
|
|
@ -20,6 +20,7 @@ class AtomContentClient : public brightray::ContentClient {
|
||||||
protected:
|
protected:
|
||||||
// content::ContentClient:
|
// content::ContentClient:
|
||||||
std::string GetProduct() const override;
|
std::string GetProduct() const override;
|
||||||
|
std::string GetUserAgent() const override;
|
||||||
void AddAdditionalSchemes(
|
void AddAdditionalSchemes(
|
||||||
std::vector<std::string>* standard_schemes,
|
std::vector<std::string>* standard_schemes,
|
||||||
std::vector<std::string>* savable_schemes) override;
|
std::vector<std::string>* savable_schemes) override;
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "native_mate/dictionary.h"
|
#include "native_mate/dictionary.h"
|
||||||
#include "native_mate/object_template_builder.h"
|
#include "native_mate/object_template_builder.h"
|
||||||
#include "net/ssl/ssl_cert_request_info.h"
|
#include "net/ssl/ssl_cert_request_info.h"
|
||||||
|
#include "ui/base/l10n/l10n_util.h"
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
@ -167,8 +168,8 @@ void App::OnOpenURL(const std::string& url) {
|
||||||
Emit("open-url", url);
|
Emit("open-url", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::OnActivateWithNoOpenWindows() {
|
void App::OnActivate(bool has_visible_windows) {
|
||||||
Emit("activate-with-no-open-windows");
|
Emit("activate", has_visible_windows);
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::OnWillFinishLaunching() {
|
void App::OnWillFinishLaunching() {
|
||||||
|
@ -248,6 +249,10 @@ void App::SetAppUserModelId(const std::string& app_id) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string App::GetLocale() {
|
||||||
|
return l10n_util::GetApplicationLocale("");
|
||||||
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> App::DefaultSession(v8::Isolate* isolate) {
|
v8::Local<v8::Value> App::DefaultSession(v8::Isolate* isolate) {
|
||||||
if (default_session_.IsEmpty())
|
if (default_session_.IsEmpty())
|
||||||
return v8::Null(isolate);
|
return v8::Null(isolate);
|
||||||
|
@ -278,6 +283,7 @@ mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
|
||||||
.SetMethod("getPath", &App::GetPath)
|
.SetMethod("getPath", &App::GetPath)
|
||||||
.SetMethod("setDesktopName", &App::SetDesktopName)
|
.SetMethod("setDesktopName", &App::SetDesktopName)
|
||||||
.SetMethod("setAppUserModelId", &App::SetAppUserModelId)
|
.SetMethod("setAppUserModelId", &App::SetAppUserModelId)
|
||||||
|
.SetMethod("getLocale", &App::GetLocale)
|
||||||
.SetProperty("defaultSession", &App::DefaultSession);
|
.SetProperty("defaultSession", &App::DefaultSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ class App : public mate::EventEmitter,
|
||||||
void OnQuit() override;
|
void OnQuit() override;
|
||||||
void OnOpenFile(bool* prevent_default, const std::string& file_path) override;
|
void OnOpenFile(bool* prevent_default, const std::string& file_path) override;
|
||||||
void OnOpenURL(const std::string& url) override;
|
void OnOpenURL(const std::string& url) override;
|
||||||
void OnActivateWithNoOpenWindows() override;
|
void OnActivate(bool has_visible_windows) override;
|
||||||
void OnWillFinishLaunching() override;
|
void OnWillFinishLaunching() override;
|
||||||
void OnFinishLaunching() override;
|
void OnFinishLaunching() override;
|
||||||
void OnSelectCertificate(
|
void OnSelectCertificate(
|
||||||
|
@ -65,6 +65,7 @@ class App : public mate::EventEmitter,
|
||||||
|
|
||||||
void SetDesktopName(const std::string& desktop_name);
|
void SetDesktopName(const std::string& desktop_name);
|
||||||
void SetAppUserModelId(const std::string& app_id);
|
void SetAppUserModelId(const std::string& app_id);
|
||||||
|
std::string GetLocale();
|
||||||
v8::Local<v8::Value> DefaultSession(v8::Isolate* isolate);
|
v8::Local<v8::Value> DefaultSession(v8::Isolate* isolate);
|
||||||
|
|
||||||
v8::Global<v8::Value> default_session_;
|
v8::Global<v8::Value> default_session_;
|
||||||
|
|
|
@ -547,6 +547,10 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
|
||||||
web_contents()->GetController().LoadURLWithParams(params);
|
web_contents()->GetController().LoadURLWithParams(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GURL WebContents::GetURL() const {
|
||||||
|
return web_contents()->GetURL();
|
||||||
|
}
|
||||||
|
|
||||||
base::string16 WebContents::GetTitle() const {
|
base::string16 WebContents::GetTitle() const {
|
||||||
return web_contents()->GetTitle();
|
return web_contents()->GetTitle();
|
||||||
}
|
}
|
||||||
|
@ -815,6 +819,7 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
|
||||||
.SetMethod("getId", &WebContents::GetID)
|
.SetMethod("getId", &WebContents::GetID)
|
||||||
.SetMethod("equal", &WebContents::Equal)
|
.SetMethod("equal", &WebContents::Equal)
|
||||||
.SetMethod("_loadUrl", &WebContents::LoadURL)
|
.SetMethod("_loadUrl", &WebContents::LoadURL)
|
||||||
|
.SetMethod("_getUrl", &WebContents::GetURL)
|
||||||
.SetMethod("getTitle", &WebContents::GetTitle)
|
.SetMethod("getTitle", &WebContents::GetTitle)
|
||||||
.SetMethod("isLoading", &WebContents::IsLoading)
|
.SetMethod("isLoading", &WebContents::IsLoading)
|
||||||
.SetMethod("isWaitingForResponse", &WebContents::IsWaitingForResponse)
|
.SetMethod("isWaitingForResponse", &WebContents::IsWaitingForResponse)
|
||||||
|
|
|
@ -55,6 +55,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
int GetID() const;
|
int GetID() const;
|
||||||
bool Equal(const WebContents* web_contents) const;
|
bool Equal(const WebContents* web_contents) const;
|
||||||
void LoadURL(const GURL& url, const mate::Dictionary& options);
|
void LoadURL(const GURL& url, const mate::Dictionary& options);
|
||||||
|
GURL GetURL() const;
|
||||||
base::string16 GetTitle() const;
|
base::string16 GetTitle() const;
|
||||||
bool IsLoading() const;
|
bool IsLoading() const;
|
||||||
bool IsWaitingForResponse() const;
|
bool IsWaitingForResponse() const;
|
||||||
|
|
|
@ -183,21 +183,21 @@ void Window::OnDevToolsFocus() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::OnDevToolsOpened() {
|
void Window::OnDevToolsOpened() {
|
||||||
Emit("devtools-opened");
|
|
||||||
|
|
||||||
v8::Locker locker(isolate());
|
v8::Locker locker(isolate());
|
||||||
v8::HandleScope handle_scope(isolate());
|
v8::HandleScope handle_scope(isolate());
|
||||||
auto handle = WebContents::CreateFrom(
|
auto handle = WebContents::CreateFrom(
|
||||||
isolate(), api_web_contents_->GetDevToolsWebContents());
|
isolate(), api_web_contents_->GetDevToolsWebContents());
|
||||||
devtools_web_contents_.Reset(isolate(), handle.ToV8());
|
devtools_web_contents_.Reset(isolate(), handle.ToV8());
|
||||||
|
|
||||||
|
Emit("devtools-opened");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::OnDevToolsClosed() {
|
void Window::OnDevToolsClosed() {
|
||||||
Emit("devtools-closed");
|
|
||||||
|
|
||||||
v8::Locker locker(isolate());
|
v8::Locker locker(isolate());
|
||||||
v8::HandleScope handle_scope(isolate());
|
v8::HandleScope handle_scope(isolate());
|
||||||
devtools_web_contents_.Reset();
|
devtools_web_contents_.Reset();
|
||||||
|
|
||||||
|
Emit("devtools-closed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::OnExecuteWindowsCommand(const std::string& command_name) {
|
void Window::OnExecuteWindowsCommand(const std::string& command_name) {
|
||||||
|
@ -414,6 +414,10 @@ bool Window::IsWebViewFocused() {
|
||||||
return window_->IsWebViewFocused();
|
return window_->IsWebViewFocused();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Window::IsDevToolsFocused() {
|
||||||
|
return window_->IsDevToolsFocused();
|
||||||
|
}
|
||||||
|
|
||||||
void Window::SetRepresentedFilename(const std::string& filename) {
|
void Window::SetRepresentedFilename(const std::string& filename) {
|
||||||
window_->SetRepresentedFilename(filename);
|
window_->SetRepresentedFilename(filename);
|
||||||
}
|
}
|
||||||
|
@ -591,6 +595,7 @@ void Window::BuildPrototype(v8::Isolate* isolate,
|
||||||
.SetMethod("focusOnWebView", &Window::FocusOnWebView)
|
.SetMethod("focusOnWebView", &Window::FocusOnWebView)
|
||||||
.SetMethod("blurWebView", &Window::BlurWebView)
|
.SetMethod("blurWebView", &Window::BlurWebView)
|
||||||
.SetMethod("isWebViewFocused", &Window::IsWebViewFocused)
|
.SetMethod("isWebViewFocused", &Window::IsWebViewFocused)
|
||||||
|
.SetMethod("isDevToolsFocused", &Window::IsDevToolsFocused)
|
||||||
.SetMethod("capturePage", &Window::CapturePage)
|
.SetMethod("capturePage", &Window::CapturePage)
|
||||||
.SetMethod("setProgressBar", &Window::SetProgressBar)
|
.SetMethod("setProgressBar", &Window::SetProgressBar)
|
||||||
.SetMethod("setOverlayIcon", &Window::SetOverlayIcon)
|
.SetMethod("setOverlayIcon", &Window::SetOverlayIcon)
|
||||||
|
|
|
@ -124,6 +124,7 @@ class Window : public mate::TrackableObject<Window>,
|
||||||
void FocusOnWebView();
|
void FocusOnWebView();
|
||||||
void BlurWebView();
|
void BlurWebView();
|
||||||
bool IsWebViewFocused();
|
bool IsWebViewFocused();
|
||||||
|
bool IsDevToolsFocused();
|
||||||
void SetRepresentedFilename(const std::string& filename);
|
void SetRepresentedFilename(const std::string& filename);
|
||||||
std::string GetRepresentedFilename();
|
std::string GetRepresentedFilename();
|
||||||
void SetDocumentEdited(bool edited);
|
void SetDocumentEdited(bool edited);
|
||||||
|
|
|
@ -45,6 +45,7 @@ app.getHomeDir = -> @getPath 'home'
|
||||||
app.getDataPath = -> @getPath 'userData'
|
app.getDataPath = -> @getPath 'userData'
|
||||||
app.setDataPath = (path) -> @setPath 'userData', path
|
app.setDataPath = (path) -> @setPath 'userData', path
|
||||||
app.resolveProxy = -> @defaultSession.resolveProxy.apply @defaultSession, arguments
|
app.resolveProxy = -> @defaultSession.resolveProxy.apply @defaultSession, arguments
|
||||||
|
app.on 'activate', (event, hasVisibleWindows) -> @emit 'activate-with-no-open-windows' if not hasVisibleWindows
|
||||||
|
|
||||||
# Session wrapper.
|
# Session wrapper.
|
||||||
sessionBindings._setWrapSession wrapSession
|
sessionBindings._setWrapSession wrapSession
|
||||||
|
|
|
@ -16,6 +16,11 @@ class NavigationController
|
||||||
constructor: (@webContents) ->
|
constructor: (@webContents) ->
|
||||||
@clearHistory()
|
@clearHistory()
|
||||||
|
|
||||||
|
# webContents may have already navigated to a page.
|
||||||
|
if @webContents._getUrl()
|
||||||
|
@currentIndex++
|
||||||
|
@history.push @webContents._getUrl()
|
||||||
|
|
||||||
@webContents.on 'navigation-entry-commited', (event, url, inPage, replaceEntry) =>
|
@webContents.on 'navigation-entry-commited', (event, url, inPage, replaceEntry) =>
|
||||||
if @inPageIndex > -1 and not inPage
|
if @inPageIndex > -1 and not inPage
|
||||||
# Navigated to a new page, clear in-page mark.
|
# Navigated to a new page, clear in-page mark.
|
||||||
|
|
|
@ -44,10 +44,8 @@ wrapWebContents = (webContents) ->
|
||||||
|
|
||||||
# Make sure webContents.executeJavaScript would run the code only when the
|
# Make sure webContents.executeJavaScript would run the code only when the
|
||||||
# web contents has been loaded.
|
# web contents has been loaded.
|
||||||
webContents.loaded = false
|
|
||||||
webContents.once 'did-finish-load', -> @loaded = true
|
|
||||||
webContents.executeJavaScript = (code, hasUserGesture=false) ->
|
webContents.executeJavaScript = (code, hasUserGesture=false) ->
|
||||||
if @loaded
|
if @getUrl() and not @isLoading()
|
||||||
@_executeJavaScript code, hasUserGesture
|
@_executeJavaScript code, hasUserGesture
|
||||||
else
|
else
|
||||||
webContents.once 'did-finish-load', @_executeJavaScript.bind(this, code, hasUserGesture)
|
webContents.once 'did-finish-load', @_executeJavaScript.bind(this, code, hasUserGesture)
|
||||||
|
|
|
@ -94,8 +94,10 @@ void Browser::OpenURL(const std::string& url) {
|
||||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnOpenURL(url));
|
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnOpenURL(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::ActivateWithNoOpenWindows() {
|
void Browser::Activate(bool has_visible_windows) {
|
||||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnActivateWithNoOpenWindows());
|
FOR_EACH_OBSERVER(BrowserObserver,
|
||||||
|
observers_,
|
||||||
|
OnActivate(has_visible_windows));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::WillFinishLaunching() {
|
void Browser::WillFinishLaunching() {
|
||||||
|
|
|
@ -108,8 +108,9 @@ class Browser : public WindowListObserver {
|
||||||
// Tell the application to open a url.
|
// Tell the application to open a url.
|
||||||
void OpenURL(const std::string& url);
|
void OpenURL(const std::string& url);
|
||||||
|
|
||||||
// Tell the application that application is activated with no open windows.
|
// Tell the application that application is activated with visible/invisible
|
||||||
void ActivateWithNoOpenWindows();
|
// windows.
|
||||||
|
void Activate(bool has_visible_windows);
|
||||||
|
|
||||||
// Tell the application the loading has been done.
|
// Tell the application the loading has been done.
|
||||||
void WillFinishLaunching();
|
void WillFinishLaunching();
|
||||||
|
|
|
@ -43,9 +43,9 @@ class BrowserObserver {
|
||||||
// Browser is used to open a url.
|
// Browser is used to open a url.
|
||||||
virtual void OnOpenURL(const std::string& url) {}
|
virtual void OnOpenURL(const std::string& url) {}
|
||||||
|
|
||||||
// The browser is activated with no open windows (usually by clicking on the
|
// The browser is activated with visible/invisible windows (usually by
|
||||||
// dock icon).
|
// clicking on the dock icon).
|
||||||
virtual void OnActivateWithNoOpenWindows() {}
|
virtual void OnActivate(bool has_visible_windows) {}
|
||||||
|
|
||||||
// The browser has finished loading.
|
// The browser has finished loading.
|
||||||
virtual void OnWillFinishLaunching() {}
|
virtual void OnWillFinishLaunching() {}
|
||||||
|
|
|
@ -32,6 +32,7 @@ getExtensionInfoFromPath = (srcDirectory) ->
|
||||||
startPage: page
|
startPage: page
|
||||||
name: manifest.name
|
name: manifest.name
|
||||||
srcDirectory: srcDirectory
|
srcDirectory: srcDirectory
|
||||||
|
exposeExperimentalAPIs: true
|
||||||
extensionInfoMap[manifest.name]
|
extensionInfoMap[manifest.name]
|
||||||
|
|
||||||
# The loaded extensions cache and its persistent path.
|
# The loaded extensions cache and its persistent path.
|
||||||
|
|
|
@ -52,12 +52,8 @@
|
||||||
- (BOOL)applicationShouldHandleReopen:(NSApplication*)theApplication
|
- (BOOL)applicationShouldHandleReopen:(NSApplication*)theApplication
|
||||||
hasVisibleWindows:(BOOL)flag {
|
hasVisibleWindows:(BOOL)flag {
|
||||||
atom::Browser* browser = atom::Browser::Get();
|
atom::Browser* browser = atom::Browser::Get();
|
||||||
if (flag) {
|
browser->Activate(static_cast<bool>(flag));
|
||||||
return YES;
|
return flag;
|
||||||
} else {
|
|
||||||
browser->ActivateWithNoOpenWindows();
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -249,6 +249,10 @@ bool NativeWindow::IsWebViewFocused() {
|
||||||
return host_view && host_view->HasFocus();
|
return host_view && host_view->HasFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NativeWindow::IsDevToolsFocused() {
|
||||||
|
return inspectable_web_contents_->GetView()->IsDevToolsViewFocused();
|
||||||
|
}
|
||||||
|
|
||||||
void NativeWindow::CapturePage(const gfx::Rect& rect,
|
void NativeWindow::CapturePage(const gfx::Rect& rect,
|
||||||
const CapturePageCallback& callback) {
|
const CapturePageCallback& callback) {
|
||||||
const auto view = web_contents()->GetRenderWidgetHostView();
|
const auto view = web_contents()->GetRenderWidgetHostView();
|
||||||
|
|
|
@ -148,6 +148,7 @@ class NativeWindow : public content::WebContentsObserver,
|
||||||
virtual void FocusOnWebView();
|
virtual void FocusOnWebView();
|
||||||
virtual void BlurWebView();
|
virtual void BlurWebView();
|
||||||
virtual bool IsWebViewFocused();
|
virtual bool IsWebViewFocused();
|
||||||
|
virtual bool IsDevToolsFocused();
|
||||||
|
|
||||||
// Captures the page with |rect|, |callback| would be called when capturing is
|
// Captures the page with |rect|, |callback| would be called when capturing is
|
||||||
// done.
|
// done.
|
||||||
|
|
|
@ -6,13 +6,15 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "net/base/net_errors.h"
|
#include "net/base/net_errors.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
URLRequestBufferJob::URLRequestBufferJob(
|
URLRequestBufferJob::URLRequestBufferJob(
|
||||||
net::URLRequest* request, net::NetworkDelegate* network_delegate)
|
net::URLRequest* request, net::NetworkDelegate* network_delegate)
|
||||||
: JsAsker<net::URLRequestSimpleJob>(request, network_delegate) {
|
: JsAsker<net::URLRequestSimpleJob>(request, network_delegate),
|
||||||
|
status_code_(net::HTTP_NOT_IMPLEMENTED) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void URLRequestBufferJob::StartAsync(scoped_ptr<base::Value> options) {
|
void URLRequestBufferJob::StartAsync(scoped_ptr<base::Value> options) {
|
||||||
|
@ -36,9 +38,28 @@ void URLRequestBufferJob::StartAsync(scoped_ptr<base::Value> options) {
|
||||||
data_ = new base::RefCountedBytes(
|
data_ = new base::RefCountedBytes(
|
||||||
reinterpret_cast<const unsigned char*>(binary->GetBuffer()),
|
reinterpret_cast<const unsigned char*>(binary->GetBuffer()),
|
||||||
binary->GetSize());
|
binary->GetSize());
|
||||||
|
status_code_ = net::HTTP_OK;
|
||||||
net::URLRequestSimpleJob::Start();
|
net::URLRequestSimpleJob::Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void URLRequestBufferJob::GetResponseInfo(net::HttpResponseInfo* info) {
|
||||||
|
std::string status("HTTP/1.1 ");
|
||||||
|
status.append(base::IntToString(status_code_));
|
||||||
|
status.append(" ");
|
||||||
|
status.append(net::GetHttpReasonPhrase(status_code_));
|
||||||
|
status.append("\0\0", 2);
|
||||||
|
net::HttpResponseHeaders* headers = new net::HttpResponseHeaders(status);
|
||||||
|
|
||||||
|
if (!mime_type_.empty()) {
|
||||||
|
std::string content_type_header(net::HttpRequestHeaders::kContentType);
|
||||||
|
content_type_header.append(": ");
|
||||||
|
content_type_header.append(mime_type_);
|
||||||
|
headers->AddHeader(content_type_header);
|
||||||
|
}
|
||||||
|
|
||||||
|
info->headers = headers;
|
||||||
|
}
|
||||||
|
|
||||||
int URLRequestBufferJob::GetRefCountedData(
|
int URLRequestBufferJob::GetRefCountedData(
|
||||||
std::string* mime_type,
|
std::string* mime_type,
|
||||||
std::string* charset,
|
std::string* charset,
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "atom/browser/net/js_asker.h"
|
#include "atom/browser/net/js_asker.h"
|
||||||
#include "base/memory/ref_counted_memory.h"
|
#include "base/memory/ref_counted_memory.h"
|
||||||
|
#include "net/http/http_status_code.h"
|
||||||
#include "net/url_request/url_request_simple_job.h"
|
#include "net/url_request/url_request_simple_job.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
@ -20,6 +21,9 @@ class URLRequestBufferJob : public JsAsker<net::URLRequestSimpleJob> {
|
||||||
// JsAsker:
|
// JsAsker:
|
||||||
void StartAsync(scoped_ptr<base::Value> options) override;
|
void StartAsync(scoped_ptr<base::Value> options) override;
|
||||||
|
|
||||||
|
// URLRequestJob:
|
||||||
|
void GetResponseInfo(net::HttpResponseInfo* info) override;
|
||||||
|
|
||||||
// URLRequestSimpleJob:
|
// URLRequestSimpleJob:
|
||||||
int GetRefCountedData(std::string* mime_type,
|
int GetRefCountedData(std::string* mime_type,
|
||||||
std::string* charset,
|
std::string* charset,
|
||||||
|
@ -30,6 +34,7 @@ class URLRequestBufferJob : public JsAsker<net::URLRequestSimpleJob> {
|
||||||
std::string mime_type_;
|
std::string mime_type_;
|
||||||
std::string charset_;
|
std::string charset_;
|
||||||
scoped_refptr<base::RefCountedBytes> data_;
|
scoped_refptr<base::RefCountedBytes> data_;
|
||||||
|
net::HttpStatusCode status_code_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(URLRequestBufferJob);
|
DISALLOW_COPY_AND_ASSIGN(URLRequestBufferJob);
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,6 +28,20 @@ void URLRequestStringJob::StartAsync(scoped_ptr<base::Value> options) {
|
||||||
net::URLRequestSimpleJob::Start();
|
net::URLRequestSimpleJob::Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void URLRequestStringJob::GetResponseInfo(net::HttpResponseInfo* info) {
|
||||||
|
std::string status("HTTP/1.1 200 OK");
|
||||||
|
net::HttpResponseHeaders* headers = new net::HttpResponseHeaders(status);
|
||||||
|
|
||||||
|
if (!mime_type_.empty()) {
|
||||||
|
std::string content_type_header(net::HttpRequestHeaders::kContentType);
|
||||||
|
content_type_header.append(": ");
|
||||||
|
content_type_header.append(mime_type_);
|
||||||
|
headers->AddHeader(content_type_header);
|
||||||
|
}
|
||||||
|
|
||||||
|
info->headers = headers;
|
||||||
|
}
|
||||||
|
|
||||||
int URLRequestStringJob::GetData(
|
int URLRequestStringJob::GetData(
|
||||||
std::string* mime_type,
|
std::string* mime_type,
|
||||||
std::string* charset,
|
std::string* charset,
|
||||||
|
|
|
@ -19,6 +19,9 @@ class URLRequestStringJob : public JsAsker<net::URLRequestSimpleJob> {
|
||||||
// JsAsker:
|
// JsAsker:
|
||||||
void StartAsync(scoped_ptr<base::Value> options) override;
|
void StartAsync(scoped_ptr<base::Value> options) override;
|
||||||
|
|
||||||
|
// URLRequestJob:
|
||||||
|
void GetResponseInfo(net::HttpResponseInfo* info) override;
|
||||||
|
|
||||||
// URLRequestSimpleJob:
|
// URLRequestSimpleJob:
|
||||||
int GetData(std::string* mime_type,
|
int GetData(std::string* mime_type,
|
||||||
std::string* charset,
|
std::string* charset,
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string>atom.icns</string>
|
<string>atom.icns</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>0.32.2</string>
|
<string>0.32.3</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>10.8.0</string>
|
<string>10.8.0</string>
|
||||||
<key>NSMainNibFile</key>
|
<key>NSMainNibFile</key>
|
||||||
|
|
|
@ -56,8 +56,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 0,32,2,0
|
FILEVERSION 0,32,3,0
|
||||||
PRODUCTVERSION 0,32,2,0
|
PRODUCTVERSION 0,32,3,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -74,12 +74,12 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "GitHub, Inc."
|
VALUE "CompanyName", "GitHub, Inc."
|
||||||
VALUE "FileDescription", "Electron"
|
VALUE "FileDescription", "Electron"
|
||||||
VALUE "FileVersion", "0.32.2"
|
VALUE "FileVersion", "0.32.3"
|
||||||
VALUE "InternalName", "electron.exe"
|
VALUE "InternalName", "electron.exe"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
|
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
|
||||||
VALUE "OriginalFilename", "electron.exe"
|
VALUE "OriginalFilename", "electron.exe"
|
||||||
VALUE "ProductName", "Electron"
|
VALUE "ProductName", "Electron"
|
||||||
VALUE "ProductVersion", "0.32.2"
|
VALUE "ProductVersion", "0.32.3"
|
||||||
VALUE "SquirrelAwareVersion", "1"
|
VALUE "SquirrelAwareVersion", "1"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#define ATOM_MAJOR_VERSION 0
|
#define ATOM_MAJOR_VERSION 0
|
||||||
#define ATOM_MINOR_VERSION 32
|
#define ATOM_MINOR_VERSION 32
|
||||||
#define ATOM_PATCH_VERSION 2
|
#define ATOM_PATCH_VERSION 3
|
||||||
|
|
||||||
#define ATOM_VERSION_IS_RELEASE 1
|
#define ATOM_VERSION_IS_RELEASE 1
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
## API - Referencias
|
## API - Referencias
|
||||||
|
|
||||||
* [Sinopse](../../docs/api/synopsis.md)
|
* [Sinopse](../../docs/api/synopsis.md)
|
||||||
* [Processos](../../docs/api/process.md)
|
* [Processos](api/process.md)
|
||||||
|
* [Aceleradores (Teclas de Atalho)](api/accelerator.md)
|
||||||
* [Parâmetros CLI suportados (Chrome)](../../docs/api/chrome-command-line-switches.md)
|
* [Parâmetros CLI suportados (Chrome)](../../docs/api/chrome-command-line-switches.md)
|
||||||
|
|
||||||
DOM elementos personalizados:
|
DOM elementos personalizados:
|
||||||
|
@ -56,7 +57,7 @@ Módulos de ambos os processos:
|
||||||
* [crash-reporter](../../docs/api/crash-reporter.md)
|
* [crash-reporter](../../docs/api/crash-reporter.md)
|
||||||
* [native-image](../../docs/api/native-image.md)
|
* [native-image](../../docs/api/native-image.md)
|
||||||
* [screen](../../docs/api/screen.md)
|
* [screen](../../docs/api/screen.md)
|
||||||
* [shell](../../docs/api/shell.md)
|
* [shell](api/shell.md)
|
||||||
|
|
||||||
## Desenvolvimento
|
## Desenvolvimento
|
||||||
|
|
||||||
|
|
46
docs-translations/pt-BR/api/accelerator.md
Normal file
46
docs-translations/pt-BR/api/accelerator.md
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
# Acelerador (teclas de atalhos)
|
||||||
|
|
||||||
|
Um acelerador é uma string que representa um atalho de tecla. Isso pode conter
|
||||||
|
multiplos modificadores e códigos chaves, combinado pelo caracter `+`.
|
||||||
|
|
||||||
|
Exemplos:
|
||||||
|
|
||||||
|
* `Command+A`
|
||||||
|
* `Ctrl+Shift+Z`
|
||||||
|
|
||||||
|
## Aviso sobre plataformas
|
||||||
|
|
||||||
|
No Linux e no Windows a tecla `Command` não tem nenhum efeito,
|
||||||
|
então use `CommandOrControl` que representa a tecla `Command` existente no OSX e
|
||||||
|
`Control` no Linux e no Windows para definir aceleradores (atalhos).
|
||||||
|
|
||||||
|
A chave `Super` está mapeada para a tecla `Windows` para Windows e Linux,
|
||||||
|
e para a tecla `Cmd` para OSX.
|
||||||
|
|
||||||
|
## Modificadores disponiveis
|
||||||
|
|
||||||
|
* `Command` (ou `Cmd` abreviado)
|
||||||
|
* `Control` (ou `Ctrl` abreviado)
|
||||||
|
* `CommandOrControl` (ou `CmdOrCtrl` abreviado)
|
||||||
|
* `Alt`
|
||||||
|
* `Shift`
|
||||||
|
* `Super`
|
||||||
|
|
||||||
|
## Códigos chaves disponiveis
|
||||||
|
|
||||||
|
* `0` to `9`
|
||||||
|
* `A` to `Z`
|
||||||
|
* `F1` to `F24`
|
||||||
|
* Punctuations like `~`, `!`, `@`, `#`, `$`, etc.
|
||||||
|
* `Plus`
|
||||||
|
* `Space`
|
||||||
|
* `Backspace`
|
||||||
|
* `Delete`
|
||||||
|
* `Insert`
|
||||||
|
* `Return` (or `Enter` as alias)
|
||||||
|
* `Up`, `Down`, `Left` and `Right`
|
||||||
|
* `Home` and `End`
|
||||||
|
* `PageUp` and `PageDown`
|
||||||
|
* `Escape` (or `Esc` for short)
|
||||||
|
* `VolumeUp`, `VolumeDown` and `VolumeMute`
|
||||||
|
* `MediaNextTrack`, `MediaPreviousTrack`, `MediaStop` and `MediaPlayPause`
|
22
docs-translations/pt-BR/api/process.md
Normal file
22
docs-translations/pt-BR/api/process.md
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# process
|
||||||
|
O objeto `process` no Electron tem as seguintes diferenças de um upstream node:
|
||||||
|
|
||||||
|
* `process.type` String - Tipo de processo, pode ser `browser` (i.e. main process)
|
||||||
|
ou `renderer`.
|
||||||
|
* `process.versions['electron']` String - Versão do Electron.
|
||||||
|
* `process.versions['chrome']` String - Versão do Chromium.
|
||||||
|
* `process.resourcesPath` String - Caminho para os códigos fontes JavaScript.
|
||||||
|
|
||||||
|
# Métodos
|
||||||
|
O objeto `process` tem os seguintes método:
|
||||||
|
|
||||||
|
### `process.hang`
|
||||||
|
|
||||||
|
Afeta a thread principal do processo atual.
|
||||||
|
|
||||||
|
## process.setFdLimit(MaxDescritores) _OS X_ _Linux_
|
||||||
|
|
||||||
|
* `maxDescriptors` Integer
|
||||||
|
|
||||||
|
Define o limite do arquivo descritor para `maxDescriptors` ou para o limite do OS,
|
||||||
|
o que for menor para o processo atual.
|
43
docs-translations/pt-BR/api/shell.md
Normal file
43
docs-translations/pt-BR/api/shell.md
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# shell
|
||||||
|
|
||||||
|
O módulo `shell` fornece funções relacionadas intereções com o OS do usuário.
|
||||||
|
|
||||||
|
Um exemplo para abrir uma URL no browser padrão do usuário:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var shell = require('shell');
|
||||||
|
shell.openExternal('https://github.com');
|
||||||
|
```
|
||||||
|
|
||||||
|
## Métodos
|
||||||
|
|
||||||
|
O módulo `shell` tem os seguintes métodos:
|
||||||
|
|
||||||
|
### `shell.showItemInFolder(fullPath)`
|
||||||
|
|
||||||
|
* `fullPath` String
|
||||||
|
|
||||||
|
Exibe o arquivo no gerenciador de arquivos padrão do sistema. Se possivel, seleciona o arquivo automaticamente.
|
||||||
|
|
||||||
|
### `shell.openItem(fullPath)`
|
||||||
|
|
||||||
|
* `fullPath` String
|
||||||
|
|
||||||
|
Abre o arquivo em seu programa padrão.
|
||||||
|
|
||||||
|
### `shell.openExternal(url)`
|
||||||
|
|
||||||
|
* `url` String
|
||||||
|
|
||||||
|
Abre o arquivo seguido de um protocol em seu programa padrão. (Por
|
||||||
|
exemplo, mailto:foo@bar.com.)
|
||||||
|
|
||||||
|
### `shell.moveItemToTrash(fullPath)`
|
||||||
|
|
||||||
|
* `fullPath` String
|
||||||
|
|
||||||
|
Move o arquivo para a lixeira e retorna um boolean com o resultado da operação.
|
||||||
|
|
||||||
|
### `shell.beep()`
|
||||||
|
|
||||||
|
Toca um som beep.
|
|
@ -11,16 +11,16 @@ Electron 可以让你使用纯 JavaScript 调用丰富的原生 APIs 来创造
|
||||||
## 渲染进程
|
## 渲染进程
|
||||||
由于 Electron 使用 Chromium 来展示页面,所以 Chromium 的多进程结构也被充分利用。每个 Electron 的页面都在运行着自己的进程,这样的进程我们称之为**渲染进程**。
|
由于 Electron 使用 Chromium 来展示页面,所以 Chromium 的多进程结构也被充分利用。每个 Electron 的页面都在运行着自己的进程,这样的进程我们称之为**渲染进程**。
|
||||||
|
|
||||||
在一般浏览器中,网页通常会在沙盒环境下运行,并且不允许访问原生资源。然后,Electron 用户拥有在网页中调用 io.js 的 APIs 的能力,从而创造出低等的、与操作系统的交互。
|
在一般浏览器中,网页通常会在沙盒环境下运行,并且不允许访问原生资源。然而,Electron 用户拥有在网页中调用 io.js 的 APIs 的能力,可以与底层操作系统直接交互。
|
||||||
|
|
||||||
## 主进程与渲染进程的区别
|
## 主进程与渲染进程的区别
|
||||||
主进程使用 BroswerWindow 实例创建网页。每个 BroswerWindow 实例都在自己的渲染进程里运行着一个网页。当一个 BroswerWindow 实例被销毁,相应的渲染进程也会被终止。
|
主进程使用 BroswerWindow 实例创建网页。每个 BroswerWindow 实例都在自己的渲染进程里运行着一个网页。当一个 BroswerWindow 实例被销毁后,相应的渲染进程也会被终止。
|
||||||
|
|
||||||
主进程管理所有页面和与之对应的渲染进程。每个渲染进程都是相互独立的,并且只关心他们自己的网页。
|
主进程管理所有页面和与之对应的渲染进程。每个渲染进程都是相互独立的,并且只关心他们自己的网页。
|
||||||
|
|
||||||
由于在网页里管理原生 GUI 资源是非常危险而且容易造成资源泄露的,所以在网页面调用 GUI 相关的 APIs 是不被允许的。如果你想在网页里使用 GUI 操作,其对应的渲染进程必须与主进程进行通讯,请求主进程进行相关的 GUI 操作。
|
由于在网页里管理原生 GUI 资源是非常危险而且容易造成资源泄露,所以在网页面调用 GUI 相关的 APIs 是不被允许的。如果你想在网页里使用 GUI 操作,其对应的渲染进程必须与主进程进行通讯,请求主进程进行相关的 GUI 操作。
|
||||||
|
|
||||||
在 Electron,我们提供用于在主进程与渲染进程之间通讯的 [ipc][1] 模块。并且也有一个远程进程调用风格的通讯模块 [remote][2]。
|
在 Electron,我们提供用于在主进程与渲染进程之间通讯的 [ipc][1] 模块。并且也有一个远程进程调用风格的通讯模块 [remote][2]。
|
||||||
|
|
||||||
# 打造你第一个 Electron 应用
|
# 打造你第一个 Electron 应用
|
||||||
大体上,一个 Electron 应用的目录结构如下:
|
大体上,一个 Electron 应用的目录结构如下:
|
||||||
|
@ -133,4 +133,4 @@ $ ./Electron.app/Contents/MacOS/Electron your-app/
|
||||||
[1]: https://github.com/atom/electron/blob/master/docs-translations/zh-CN/api/ipc-renderer.md
|
[1]: https://github.com/atom/electron/blob/master/docs-translations/zh-CN/api/ipc-renderer.md
|
||||||
[2]: https://github.com/atom/electron/blob/master/docs-translations/zh-CN/api/remote.md
|
[2]: https://github.com/atom/electron/blob/master/docs-translations/zh-CN/api/remote.md
|
||||||
[3]: https://github.com/atom/electron/releases
|
[3]: https://github.com/atom/electron/releases
|
||||||
[4]: https://github.com/atom/electron/blob/master/docs-translations/zh-CN/tutorial/application-distribution.md
|
[4]: https://github.com/atom/electron/blob/master/docs-translations/zh-CN/tutorial/application-distribution.md
|
||||||
|
|
|
@ -94,11 +94,15 @@ must be registered to be opened by your application.
|
||||||
|
|
||||||
You should call `event.preventDefault()` if you want to handle this event.
|
You should call `event.preventDefault()` if you want to handle this event.
|
||||||
|
|
||||||
### Event: 'activate-with-no-open-windows'
|
### Event: 'activate' _OS X_
|
||||||
|
|
||||||
Emitted when the application is activated while there are no open windows, which
|
Returns:
|
||||||
usually happens when the user has closed all of the application's windows and
|
|
||||||
then clicks on the application's dock icon.
|
* `event` Event
|
||||||
|
* `hasVisibleWindows` Bool
|
||||||
|
|
||||||
|
Emitted when the application is activated, which usually happens when clicks on
|
||||||
|
the applications's dock icon.
|
||||||
|
|
||||||
### Event: 'browser-window-blur'
|
### Event: 'browser-window-blur'
|
||||||
|
|
||||||
|
@ -235,6 +239,10 @@ to the npm modules spec. You should usually also specify a `productName`
|
||||||
field, which is your application's full capitalized name, and which will be
|
field, which is your application's full capitalized name, and which will be
|
||||||
preferred over `name` by Electron.
|
preferred over `name` by Electron.
|
||||||
|
|
||||||
|
### `app.getLocale()`
|
||||||
|
|
||||||
|
Returns the current application locale.
|
||||||
|
|
||||||
### `app.resolveProxy(url, callback)`
|
### `app.resolveProxy(url, callback)`
|
||||||
|
|
||||||
* `url` URL
|
* `url` URL
|
||||||
|
|
|
@ -46,7 +46,7 @@ Properties `width` and `height` are required.
|
||||||
* `always-on-top` Boolean - Whether the window should always stay on top of
|
* `always-on-top` Boolean - Whether the window should always stay on top of
|
||||||
other windows.
|
other windows.
|
||||||
* `fullscreen` Boolean - Whether the window should show in fullscreen. When
|
* `fullscreen` Boolean - Whether the window should show in fullscreen. When
|
||||||
set to `false` the fullscreen button will also be hidden on OS X.
|
set to `false` the fullscreen button will be hidden or disabled on OS X.
|
||||||
* `skip-taskbar` Boolean - Whether to show the window in taskbar.
|
* `skip-taskbar` Boolean - Whether to show the window in taskbar.
|
||||||
* `kiosk` Boolean - The kiosk mode.
|
* `kiosk` Boolean - The kiosk mode.
|
||||||
* `title` String - Default window title.
|
* `title` String - Default window title.
|
||||||
|
@ -613,7 +613,11 @@ Returns whether the developer tools are opened.
|
||||||
|
|
||||||
### `win.toggleDevTools()`
|
### `win.toggleDevTools()`
|
||||||
|
|
||||||
Toggle the developer tools.
|
Toggles the developer tools.
|
||||||
|
|
||||||
|
### `win.isDevToolsFocused()`
|
||||||
|
|
||||||
|
Returns whether the developer tools is focused.
|
||||||
|
|
||||||
### `win.inspectElement(x, y)`
|
### `win.inspectElement(x, y)`
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ def main():
|
||||||
run_script('upload.py')
|
run_script('upload.py')
|
||||||
else:
|
else:
|
||||||
run_script('build.py', ['-c', 'D'])
|
run_script('build.py', ['-c', 'D'])
|
||||||
if (is_travis or PLATFORM == 'linux') and target_arch == 'x64':
|
if PLATFORM != 'win32' and target_arch == 'x64':
|
||||||
run_script('test.py', ['--ci'])
|
run_script('test.py', ['--ci'])
|
||||||
|
|
||||||
run_script('clean.py')
|
run_script('clean.py')
|
||||||
|
|
|
@ -8,7 +8,7 @@ from lib.util import atom_gyp, execute, s3put, scoped_cwd
|
||||||
|
|
||||||
|
|
||||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||||
OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'R')
|
OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'D')
|
||||||
|
|
||||||
PROJECT_NAME = atom_gyp()['project_name%']
|
PROJECT_NAME = atom_gyp()['project_name%']
|
||||||
PRODUCT_NAME = atom_gyp()['product_name%']
|
PRODUCT_NAME = atom_gyp()['product_name%']
|
||||||
|
|
|
@ -26,6 +26,10 @@ describe 'app module', ->
|
||||||
assert.equal app.getName(), 'test-name'
|
assert.equal app.getName(), 'test-name'
|
||||||
app.setName 'Electron Test'
|
app.setName 'Electron Test'
|
||||||
|
|
||||||
|
describe 'app.getLocale()', ->
|
||||||
|
it 'should not be empty', ->
|
||||||
|
assert.notEqual app.getLocale(), ''
|
||||||
|
|
||||||
describe 'BrowserWindow events', ->
|
describe 'BrowserWindow events', ->
|
||||||
w = null
|
w = null
|
||||||
afterEach ->
|
afterEach ->
|
||||||
|
|
|
@ -18,9 +18,14 @@ describe 'crash-reporter module', ->
|
||||||
# It is not working on 64bit Windows.
|
# It is not working on 64bit Windows.
|
||||||
return if process.platform is 'win32' and process.arch is 'x64'
|
return if process.platform is 'win32' and process.arch is 'x64'
|
||||||
|
|
||||||
|
# The crash-reporter test is not reliable on CI machine.
|
||||||
|
isCI = remote.process.argv[2] == '--ci'
|
||||||
|
return if isCI
|
||||||
|
|
||||||
it 'should send minidump when renderer crashes', (done) ->
|
it 'should send minidump when renderer crashes', (done) ->
|
||||||
@timeout 60000
|
@timeout 120000
|
||||||
server = http.createServer (req, res) ->
|
server = http.createServer (req, res) ->
|
||||||
|
server.close()
|
||||||
form = new formidable.IncomingForm()
|
form = new formidable.IncomingForm()
|
||||||
process.throwDeprecation = false
|
process.throwDeprecation = false
|
||||||
form.parse req, (error, fields, files) ->
|
form.parse req, (error, fields, files) ->
|
||||||
|
@ -37,7 +42,6 @@ describe 'crash-reporter module', ->
|
||||||
assert files['upload_file_minidump']['name']?
|
assert files['upload_file_minidump']['name']?
|
||||||
|
|
||||||
res.end('abc-123-def')
|
res.end('abc-123-def')
|
||||||
server.close()
|
|
||||||
done()
|
done()
|
||||||
# Server port is generated randomly for the first run, it will be reused
|
# Server port is generated randomly for the first run, it will be reused
|
||||||
# when page is refreshed.
|
# when page is refreshed.
|
||||||
|
|
|
@ -318,6 +318,19 @@ describe 'protocol module', ->
|
||||||
error: (xhr, errorType, error) ->
|
error: (xhr, errorType, error) ->
|
||||||
done(error)
|
done(error)
|
||||||
|
|
||||||
|
it 'can set content-type', (done) ->
|
||||||
|
handler = (request, callback) ->
|
||||||
|
callback({mimeType: 'application/json', data: '{"value": 1}'})
|
||||||
|
protocol.interceptStringProtocol 'http', handler, (error) ->
|
||||||
|
$.ajax
|
||||||
|
url: 'http://fake-host'
|
||||||
|
success: (data) ->
|
||||||
|
assert.equal typeof(data), 'object'
|
||||||
|
assert.equal data.value, 1
|
||||||
|
done()
|
||||||
|
error: (xhr, errorType, error) ->
|
||||||
|
done(error)
|
||||||
|
|
||||||
describe 'protocol.interceptBufferProtocol', ->
|
describe 'protocol.interceptBufferProtocol', ->
|
||||||
it 'can intercept http protocol', (done) ->
|
it 'can intercept http protocol', (done) ->
|
||||||
handler = (request, callback) -> callback(new Buffer(text))
|
handler = (request, callback) -> callback(new Buffer(text))
|
||||||
|
|
|
@ -51,6 +51,8 @@ describe 'chromium feature', ->
|
||||||
b = window.open "file://#{fixtures}/pages/window-opener-node.html", '', 'node-integration=no,show=no'
|
b = window.open "file://#{fixtures}/pages/window-opener-node.html", '', 'node-integration=no,show=no'
|
||||||
|
|
||||||
describe 'window.opener', ->
|
describe 'window.opener', ->
|
||||||
|
@timeout 10000
|
||||||
|
|
||||||
ipc = remote.require 'ipc'
|
ipc = remote.require 'ipc'
|
||||||
url = "file://#{fixtures}/pages/window-opener.html"
|
url = "file://#{fixtures}/pages/window-opener.html"
|
||||||
w = null
|
w = null
|
||||||
|
@ -61,16 +63,17 @@ describe 'chromium feature', ->
|
||||||
|
|
||||||
it 'is null for main window', (done) ->
|
it 'is null for main window', (done) ->
|
||||||
ipc.on 'opener', (event, opener) ->
|
ipc.on 'opener', (event, opener) ->
|
||||||
done(if opener is null then undefined else opener)
|
assert.equal opener, null
|
||||||
|
done()
|
||||||
BrowserWindow = remote.require 'browser-window'
|
BrowserWindow = remote.require 'browser-window'
|
||||||
w = new BrowserWindow(show: false)
|
w = new BrowserWindow(show: false)
|
||||||
w.loadUrl url
|
w.loadUrl url
|
||||||
|
|
||||||
it 'is not null for window opened by window.open', (done) ->
|
it 'is not null for window opened by window.open', (done) ->
|
||||||
b = window.open url, '', 'show=no'
|
|
||||||
ipc.on 'opener', (event, opener) ->
|
ipc.on 'opener', (event, opener) ->
|
||||||
b.close()
|
b.close()
|
||||||
done(if opener isnt null then undefined else opener)
|
done(if opener isnt null then undefined else opener)
|
||||||
|
b = window.open url, '', 'show=no'
|
||||||
|
|
||||||
describe 'window.opener.postMessage', ->
|
describe 'window.opener.postMessage', ->
|
||||||
it 'sets source and origin correctly', (done) ->
|
it 'sets source and origin correctly', (done) ->
|
||||||
|
|
|
@ -11,7 +11,7 @@ describe '<webview> tag', ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
webview = new WebView
|
webview = new WebView
|
||||||
afterEach ->
|
afterEach ->
|
||||||
document.body.removeChild webview
|
document.body.removeChild(webview) if document.body.contains(webview)
|
||||||
|
|
||||||
describe 'src attribute', ->
|
describe 'src attribute', ->
|
||||||
it 'specifies the page to load', (done) ->
|
it 'specifies the page to load', (done) ->
|
||||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 1cfc13fec13a36f3682ee702c32dc2cf22363143
|
Subproject commit d385c9b1b88da3ba1b5426861ec7c63e8c884135
|
2
vendor/node
vendored
2
vendor/node
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit fdb584a0b42e89885f74ed68f279318b0fbff37f
|
Subproject commit 4098d45fbb822370c19d2fe7b88162759db4eb96
|
Loading…
Reference in a new issue