mirror of
https://github.com/electron/electron.git
synced 2026-02-26 03:01:17 -05:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
377666503c | ||
|
|
0411c2d2b6 | ||
|
|
839a751de5 | ||
|
|
a74d3d210d | ||
|
|
df86c9dac1 | ||
|
|
e3d67a304f | ||
|
|
77253abbd7 | ||
|
|
013a7717b4 | ||
|
|
aae4abfa86 | ||
|
|
abc6e1e289 | ||
|
|
dc154f3907 | ||
|
|
9f86fa1893 | ||
|
|
01b42c9e59 | ||
|
|
6bd0b82b2e | ||
|
|
391468ece0 | ||
|
|
5e05a3045c | ||
|
|
c2996d4fd1 | ||
|
|
d37bf06b5a | ||
|
|
1c07235121 | ||
|
|
59a2430f1d | ||
|
|
87221f8f55 | ||
|
|
e3215a1f21 | ||
|
|
2522bc2298 | ||
|
|
f3103e9b00 | ||
|
|
e897377879 | ||
|
|
6833865ff3 | ||
|
|
88dde07bf1 | ||
|
|
51f0090555 | ||
|
|
b8e75df8f0 | ||
|
|
de21a164ea | ||
|
|
95e1ea6599 | ||
|
|
2d2fbaaa4a | ||
|
|
7cfff62037 | ||
|
|
d61daf6f05 | ||
|
|
eca911a1b1 | ||
|
|
0a5a020466 | ||
|
|
79802c2919 | ||
|
|
3f1d540077 | ||
|
|
ff9027fa95 | ||
|
|
753a1e7aff | ||
|
|
4c8e483bc1 | ||
|
|
8404389a31 | ||
|
|
f8d6fab52b | ||
|
|
199e975a11 |
48
atom.gyp
48
atom.gyp
@@ -32,6 +32,7 @@
|
||||
'common/api/lib/shell.coffee',
|
||||
'common/lib/init.coffee',
|
||||
'renderer/lib/init.coffee',
|
||||
'renderer/lib/override.coffee',
|
||||
'renderer/api/lib/ipc.coffee',
|
||||
'renderer/api/lib/remote.coffee',
|
||||
],
|
||||
@@ -118,8 +119,6 @@
|
||||
'browser/ui/cocoa/atom_menu_controller.mm',
|
||||
'browser/ui/cocoa/event_processing_window.h',
|
||||
'browser/ui/cocoa/event_processing_window.mm',
|
||||
'browser/ui/cocoa/nsalert_synchronous_sheet.h',
|
||||
'browser/ui/cocoa/nsalert_synchronous_sheet.mm',
|
||||
'browser/ui/file_dialog.h',
|
||||
'browser/ui/file_dialog_gtk.cc',
|
||||
'browser/ui/file_dialog_mac.mm',
|
||||
@@ -487,7 +486,7 @@
|
||||
],
|
||||
'action': [
|
||||
'python',
|
||||
'tools/mac/generate_breakpad_symbols.py',
|
||||
'tools/posix/generate_breakpad_symbols.py',
|
||||
'--build-dir=<(PRODUCT_DIR)',
|
||||
'--binary=<(PRODUCT_DIR)/<(product_name).app/Contents/MacOS/<(product_name)',
|
||||
'--symbols-dir=<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
|
||||
@@ -519,6 +518,49 @@
|
||||
},
|
||||
],
|
||||
}], # OS=="win"
|
||||
['OS=="linux"', {
|
||||
'dependencies': [
|
||||
'vendor/breakpad/breakpad.gyp:dump_syms',
|
||||
],
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'Dump Symbols',
|
||||
'inputs': [
|
||||
'<(PRODUCT_DIR)/<(project_name)',
|
||||
],
|
||||
'outputs': [
|
||||
'<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
|
||||
],
|
||||
'action': [
|
||||
'python',
|
||||
'tools/posix/generate_breakpad_symbols.py',
|
||||
'--build-dir=<(PRODUCT_DIR)',
|
||||
'--binary=<(PRODUCT_DIR)/<(project_name)',
|
||||
'--symbols-dir=<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
|
||||
'--libchromiumcontent-dir=<(libchromiumcontent_library_dir)',
|
||||
'--clear',
|
||||
'--jobs=16',
|
||||
],
|
||||
},
|
||||
{
|
||||
'action_name': 'Strip Binary',
|
||||
'inputs': [
|
||||
'<(PRODUCT_DIR)/libchromiumcontent.so',
|
||||
'<(PRODUCT_DIR)/libffmpegsumo.so',
|
||||
'<(PRODUCT_DIR)/<(project_name)',
|
||||
# Add the syms folder as input would force this action to run
|
||||
# after the 'Dump Symbols' action. And since it is a folder,
|
||||
# it would be ignored by the 'strip' command.
|
||||
'<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
|
||||
],
|
||||
'outputs': [
|
||||
# Gyp action requires a output file, add a fake one here.
|
||||
'<(PRODUCT_DIR)/dummy_file',
|
||||
],
|
||||
'action': [ 'strip', '<@(_inputs)' ],
|
||||
},
|
||||
],
|
||||
}], # OS=="linux"
|
||||
],
|
||||
}, # target <(project_name>_dump_symbols
|
||||
],
|
||||
|
||||
@@ -44,6 +44,10 @@ void App::OnOpenURL(const std::string& url) {
|
||||
Emit("open-url", &args);
|
||||
}
|
||||
|
||||
void App::OnActivateWithNoOpenWindows() {
|
||||
Emit("activate-with-no-open-windows");
|
||||
}
|
||||
|
||||
void App::OnWillFinishLaunching() {
|
||||
Emit("will-finish-launching");
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ class App : public EventEmitter,
|
||||
virtual void OnOpenFile(bool* prevent_default,
|
||||
const std::string& file_path) OVERRIDE;
|
||||
virtual void OnOpenURL(const std::string& url) OVERRIDE;
|
||||
virtual void OnActivateWithNoOpenWindows() OVERRIDE;
|
||||
virtual void OnWillFinishLaunching() OVERRIDE;
|
||||
virtual void OnFinishLaunching() OVERRIDE;
|
||||
|
||||
|
||||
@@ -417,7 +417,8 @@ void Window::InspectElement(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
// static
|
||||
void Window::DebugDevTools(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
UNWRAP_WINDOW_AND_CHECK;
|
||||
self->window_->DebugDevTools();
|
||||
if (self->window_->IsDevToolsOpened())
|
||||
NativeWindow::Debug(self->window_->GetDevToolsWebContents());
|
||||
}
|
||||
|
||||
// static
|
||||
|
||||
@@ -35,4 +35,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)applicationShouldHandleReopen:(NSApplication*)theApplication
|
||||
hasVisibleWindows:(BOOL)flag {
|
||||
atom::Browser* browser = atom::Browser::Get();
|
||||
if (flag) {
|
||||
return YES;
|
||||
} else {
|
||||
browser->ActivateWithNoOpenWindows();
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -54,7 +54,7 @@ void AtomBrowserClient::OverrideWebkitPrefs(
|
||||
const GURL& url,
|
||||
WebPreferences* prefs) {
|
||||
prefs->javascript_enabled = true;
|
||||
prefs->web_security_enabled = false;
|
||||
prefs->web_security_enabled = true;
|
||||
prefs->javascript_can_open_windows_automatically = true;
|
||||
prefs->plugins_enabled = false;
|
||||
prefs->dom_paste_enabled = true;
|
||||
|
||||
@@ -8,6 +8,18 @@
|
||||
|
||||
namespace atom {
|
||||
|
||||
void AtomJavaScriptDialogManager::RunJavaScriptDialog(
|
||||
content::WebContents* web_contents,
|
||||
const GURL& origin_url,
|
||||
const std::string& accept_lang,
|
||||
content::JavaScriptMessageType javascript_message_type,
|
||||
const string16& message_text,
|
||||
const string16& default_prompt_text,
|
||||
const DialogClosedCallback& callback,
|
||||
bool* did_suppress_message) {
|
||||
callback.Run(false, string16());
|
||||
}
|
||||
|
||||
void AtomJavaScriptDialogManager::RunBeforeUnloadDialog(
|
||||
content::WebContents* web_contents,
|
||||
const string16& message_text,
|
||||
|
||||
@@ -20,7 +20,7 @@ class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager {
|
||||
const string16& message_text,
|
||||
const string16& default_prompt_text,
|
||||
const DialogClosedCallback& callback,
|
||||
bool* did_suppress_message) OVERRIDE {}
|
||||
bool* did_suppress_message) OVERRIDE;
|
||||
virtual void RunBeforeUnloadDialog(
|
||||
content::WebContents* web_contents,
|
||||
const string16& message_text,
|
||||
|
||||
@@ -74,6 +74,10 @@ void Browser::OpenURL(const std::string& url) {
|
||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnOpenURL(url));
|
||||
}
|
||||
|
||||
void Browser::ActivateWithNoOpenWindows() {
|
||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnActivateWithNoOpenWindows());
|
||||
}
|
||||
|
||||
void Browser::WillFinishLaunching() {
|
||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWillFinishLaunching());
|
||||
}
|
||||
|
||||
@@ -62,6 +62,9 @@ class Browser : public WindowListObserver {
|
||||
// Tell the application to open a url.
|
||||
void OpenURL(const std::string& url);
|
||||
|
||||
// Tell the application that application is activated with no open windows.
|
||||
void ActivateWithNoOpenWindows();
|
||||
|
||||
// Tell the application the loading has been done.
|
||||
void WillFinishLaunching();
|
||||
void DidFinishLaunching();
|
||||
|
||||
@@ -26,6 +26,10 @@ class BrowserObserver {
|
||||
// Browser is used to open a url.
|
||||
virtual void OnOpenURL(const std::string& url) {}
|
||||
|
||||
// The browser is activated with no open windows (usually by clicking on the
|
||||
// dock icon).
|
||||
virtual void OnActivateWithNoOpenWindows() {}
|
||||
|
||||
// The browser has finished loading.
|
||||
virtual void OnWillFinishLaunching() {}
|
||||
virtual void OnFinishLaunching() {}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "browser/devtools_delegate.h"
|
||||
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/values.h"
|
||||
#include "browser/native_window.h"
|
||||
#include "content/public/browser/devtools_agent_host.h"
|
||||
@@ -11,13 +12,17 @@
|
||||
#include "content/public/browser/devtools_http_handler.h"
|
||||
#include "content/public/browser/devtools_manager.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "ui/gfx/point.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
DevToolsDelegate::DevToolsDelegate(NativeWindow* window,
|
||||
content::WebContents* target_web_contents)
|
||||
: content::WebContentsObserver(window->GetWebContents()),
|
||||
owner_window_(window) {
|
||||
owner_window_(window),
|
||||
delegate_(NULL),
|
||||
embedder_message_dispatcher_(
|
||||
new DevToolsEmbedderMessageDispatcher(this)) {
|
||||
content::WebContents* web_contents = window->GetWebContents();
|
||||
|
||||
// Setup devtools.
|
||||
@@ -33,8 +38,9 @@ DevToolsDelegate::DevToolsDelegate(NativeWindow* window,
|
||||
base::DictionaryValue options;
|
||||
options.SetString("title", "DevTools Debugger");
|
||||
window->InitFromOptions(&options);
|
||||
window->AddObserver(this);
|
||||
web_contents->GetController().LoadURL(
|
||||
GURL("chrome-devtools://devtools/devtools.html"),
|
||||
GURL("chrome-devtools://devtools/devtools.html?dockSide=undocked"),
|
||||
content::Referrer(),
|
||||
content::PAGE_TRANSITION_AUTO_TOPLEVEL,
|
||||
std::string());
|
||||
@@ -44,10 +50,11 @@ DevToolsDelegate::~DevToolsDelegate() {
|
||||
}
|
||||
|
||||
void DevToolsDelegate::DispatchOnEmbedder(const std::string& message) {
|
||||
embedder_message_dispatcher_->Dispatch(message);
|
||||
}
|
||||
|
||||
void DevToolsDelegate::InspectedContentsClosing() {
|
||||
delete owner_window_;
|
||||
owner_window_->Close();
|
||||
}
|
||||
|
||||
void DevToolsDelegate::AboutToNavigateRenderView(
|
||||
@@ -57,7 +64,59 @@ void DevToolsDelegate::AboutToNavigateRenderView(
|
||||
}
|
||||
|
||||
void DevToolsDelegate::OnWindowClosed() {
|
||||
delete owner_window_;
|
||||
base::MessageLoop::current()->DeleteSoon(FROM_HERE, owner_window_);
|
||||
}
|
||||
|
||||
void DevToolsDelegate::ActivateWindow() {
|
||||
}
|
||||
|
||||
void DevToolsDelegate::CloseWindow() {
|
||||
owner_window_->Close();
|
||||
}
|
||||
|
||||
void DevToolsDelegate::MoveWindow(int x, int y) {
|
||||
owner_window_->SetPosition(gfx::Point(x, y));
|
||||
}
|
||||
|
||||
void DevToolsDelegate::SetDockSide(const std::string& dock_side) {
|
||||
bool succeed = true;
|
||||
if (delegate_ &&
|
||||
delegate_->DevToolsSetDockSide("attach-back", &succeed) &&
|
||||
succeed)
|
||||
owner_window_->Close();
|
||||
}
|
||||
|
||||
void DevToolsDelegate::OpenInNewTab(const std::string& url) {
|
||||
}
|
||||
|
||||
void DevToolsDelegate::SaveToFile(
|
||||
const std::string& url, const std::string& content, bool save_as) {
|
||||
}
|
||||
|
||||
void DevToolsDelegate::AppendToFile(
|
||||
const std::string& url, const std::string& content) {
|
||||
}
|
||||
|
||||
void DevToolsDelegate::RequestFileSystems() {
|
||||
}
|
||||
|
||||
void DevToolsDelegate::AddFileSystem() {
|
||||
}
|
||||
|
||||
void DevToolsDelegate::RemoveFileSystem(const std::string& file_system_path) {
|
||||
}
|
||||
|
||||
void DevToolsDelegate::IndexPath(
|
||||
int request_id, const std::string& file_system_path) {
|
||||
}
|
||||
|
||||
void DevToolsDelegate::StopIndexing(int request_id) {
|
||||
}
|
||||
|
||||
void DevToolsDelegate::SearchInPath(
|
||||
int request_id,
|
||||
const std::string& file_system_path,
|
||||
const std::string& query) {
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
||||
@@ -9,24 +9,33 @@
|
||||
#include "browser/native_window_observer.h"
|
||||
#include "content/public/browser/devtools_frontend_host_delegate.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
#include "vendor/brightray/browser/devtools_embedder_message_dispatcher.h"
|
||||
#include "vendor/brightray/browser/inspectable_web_contents_delegate.h"
|
||||
|
||||
namespace content {
|
||||
class DevToolsAgentHost;
|
||||
class DevToolsClientHost;
|
||||
}
|
||||
|
||||
using brightray::DevToolsEmbedderMessageDispatcher;
|
||||
|
||||
namespace atom {
|
||||
|
||||
class NativeWindow;
|
||||
|
||||
class DevToolsDelegate : public content::DevToolsFrontendHostDelegate,
|
||||
public content::WebContentsObserver,
|
||||
public NativeWindowObserver {
|
||||
public NativeWindowObserver,
|
||||
public DevToolsEmbedderMessageDispatcher::Delegate {
|
||||
public:
|
||||
DevToolsDelegate(NativeWindow* window,
|
||||
content::WebContents* target_web_contents);
|
||||
virtual ~DevToolsDelegate();
|
||||
|
||||
void SetDelegate(brightray::InspectableWebContentsDelegate* delegate) {
|
||||
delegate_ = delegate;
|
||||
}
|
||||
|
||||
protected:
|
||||
// Implementations of content::DevToolsFrontendHostDelegate.
|
||||
virtual void DispatchOnEmbedder(const std::string& message) OVERRIDE;
|
||||
@@ -39,11 +48,34 @@ class DevToolsDelegate : public content::DevToolsFrontendHostDelegate,
|
||||
// Implementations of NativeWindowObserver.
|
||||
virtual void OnWindowClosed() OVERRIDE;
|
||||
|
||||
// Implementations of DevToolsEmbedderMessageDispatcher::Delegate.
|
||||
virtual void ActivateWindow() OVERRIDE;
|
||||
virtual void CloseWindow() OVERRIDE;
|
||||
virtual void MoveWindow(int x, int y) OVERRIDE;
|
||||
virtual void SetDockSide(const std::string& dock_side) OVERRIDE;
|
||||
virtual void OpenInNewTab(const std::string& url) OVERRIDE;
|
||||
virtual void SaveToFile(const std::string& url,
|
||||
const std::string& content,
|
||||
bool save_as) OVERRIDE;
|
||||
virtual void AppendToFile(const std::string& url,
|
||||
const std::string& content) OVERRIDE;
|
||||
virtual void RequestFileSystems() OVERRIDE;
|
||||
virtual void AddFileSystem() OVERRIDE;
|
||||
virtual void RemoveFileSystem(const std::string& file_system_path) OVERRIDE;
|
||||
virtual void IndexPath(int request_id,
|
||||
const std::string& file_system_path) OVERRIDE;
|
||||
virtual void StopIndexing(int request_id) OVERRIDE;
|
||||
virtual void SearchInPath(int request_id,
|
||||
const std::string& file_system_path,
|
||||
const std::string& query) OVERRIDE;
|
||||
|
||||
private:
|
||||
NativeWindow* owner_window_;
|
||||
brightray::InspectableWebContentsDelegate* delegate_;
|
||||
|
||||
scoped_refptr<content::DevToolsAgentHost> devtools_agent_host_;
|
||||
scoped_ptr<content::DevToolsClientHost> devtools_client_host_;
|
||||
scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(DevToolsDelegate);
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "base/file_util.h"
|
||||
#include "base/prefs/pref_service.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
@@ -38,19 +39,24 @@
|
||||
#include "ui/gfx/point.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
#include "ui/gfx/size.h"
|
||||
#include "vendor/brightray/browser/inspectable_web_contents_impl.h"
|
||||
#include "webkit/common/user_agent/user_agent_util.h"
|
||||
|
||||
using content::NavigationEntry;
|
||||
|
||||
namespace atom {
|
||||
|
||||
namespace {
|
||||
|
||||
const char kDockSidePref[] = "brightray.devtools.dockside";
|
||||
|
||||
} // namespace
|
||||
|
||||
NativeWindow::NativeWindow(content::WebContents* web_contents,
|
||||
base::DictionaryValue* options)
|
||||
: content::WebContentsObserver(web_contents),
|
||||
has_frame_(true),
|
||||
is_closed_(false),
|
||||
node_integration_("all"),
|
||||
node_integration_("except-iframe"),
|
||||
has_dialog_attached_(false),
|
||||
weak_factory_(this),
|
||||
inspectable_web_contents_(
|
||||
@@ -66,6 +72,7 @@ NativeWindow::NativeWindow(content::WebContents* web_contents,
|
||||
options->GetString(switches::kNodeIntegration, &node_integration_);
|
||||
|
||||
web_contents->SetDelegate(this);
|
||||
inspectable_web_contents()->SetDelegate(this);
|
||||
|
||||
WindowList::AddWindow(this);
|
||||
|
||||
@@ -95,6 +102,14 @@ NativeWindow* NativeWindow::Create(base::DictionaryValue* options) {
|
||||
return Create(content::WebContents::Create(create_params), options);
|
||||
}
|
||||
|
||||
// static
|
||||
NativeWindow* NativeWindow::Debug(content::WebContents* web_contents) {
|
||||
base::DictionaryValue options;
|
||||
NativeWindow* window = NativeWindow::Create(&options);
|
||||
window->devtools_delegate_.reset(new DevToolsDelegate(window, web_contents));
|
||||
return window;
|
||||
}
|
||||
|
||||
// static
|
||||
NativeWindow* NativeWindow::FromRenderView(int process_id, int routing_id) {
|
||||
// Stupid iterating.
|
||||
@@ -166,15 +181,22 @@ bool NativeWindow::HasModalDialog() {
|
||||
}
|
||||
|
||||
void NativeWindow::OpenDevTools() {
|
||||
inspectable_web_contents()->ShowDevTools();
|
||||
if (devtools_window_)
|
||||
devtools_window_->Focus(true);
|
||||
else
|
||||
inspectable_web_contents()->ShowDevTools();
|
||||
}
|
||||
|
||||
void NativeWindow::CloseDevTools() {
|
||||
inspectable_web_contents()->GetView()->CloseDevTools();
|
||||
if (devtools_window_)
|
||||
devtools_window_->Close();
|
||||
else
|
||||
inspectable_web_contents()->GetView()->CloseDevTools();
|
||||
}
|
||||
|
||||
bool NativeWindow::IsDevToolsOpened() {
|
||||
return inspectable_web_contents()->IsDevToolsViewShowing();
|
||||
return (devtools_window_ && devtools_window_->IsFocused()) ||
|
||||
inspectable_web_contents()->IsDevToolsViewShowing();
|
||||
}
|
||||
|
||||
void NativeWindow::InspectElement(int x, int y) {
|
||||
@@ -185,16 +207,6 @@ void NativeWindow::InspectElement(int x, int y) {
|
||||
agent->InspectElement(x, y);
|
||||
}
|
||||
|
||||
void NativeWindow::DebugDevTools() {
|
||||
if (!IsDevToolsOpened())
|
||||
return;
|
||||
|
||||
base::DictionaryValue options;
|
||||
NativeWindow* window = NativeWindow::Create(&options);
|
||||
window->devtools_delegate_.reset(new DevToolsDelegate(
|
||||
window, GetDevToolsWebContents()));
|
||||
}
|
||||
|
||||
void NativeWindow::FocusOnWebView() {
|
||||
GetWebContents()->GetRenderViewHost()->Focus();
|
||||
}
|
||||
@@ -283,10 +295,7 @@ content::WebContents* NativeWindow::GetWebContents() const {
|
||||
}
|
||||
|
||||
content::WebContents* NativeWindow::GetDevToolsWebContents() const {
|
||||
brightray::InspectableWebContentsImpl* inspectable_web_contents_impl =
|
||||
static_cast<brightray::InspectableWebContentsImpl*>(
|
||||
inspectable_web_contents());
|
||||
return inspectable_web_contents_impl->devtools_web_contents();
|
||||
return inspectable_web_contents()->devtools_web_contents();
|
||||
}
|
||||
|
||||
void NativeWindow::NotifyWindowClosed() {
|
||||
@@ -467,6 +476,22 @@ void NativeWindow::Observe(int type,
|
||||
}
|
||||
}
|
||||
|
||||
bool NativeWindow::DevToolsSetDockSide(const std::string& dock_side,
|
||||
bool* succeed) {
|
||||
if (dock_side == "undocked") {
|
||||
*succeed = false;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool NativeWindow::DevToolsShow(std::string* dock_side) {
|
||||
if (*dock_side == "undocked")
|
||||
*dock_side = "bottom";
|
||||
return false;
|
||||
}
|
||||
|
||||
void NativeWindow::OnCapturePageDone(const CapturePageCallback& callback,
|
||||
bool succeed,
|
||||
const SkBitmap& bitmap) {
|
||||
|
||||
@@ -14,19 +14,16 @@
|
||||
#include "browser/native_window_observer.h"
|
||||
#include "content/public/browser/notification_registrar.h"
|
||||
#include "content/public/browser/notification_observer.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
#include "ui/gfx/image/image.h"
|
||||
#include "vendor/brightray/browser/default_web_contents_delegate.h"
|
||||
#include "vendor/brightray/browser/inspectable_web_contents_delegate.h"
|
||||
#include "vendor/brightray/browser/inspectable_web_contents_impl.h"
|
||||
|
||||
namespace base {
|
||||
class DictionaryValue;
|
||||
class ListValue;
|
||||
}
|
||||
|
||||
namespace brightray {
|
||||
class InspectableWebContents;
|
||||
}
|
||||
|
||||
namespace content {
|
||||
class BrowserContext;
|
||||
class WebContents;
|
||||
@@ -49,6 +46,7 @@ class DevToolsDelegate;
|
||||
struct DraggableRegion;
|
||||
|
||||
class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||
public brightray::InspectableWebContentsDelegate,
|
||||
public content::WebContentsObserver,
|
||||
public content::NotificationObserver {
|
||||
public:
|
||||
@@ -76,13 +74,19 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||
|
||||
virtual ~NativeWindow();
|
||||
|
||||
// Create window with existing WebContents.
|
||||
// Create window with existing WebContents, the caller is responsible for
|
||||
// managing the window's live.
|
||||
static NativeWindow* Create(content::WebContents* web_contents,
|
||||
base::DictionaryValue* options);
|
||||
|
||||
// Create window with new WebContents.
|
||||
// Create window with new WebContents, the caller is responsible for
|
||||
// managing the window's live.
|
||||
static NativeWindow* Create(base::DictionaryValue* options);
|
||||
|
||||
// Creates a devtools window to debug the WebContents, the returned window
|
||||
// will manage its own life.
|
||||
static NativeWindow* Debug(content::WebContents* web_contents);
|
||||
|
||||
// Find a window from its process id and routing id.
|
||||
static NativeWindow* FromRenderView(int process_id, int routing_id);
|
||||
|
||||
@@ -129,9 +133,6 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||
virtual bool IsDevToolsOpened();
|
||||
virtual void InspectElement(int x, int y);
|
||||
|
||||
// Creates a new window to debug the devtools.
|
||||
virtual void DebugDevTools();
|
||||
|
||||
virtual void FocusOnWebView();
|
||||
virtual void BlurWebView();
|
||||
virtual bool IsWebViewFocused();
|
||||
@@ -152,6 +153,10 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||
// Should be called by platform code when user want to close the window.
|
||||
virtual void CloseWebContents();
|
||||
|
||||
base::WeakPtr<NativeWindow> GetWeakPtr() {
|
||||
return weak_factory_.GetWeakPtr();
|
||||
}
|
||||
|
||||
content::WebContents* GetWebContents() const;
|
||||
content::WebContents* GetDevToolsWebContents() const;
|
||||
|
||||
@@ -174,8 +179,9 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||
explicit NativeWindow(content::WebContents* web_contents,
|
||||
base::DictionaryValue* options);
|
||||
|
||||
brightray::InspectableWebContents* inspectable_web_contents() const {
|
||||
return inspectable_web_contents_.get();
|
||||
brightray::InspectableWebContentsImpl* inspectable_web_contents() const {
|
||||
return static_cast<brightray::InspectableWebContentsImpl*>(
|
||||
inspectable_web_contents_.get());
|
||||
}
|
||||
|
||||
void NotifyWindowClosed();
|
||||
@@ -220,6 +226,11 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||
const content::NotificationSource& source,
|
||||
const content::NotificationDetails& details) OVERRIDE;
|
||||
|
||||
// Implementations of brightray::InspectableWebContentsDelegate.
|
||||
virtual bool DevToolsSetDockSide(const std::string& dock_side,
|
||||
bool* succeed) OVERRIDE;
|
||||
virtual bool DevToolsShow(std::string* dock_side) OVERRIDE;
|
||||
|
||||
// Whether window has standard frame.
|
||||
bool has_frame_;
|
||||
|
||||
@@ -260,6 +271,8 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||
|
||||
base::WeakPtrFactory<NativeWindow> weak_factory_;
|
||||
|
||||
base::WeakPtr<NativeWindow> devtools_window_;
|
||||
|
||||
scoped_ptr<DevToolsDelegate> devtools_delegate_;
|
||||
scoped_ptr<AtomJavaScriptDialogManager> dialog_manager_;
|
||||
scoped_ptr<brightray::InspectableWebContents> inspectable_web_contents_;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>atom.icns</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.10.3</string>
|
||||
<string>0.10.5</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
||||
@@ -50,8 +50,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,10,3,0
|
||||
PRODUCTVERSION 0,10,3,0
|
||||
FILEVERSION 0,10,5,0
|
||||
PRODUCTVERSION 0,10,5,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -68,12 +68,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "GitHub, Inc."
|
||||
VALUE "FileDescription", "Atom-Shell"
|
||||
VALUE "FileVersion", "0.10.3"
|
||||
VALUE "FileVersion", "0.10.5"
|
||||
VALUE "InternalName", "atom.exe"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2013 GitHub, Inc. All rights reserved."
|
||||
VALUE "OriginalFilename", "atom.exe"
|
||||
VALUE "ProductName", "Atom-Shell"
|
||||
VALUE "ProductVersion", "0.10.3"
|
||||
VALUE "ProductVersion", "0.10.5"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface NSAlert (SynchronousSheet)
|
||||
-(NSInteger) runModalSheetForWindow:(NSWindow*)aWindow;
|
||||
-(NSInteger) runModalSheet;
|
||||
@end
|
||||
@@ -1,51 +0,0 @@
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import "browser/ui/cocoa/nsalert_synchronous_sheet.h"
|
||||
|
||||
// Private methods -- use prefixes to avoid collisions with Apple's methods
|
||||
@interface NSAlert (SynchronousSheetPrivate)
|
||||
-(IBAction) BE_stopSynchronousSheet:(id)sender; // hide sheet & stop modal
|
||||
-(void) BE_beginSheetModalForWindow:(NSWindow *)aWindow;
|
||||
@end
|
||||
|
||||
@implementation NSAlert (SynchronousSheet)
|
||||
|
||||
-(NSInteger) runModalSheetForWindow:(NSWindow *)aWindow {
|
||||
// Set ourselves as the target for button clicks
|
||||
for (NSButton *button in [self buttons]) {
|
||||
[button setTarget:self];
|
||||
[button setAction:@selector(BE_stopSynchronousSheet:)];
|
||||
}
|
||||
|
||||
// Bring up the sheet and wait until stopSynchronousSheet is triggered by a button click
|
||||
[self performSelectorOnMainThread:@selector(BE_beginSheetModalForWindow:) withObject:aWindow waitUntilDone:YES];
|
||||
NSInteger modalCode = [NSApp runModalForWindow:[self window]];
|
||||
|
||||
// This is called only after stopSynchronousSheet is called (that is,
|
||||
// one of the buttons is clicked)
|
||||
[NSApp performSelectorOnMainThread:@selector(endSheet:) withObject:[self window] waitUntilDone:YES];
|
||||
|
||||
// Remove the sheet from the screen
|
||||
[[self window] performSelectorOnMainThread:@selector(orderOut:) withObject:self waitUntilDone:YES];
|
||||
|
||||
return modalCode;
|
||||
}
|
||||
|
||||
-(NSInteger) runModalSheet {
|
||||
return [self runModalSheetForWindow:[NSApp mainWindow]];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Private methods
|
||||
|
||||
-(IBAction) BE_stopSynchronousSheet:(id)sender {
|
||||
[NSApp stopModalWithCode:[sender tag]];
|
||||
}
|
||||
|
||||
-(void) BE_beginSheetModalForWindow:(NSWindow *)aWindow {
|
||||
[self beginSheetModalForWindow:aWindow modalDelegate:nil didEndSelector:nil contextInfo:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -9,24 +9,27 @@
|
||||
#include "base/callback.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "browser/native_window.h"
|
||||
#include "browser/ui/cocoa/nsalert_synchronous_sheet.h"
|
||||
|
||||
@interface ModalDelegate : NSObject {
|
||||
@private
|
||||
atom::MessageBoxCallback callback_;
|
||||
NSAlert* alert_;
|
||||
bool callEndModal_;
|
||||
}
|
||||
- (id)initWithCallback:(const atom::MessageBoxCallback&)callback
|
||||
andAlert:(NSAlert*)alert;
|
||||
andAlert:(NSAlert*)alert
|
||||
callEndModal:(bool)flag;
|
||||
@end
|
||||
|
||||
@implementation ModalDelegate
|
||||
|
||||
- (id)initWithCallback:(const atom::MessageBoxCallback&)callback
|
||||
andAlert:(NSAlert*)alert {
|
||||
andAlert:(NSAlert*)alert
|
||||
callEndModal:(bool)flag {
|
||||
if ((self = [super init])) {
|
||||
callback_ = callback;
|
||||
alert_ = alert;
|
||||
callEndModal_ = flag;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -37,6 +40,9 @@
|
||||
callback_.Run(returnCode);
|
||||
[alert_ release];
|
||||
[self release];
|
||||
|
||||
if (callEndModal_)
|
||||
[NSApp stopModal];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -76,6 +82,10 @@ NSAlert* CreateNSAlert(NativeWindow* parent_window,
|
||||
return alert;
|
||||
}
|
||||
|
||||
void SetReturnCode(int* ret_code, int result) {
|
||||
*ret_code = result;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int ShowMessageBox(NativeWindow* parent_window,
|
||||
@@ -86,12 +96,26 @@ int ShowMessageBox(NativeWindow* parent_window,
|
||||
const std::string& detail) {
|
||||
NSAlert* alert = CreateNSAlert(
|
||||
parent_window, type, buttons, title, message, detail);
|
||||
[alert autorelease];
|
||||
|
||||
if (parent_window)
|
||||
return [alert runModalSheetForWindow:parent_window->GetNativeWindow()];
|
||||
else
|
||||
return [alert runModal];
|
||||
// Use runModal for synchronous alert without parent, since we don't have a
|
||||
// window to wait for.
|
||||
if (!parent_window)
|
||||
return [[alert autorelease] runModal];
|
||||
|
||||
int ret_code = -1;
|
||||
ModalDelegate* delegate = [[ModalDelegate alloc]
|
||||
initWithCallback:base::Bind(&SetReturnCode, &ret_code)
|
||||
andAlert:alert
|
||||
callEndModal:true];
|
||||
|
||||
NSWindow* window = parent_window->GetNativeWindow();
|
||||
[alert beginSheetModalForWindow:window
|
||||
modalDelegate:delegate
|
||||
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
|
||||
contextInfo:nil];
|
||||
|
||||
[NSApp runModalForWindow:window];
|
||||
return ret_code;
|
||||
}
|
||||
|
||||
void ShowMessageBox(NativeWindow* parent_window,
|
||||
@@ -104,7 +128,8 @@ void ShowMessageBox(NativeWindow* parent_window,
|
||||
NSAlert* alert = CreateNSAlert(
|
||||
parent_window, type, buttons, title, message, detail);
|
||||
ModalDelegate* delegate = [[ModalDelegate alloc] initWithCallback:callback
|
||||
andAlert:alert];
|
||||
andAlert:alert
|
||||
callEndModal:false];
|
||||
|
||||
NSWindow* window = parent_window ? parent_window->GetNativeWindow() : nil;
|
||||
[alert beginSheetModalForWindow:window
|
||||
|
||||
19
common.gypi
19
common.gypi
@@ -244,5 +244,24 @@
|
||||
},
|
||||
},
|
||||
}], # OS=="mac"
|
||||
# The breakpad on Linux needs the binary to be built with -g to generate
|
||||
# unmangled symbols.
|
||||
['OS=="linux"', {
|
||||
'target_defaults': {
|
||||
'cflags': [ '-g' ],
|
||||
'conditions': [
|
||||
['target_arch=="ia32"', {
|
||||
'target_conditions': [
|
||||
['_toolset=="target"', {
|
||||
'ldflags': [
|
||||
# Workaround for linker OOM.
|
||||
'-Wl,--no-keep-memory',
|
||||
],
|
||||
}],
|
||||
],
|
||||
}],
|
||||
],
|
||||
},
|
||||
}],
|
||||
],
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#define ATOM_MAJOR_VERSION 0
|
||||
#define ATOM_MINOR_VERSION 10
|
||||
#define ATOM_PATCH_VERSION 3
|
||||
#define ATOM_PATCH_VERSION 5
|
||||
|
||||
#define ATOM_VERSION_IS_RELEASE 1
|
||||
|
||||
|
||||
@@ -66,6 +66,12 @@ must be registered to be opened by your application.
|
||||
|
||||
You should call `event.preventDefault()` if you want to handle this event.
|
||||
|
||||
## Event: activate-with-no-open-windows
|
||||
|
||||
Emitted when the application is activated while there is no opened windows. It
|
||||
usually happens when user has closed all of application's windows and then
|
||||
click on the application's dock icon.
|
||||
|
||||
## app.quit()
|
||||
|
||||
Try to close all windows. If all windows are successfully closed, the
|
||||
|
||||
@@ -48,9 +48,9 @@ Creates a new `BrowserWindow` with native properties set by the `options`.
|
||||
Usually you only need to set the `width` and `height`, other properties will
|
||||
have decent default values.
|
||||
|
||||
By default the `node-integration` option is `all`, which means node integration
|
||||
is available to the main page and all its iframes. You can also set it to
|
||||
`except-iframe`, which would disable node integration in all iframes, or
|
||||
By default the `node-integration` option is `except-iframe`, which means node
|
||||
integration is disabled in all iframes, . You can also set it to `all`, with
|
||||
which node integration is available to the main page and all its iframes, or
|
||||
`manual-enable-iframe`, which is like `except-iframe`, but would enable iframes
|
||||
whose name is suffixed by `-enable-node-integration`. And setting to `disable`
|
||||
would disable the node integration in both the main page and its iframes.
|
||||
@@ -66,6 +66,14 @@ An example of enable node integration in iframe with `node-integration` set to
|
||||
<iframe src="http://jandan.net"></iframe>
|
||||
```
|
||||
|
||||
And you should also notice that the iframes can have access to parent window's
|
||||
javascript objects via `window.parent`, so in order to grant complete security
|
||||
from iframes, you should add `sandbox` attribute to the iframes:
|
||||
|
||||
```html
|
||||
<iframe sandbox="allow-scripts" src="http://bbs.seu.edu.cn"></iframe>
|
||||
```
|
||||
|
||||
### Event: 'page-title-updated'
|
||||
|
||||
* `event` Event
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "atom-shell",
|
||||
"version": "0.10.3",
|
||||
"version": "0.10.5",
|
||||
|
||||
"devDependencies": {
|
||||
"coffee-script": "~1.6.3",
|
||||
|
||||
@@ -21,10 +21,11 @@ namespace atom {
|
||||
namespace {
|
||||
|
||||
// Security tokens.
|
||||
const char* kExceptIframe = "except-iframe";
|
||||
const char* kManualEnableIframe = "manual-enable-iframe";
|
||||
const char* kDisable = "disable";
|
||||
const char* kEnableNodeIntegration = "enable-node-integration";
|
||||
const char* kSecurityAll = "all";
|
||||
const char* kSecurityExceptIframe = "except-iframe";
|
||||
const char* kSecurityManualEnableIframe = "manual-enable-iframe";
|
||||
const char* kSecurityDisable = "disable";
|
||||
const char* kSecurityEnableNodeIntegration = "enable-node-integration";
|
||||
|
||||
// Scheme used by devtools
|
||||
const char* kChromeDevToolsScheme = "chrome-devtools";
|
||||
@@ -32,17 +33,19 @@ const char* kChromeDevToolsScheme = "chrome-devtools";
|
||||
} // namespace
|
||||
|
||||
AtomRendererClient::AtomRendererClient()
|
||||
: node_integration_(ALL),
|
||||
: node_integration_(EXCEPT_IFRAME),
|
||||
main_frame_(NULL) {
|
||||
// Translate the token.
|
||||
std::string token = CommandLine::ForCurrentProcess()->
|
||||
GetSwitchValueASCII(switches::kNodeIntegration);
|
||||
if (token == kExceptIframe)
|
||||
if (token == kSecurityExceptIframe)
|
||||
node_integration_ = EXCEPT_IFRAME;
|
||||
else if (token == kManualEnableIframe)
|
||||
else if (token == kSecurityManualEnableIframe)
|
||||
node_integration_ = MANUAL_ENABLE_IFRAME;
|
||||
else if (token == kDisable)
|
||||
else if (token == kSecurityDisable)
|
||||
node_integration_ = DISABLE;
|
||||
else if (token == kSecurityAll)
|
||||
node_integration_ = ALL;
|
||||
|
||||
if (IsNodeBindingEnabled()) {
|
||||
node_bindings_.reset(NodeBindings::Create(false));
|
||||
@@ -164,7 +167,7 @@ bool AtomRendererClient::IsNodeBindingEnabled(WebKit::WebFrame* frame) {
|
||||
return true;
|
||||
else if (node_integration_ == MANUAL_ENABLE_IFRAME &&
|
||||
frame != NULL &&
|
||||
frame->uniqueName().utf8().find(kEnableNodeIntegration)
|
||||
frame->uniqueName().utf8().find(kSecurityEnableNodeIntegration)
|
||||
== std::string::npos)
|
||||
return false;
|
||||
else if (node_integration_ == EXCEPT_IFRAME && frame != NULL)
|
||||
|
||||
@@ -42,39 +42,5 @@ else
|
||||
global.__filename = __filename
|
||||
global.__dirname = __dirname
|
||||
|
||||
# Redirect window.onerror to uncaughtException.
|
||||
window.onerror = (error) ->
|
||||
if global.process.listeners('uncaughtException').length > 0
|
||||
global.process.emit 'uncaughtException', error
|
||||
true
|
||||
else
|
||||
false
|
||||
|
||||
# Override default window.close, see:
|
||||
# https://github.com/atom/atom-shell/issues/70
|
||||
window.close = ->
|
||||
require('remote').getCurrentWindow().close()
|
||||
|
||||
# Override default window.open.
|
||||
window.open = (url, name, features) ->
|
||||
options = {}
|
||||
for feature in features.split ','
|
||||
[name, value] = feature.split '='
|
||||
options[name] =
|
||||
if value is 'yes'
|
||||
true
|
||||
else if value is 'no'
|
||||
false
|
||||
else
|
||||
value
|
||||
|
||||
options.x ?= options.left
|
||||
options.y ?= options.top
|
||||
options.title ?= name
|
||||
options.width ?= 800
|
||||
options.height ?= 600
|
||||
|
||||
BrowserWindow = require('remote').require 'browser-window'
|
||||
browser = new BrowserWindow options
|
||||
browser.loadUrl url
|
||||
browser
|
||||
# Override default web functions.
|
||||
require path.join(__dirname, 'override')
|
||||
|
||||
54
renderer/lib/override.coffee
Normal file
54
renderer/lib/override.coffee
Normal file
@@ -0,0 +1,54 @@
|
||||
# Redirect window.onerror to uncaughtException.
|
||||
window.onerror = (error) ->
|
||||
if global.process.listeners('uncaughtException').length > 0
|
||||
global.process.emit 'uncaughtException', error
|
||||
true
|
||||
else
|
||||
false
|
||||
|
||||
# Override default window.close, see:
|
||||
# https://github.com/atom/atom-shell/issues/70
|
||||
window.close = ->
|
||||
require('remote').getCurrentWindow().close()
|
||||
|
||||
# Override default window.open.
|
||||
window.open = (url, name, features) ->
|
||||
options = {}
|
||||
for feature in features.split ','
|
||||
[name, value] = feature.split '='
|
||||
options[name] =
|
||||
if value is 'yes'
|
||||
true
|
||||
else if value is 'no'
|
||||
false
|
||||
else
|
||||
value
|
||||
|
||||
options.x ?= options.left
|
||||
options.y ?= options.top
|
||||
options.title ?= name
|
||||
options.width ?= 800
|
||||
options.height ?= 600
|
||||
|
||||
BrowserWindow = require('remote').require 'browser-window'
|
||||
browser = new BrowserWindow options
|
||||
browser.loadUrl url
|
||||
browser
|
||||
|
||||
# Use the dialog API to implement alert().
|
||||
window.alert = (message, title='') ->
|
||||
remote = require 'remote'
|
||||
dialog = remote.require 'dialog'
|
||||
buttons = ['OK']
|
||||
dialog.showMessageBox remote.getCurrentWindow(), {message, title, buttons}
|
||||
|
||||
# And the confirm().
|
||||
window.confirm = (message, title='') ->
|
||||
remote = require 'remote'
|
||||
dialog = remote.require 'dialog'
|
||||
buttons = ['OK', 'Cancel']
|
||||
not dialog.showMessageBox remote.getCurrentWindow(), {message, title, buttons}
|
||||
|
||||
# But we do not support prompt().
|
||||
window.prompt = ->
|
||||
throw new Error('prompt() is and will not be supported in atom-shell.')
|
||||
@@ -18,13 +18,12 @@ def main():
|
||||
os.chdir(SOURCE_ROOT)
|
||||
|
||||
args = parse_args()
|
||||
if not args.skip_network:
|
||||
update_submodules()
|
||||
update_apm()
|
||||
update_node_modules()
|
||||
bootstrap_brightray(args.url)
|
||||
if sys.platform == 'cygwin':
|
||||
update_win32_python()
|
||||
update_submodules()
|
||||
update_apm()
|
||||
update_node_modules()
|
||||
bootstrap_brightray(args.url)
|
||||
if sys.platform == 'cygwin':
|
||||
update_win32_python()
|
||||
|
||||
touch_config_gypi()
|
||||
update_atom_shell()
|
||||
@@ -38,9 +37,6 @@ def parse_args():
|
||||
'libchromiumcontent\'s script/upload script',
|
||||
default=BASE_URL,
|
||||
required=False)
|
||||
parser.add_argument('-s', '--skip-network',
|
||||
help='Skip operations require networking',
|
||||
action='store_true')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@ def main():
|
||||
|
||||
run_script('bootstrap.py')
|
||||
run_script('cpplint.py')
|
||||
run_script('pylint.py')
|
||||
if sys.platform != 'win32':
|
||||
run_script('pylint.py')
|
||||
run_script('coffeelint.py')
|
||||
run_script('build.py')
|
||||
run_script('test.py', ['--ci'])
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import errno
|
||||
import glob
|
||||
import os
|
||||
import subprocess
|
||||
@@ -20,11 +21,14 @@ def main():
|
||||
glob.glob('common/api/lib/*.coffee') + \
|
||||
glob.glob('browser/atom/*.coffee')
|
||||
|
||||
if sys.platform in ['win32', 'cygwin']:
|
||||
subprocess.check_call(['node', coffeelint] + settings + files,
|
||||
executable='C:/Program Files/nodejs/node.exe')
|
||||
else:
|
||||
try:
|
||||
subprocess.check_call(['node', coffeelint] + settings + files)
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOENT and sys.platform in ['win32', 'cygwin']:
|
||||
subprocess.check_call(['node', coffeelint] + settings + files,
|
||||
executable='C:/Program Files/nodejs/node.exe')
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -9,7 +9,7 @@ import tarfile
|
||||
|
||||
from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, NODE_VERSION
|
||||
from lib.util import scoped_cwd, rm_rf, get_atom_shell_version, make_zip, \
|
||||
safe_mkdir, execute
|
||||
safe_mkdir, safe_unlink, execute
|
||||
|
||||
|
||||
ATOM_SHELL_VRESION = get_atom_shell_version()
|
||||
@@ -81,10 +81,12 @@ def main():
|
||||
|
||||
args = parse_args()
|
||||
|
||||
if TARGET_PLATFORM == 'linux':
|
||||
clean_build()
|
||||
force_build()
|
||||
if TARGET_PLATFORM != 'linux':
|
||||
download_libchromiumcontent_symbols(args.url)
|
||||
create_symbols()
|
||||
create_symbols()
|
||||
copy_binaries()
|
||||
copy_headers()
|
||||
copy_license()
|
||||
@@ -105,6 +107,16 @@ def parse_args():
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def clean_build():
|
||||
# On Linux stripping binary would cause them to be rebuilt next time, which
|
||||
# would make create-dist create symbols from stripped binary if it has been
|
||||
# ran for twice.
|
||||
# So in order to make sure we built correct symbols everytime, we have to
|
||||
# force a rebuild of the binaries.
|
||||
for binary in TARGET_BINARIES[TARGET_PLATFORM]:
|
||||
safe_unlink(os.path.join(OUT_DIR, binary))
|
||||
|
||||
|
||||
def force_build():
|
||||
build = os.path.join(SOURCE_ROOT, 'script', 'build.py')
|
||||
execute([sys.executable, build, '-c', 'Release'])
|
||||
@@ -205,8 +217,6 @@ def create_symbols_zip():
|
||||
with scoped_cwd(DIST_DIR):
|
||||
files = ['LICENSE', 'version']
|
||||
dirs = ['Atom-Shell.breakpad.syms']
|
||||
if TARGET_PLATFORM == 'linux':
|
||||
dirs = []
|
||||
make_zip(zip_file, files, dirs)
|
||||
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
NODE_VERSION = 'v0.11.10'
|
||||
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
|
||||
LIBCHROMIUMCONTENT_COMMIT = '1df8e7cdac8aa74c91c19ae0691ce512d560ab3e'
|
||||
LIBCHROMIUMCONTENT_COMMIT = '9c654df782c77449e7d8fa741843143145260aeb'
|
||||
|
||||
@@ -51,7 +51,7 @@ def main():
|
||||
release_id = create_or_get_release_draft(github, args.version)
|
||||
upload_atom_shell(github, release_id, os.path.join(DIST_DIR, DIST_NAME))
|
||||
upload_atom_shell(github, release_id, os.path.join(DIST_DIR, SYMBOLS_NAME))
|
||||
if not args.no_publish_release:
|
||||
if args.publish_release:
|
||||
publish_release(github, release_id)
|
||||
|
||||
# Upload node's headers to S3.
|
||||
@@ -63,8 +63,8 @@ def parse_args():
|
||||
parser = argparse.ArgumentParser(description='upload distribution file')
|
||||
parser.add_argument('-v', '--version', help='Specify the version',
|
||||
default=ATOM_SHELL_VRESION)
|
||||
parser.add_argument('-n', '--no-publish-release',
|
||||
help='Do not publish the release',
|
||||
parser.add_argument('-p', '--publish-release',
|
||||
help='Publish the release',
|
||||
action='store_true')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
assert = require 'assert'
|
||||
path = require 'path'
|
||||
|
||||
describe 'chromium feature', ->
|
||||
fixtures = path.resolve __dirname, 'fixtures'
|
||||
|
||||
describe 'heap snapshot', ->
|
||||
it 'does not crash', ->
|
||||
process.atomBinding('v8_util').takeHeapSnapshot()
|
||||
@@ -21,3 +24,18 @@ describe 'chromium feature', ->
|
||||
b = window.open 'about:blank', 'test', 'show=no'
|
||||
assert.equal b.constructor.name, 'BrowserWindow'
|
||||
b.destroy()
|
||||
|
||||
describe 'iframe with sandbox attribute', ->
|
||||
it 'can not modify parent', (done) ->
|
||||
page = path.join fixtures, 'pages', 'change-parent.html'
|
||||
global.changedByIframe = false
|
||||
|
||||
iframe = $('<iframe sandbox="allow-scripts">')
|
||||
iframe.hide()
|
||||
iframe.attr 'src', "file://#{page}"
|
||||
iframe.appendTo 'body'
|
||||
isChanged = ->
|
||||
iframe.remove()
|
||||
assert.equal global.changedByIframe, false
|
||||
done()
|
||||
setTimeout isChanged, 30
|
||||
|
||||
8
spec/fixtures/pages/change-parent.html
vendored
Normal file
8
spec/fixtures/pages/change-parent.html
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
console.log('ready2')
|
||||
window.parent.changedByIframe = true;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
2
vendor/apm
vendored
2
vendor/apm
vendored
Submodule vendor/apm updated: a9e5498a83...90cd546860
2
vendor/brightray
vendored
2
vendor/brightray
vendored
Submodule vendor/brightray updated: 569ea3f1e1...1a8afaa871
2
vendor/node
vendored
2
vendor/node
vendored
Submodule vendor/node updated: 7a9642af6d...38862fe819
Reference in New Issue
Block a user