mirror of
https://github.com/electron/electron.git
synced 2026-02-26 03:01:17 -05:00
Compare commits
48 Commits
refactor/a
...
v1.6.13
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2fe287b34 | ||
|
|
47242064ba | ||
|
|
da73284515 | ||
|
|
9b74f25770 | ||
|
|
dcb5a34922 | ||
|
|
df55c1e717 | ||
|
|
a62f13856b | ||
|
|
c83ff61fdf | ||
|
|
2b83512c44 | ||
|
|
c12f7d3132 | ||
|
|
9c0a8ab168 | ||
|
|
8842b04567 | ||
|
|
0573919fd3 | ||
|
|
5253c0a816 | ||
|
|
05b412313d | ||
|
|
0428632a4e | ||
|
|
855d2c4b20 | ||
|
|
f0402be869 | ||
|
|
5a1e3fc0f3 | ||
|
|
01c31ee924 | ||
|
|
c29316b568 | ||
|
|
21f15fa87e | ||
|
|
ab95ecda42 | ||
|
|
456e83f286 | ||
|
|
1612ebc539 | ||
|
|
1ddb8a8bf1 | ||
|
|
bbcdbc2e7c | ||
|
|
d94bbd1573 | ||
|
|
583e14efcd | ||
|
|
b96803e3a0 | ||
|
|
c03cb11aaf | ||
|
|
5de881e668 | ||
|
|
964505398d | ||
|
|
16f2958ad7 | ||
|
|
332b92ebab | ||
|
|
b9f66a342c | ||
|
|
23ce796450 | ||
|
|
df6d316dc2 | ||
|
|
82a93ce645 | ||
|
|
5ceaca66f5 | ||
|
|
4c0e35776b | ||
|
|
cc1f213d84 | ||
|
|
4c18037e6a | ||
|
|
7f0ccdadcd | ||
|
|
8ac9499b45 | ||
|
|
8094d68acc | ||
|
|
80066c22b2 | ||
|
|
8f78f3b253 |
@@ -4,13 +4,16 @@
|
|||||||
|
|
||||||
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
|
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
|
||||||
|
|
||||||
|
#include "atom/browser/atom_browser_context.h"
|
||||||
#include "atom/browser/login_handler.h"
|
#include "atom/browser/login_handler.h"
|
||||||
#include "atom/browser/web_contents_permission_helper.h"
|
#include "atom/browser/web_contents_permission_helper.h"
|
||||||
|
#include "atom/browser/web_contents_preferences.h"
|
||||||
#include "atom/common/atom_constants.h"
|
#include "atom/common/atom_constants.h"
|
||||||
#include "atom/common/platform_util.h"
|
#include "atom/common/platform_util.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
|
#include "content/public/browser/download_manager.h"
|
||||||
#include "content/public/browser/stream_info.h"
|
#include "content/public/browser/stream_info.h"
|
||||||
#include "net/base/escape.h"
|
#include "net/base/escape.h"
|
||||||
#include "net/ssl/client_cert_store.h"
|
#include "net/ssl/client_cert_store.h"
|
||||||
@@ -69,6 +72,17 @@ void OnPdfResourceIntercepted(
|
|||||||
if (!web_contents)
|
if (!web_contents)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!WebContentsPreferences::IsPluginsEnabled(web_contents)) {
|
||||||
|
auto browser_context = web_contents->GetBrowserContext();
|
||||||
|
auto download_manager =
|
||||||
|
content::BrowserContext::GetDownloadManager(browser_context);
|
||||||
|
|
||||||
|
download_manager->DownloadUrl(
|
||||||
|
content::DownloadUrlParameters::CreateForWebContentsMainFrame(
|
||||||
|
web_contents, original_url));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// The URL passes the original pdf resource url, that will be requested
|
// The URL passes the original pdf resource url, that will be requested
|
||||||
// by the webui page.
|
// by the webui page.
|
||||||
// chrome://pdf-viewer/index.html?src=https://somepage/123.pdf
|
// chrome://pdf-viewer/index.html?src=https://somepage/123.pdf
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string>electron.icns</string>
|
<string>electron.icns</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.6.9</string>
|
<string>1.6.13</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.6.9</string>
|
<string>1.6.13</string>
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
<string>public.app-category.developer-tools</string>
|
<string>public.app-category.developer-tools</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ END
|
|||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,6,9,0
|
FILEVERSION 1,6,13,0
|
||||||
PRODUCTVERSION 1,6,9,0
|
PRODUCTVERSION 1,6,13,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", "1.6.9"
|
VALUE "FileVersion", "1.6.13"
|
||||||
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", "1.6.9"
|
VALUE "ProductVersion", "1.6.13"
|
||||||
VALUE "SquirrelAwareVersion", "1"
|
VALUE "SquirrelAwareVersion", "1"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|||||||
@@ -163,6 +163,18 @@ void SetMenuItemID(DbusmenuMenuitem* item, int id) {
|
|||||||
g_object_set_data(G_OBJECT(item), "menu-id", GINT_TO_POINTER(id + 1));
|
g_object_set_data(G_OBJECT(item), "menu-id", GINT_TO_POINTER(id + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string GetMenuModelStatus(AtomMenuModel* model) {
|
||||||
|
std::string ret;
|
||||||
|
for (int i = 0; i < model->GetItemCount(); ++i) {
|
||||||
|
int status = model->GetTypeAt(i) | (model->IsVisibleAt(i) << 3)
|
||||||
|
| (model->IsEnabledAt(i) << 4)
|
||||||
|
| (model->IsItemCheckedAt(i) << 5);
|
||||||
|
ret += base::StringPrintf(
|
||||||
|
"%s-%X\n", base::UTF16ToUTF8(model->GetLabelAt(i)).c_str(), status);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
GlobalMenuBarX11::GlobalMenuBarX11(NativeWindowViews* window)
|
GlobalMenuBarX11::GlobalMenuBarX11(NativeWindowViews* window)
|
||||||
@@ -307,6 +319,16 @@ void GlobalMenuBarX11::OnSubMenuShow(DbusmenuMenuitem* item) {
|
|||||||
if (!model || !GetMenuItemID(item, &id))
|
if (!model || !GetMenuItemID(item, &id))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Do not update menu if the submenu has not been changed.
|
||||||
|
std::string status = GetMenuModelStatus(model);
|
||||||
|
char* old = static_cast<char*>(g_object_get_data(G_OBJECT(item), "status"));
|
||||||
|
if (old && status == old)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Save the new status.
|
||||||
|
g_object_set_data_full(G_OBJECT(item), "status", g_strdup(status.c_str()),
|
||||||
|
g_free);
|
||||||
|
|
||||||
// Clear children.
|
// Clear children.
|
||||||
GList *children = menuitem_take_children(item);
|
GList *children = menuitem_take_children(item);
|
||||||
g_list_foreach(children, reinterpret_cast<GFunc>(g_object_unref), NULL);
|
g_list_foreach(children, reinterpret_cast<GFunc>(g_object_unref), NULL);
|
||||||
|
|||||||
@@ -197,7 +197,9 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebContentsPreferences::IsSandboxed(content::WebContents* web_contents) {
|
bool WebContentsPreferences::IsPreferenceEnabled(
|
||||||
|
const std::string& attribute_name,
|
||||||
|
content::WebContents* web_contents) {
|
||||||
WebContentsPreferences* self;
|
WebContentsPreferences* self;
|
||||||
if (!web_contents)
|
if (!web_contents)
|
||||||
return false;
|
return false;
|
||||||
@@ -207,9 +209,18 @@ bool WebContentsPreferences::IsSandboxed(content::WebContents* web_contents) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
base::DictionaryValue& web_preferences = self->web_preferences_;
|
base::DictionaryValue& web_preferences = self->web_preferences_;
|
||||||
bool sandboxed = false;
|
bool bool_value = false;
|
||||||
web_preferences.GetBoolean("sandbox", &sandboxed);
|
web_preferences.GetBoolean(attribute_name, &bool_value);
|
||||||
return sandboxed;
|
return bool_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WebContentsPreferences::IsSandboxed(content::WebContents* web_contents) {
|
||||||
|
return IsPreferenceEnabled("sandbox", web_contents);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WebContentsPreferences::IsPluginsEnabled(
|
||||||
|
content::WebContents* web_contents) {
|
||||||
|
return IsPreferenceEnabled("plugins", web_contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|||||||
@@ -37,7 +37,10 @@ class WebContentsPreferences
|
|||||||
static void AppendExtraCommandLineSwitches(
|
static void AppendExtraCommandLineSwitches(
|
||||||
content::WebContents* web_contents, base::CommandLine* command_line);
|
content::WebContents* web_contents, base::CommandLine* command_line);
|
||||||
|
|
||||||
|
static bool IsPreferenceEnabled(const std::string& attribute_name,
|
||||||
|
content::WebContents* web_contents);
|
||||||
static bool IsSandboxed(content::WebContents* web_contents);
|
static bool IsSandboxed(content::WebContents* web_contents);
|
||||||
|
static bool IsPluginsEnabled(content::WebContents* web_contents);
|
||||||
|
|
||||||
// Modify the WebPreferences according to |web_contents|'s preferences.
|
// Modify the WebPreferences according to |web_contents|'s preferences.
|
||||||
static void OverrideWebkitPrefs(
|
static void OverrideWebkitPrefs(
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#define ATOM_MAJOR_VERSION 1
|
#define ATOM_MAJOR_VERSION 1
|
||||||
#define ATOM_MINOR_VERSION 6
|
#define ATOM_MINOR_VERSION 6
|
||||||
#define ATOM_PATCH_VERSION 9
|
#define ATOM_PATCH_VERSION 13
|
||||||
|
|
||||||
#define ATOM_VERSION_IS_RELEASE 1
|
#define ATOM_VERSION_IS_RELEASE 1
|
||||||
|
|
||||||
|
|||||||
@@ -200,7 +200,10 @@ void WebFrame::RegisterURLSchemeAsPrivileged(const std::string& scheme,
|
|||||||
void WebFrame::InsertText(const std::string& text) {
|
void WebFrame::InsertText(const std::string& text) {
|
||||||
web_frame_->frameWidget()
|
web_frame_->frameWidget()
|
||||||
->getActiveWebInputMethodController()
|
->getActiveWebInputMethodController()
|
||||||
->commitText(blink::WebString::fromUTF8(text), 0);
|
->commitText(blink::WebString::fromUTF8(text),
|
||||||
|
blink::WebVector<blink::WebCompositionUnderline>(),
|
||||||
|
blink::WebRange(),
|
||||||
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebFrame::InsertCSS(const std::string& css) {
|
void WebFrame::InsertCSS(const std::string& css) {
|
||||||
|
|||||||
@@ -135,7 +135,12 @@ void AtomRendererClient::WillReleaseScriptContext(
|
|||||||
node_bindings_->set_uv_env(nullptr);
|
node_bindings_->set_uv_env(nullptr);
|
||||||
|
|
||||||
// Destroy the node environment.
|
// Destroy the node environment.
|
||||||
node::FreeEnvironment(env);
|
// This is disabled because pending async tasks may still use the environment
|
||||||
|
// and would cause crashes later. Node does not seem to clear all async tasks
|
||||||
|
// when the environment is destroyed.
|
||||||
|
// node::FreeEnvironment(env);
|
||||||
|
|
||||||
|
// AtomBindings is tracking node environments.
|
||||||
atom_bindings_->EnvironmentDestroyed(env);
|
atom_bindings_->EnvironmentDestroyed(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -667,6 +667,8 @@ app.setJumpList([
|
|||||||
* `argv` String[] - An array of the second instance's command line arguments
|
* `argv` String[] - An array of the second instance's command line arguments
|
||||||
* `workingDirectory` String - The second instance's working directory
|
* `workingDirectory` String - The second instance's working directory
|
||||||
|
|
||||||
|
Returns `Boolean`.
|
||||||
|
|
||||||
This method makes your application a Single Instance Application - instead of
|
This method makes your application a Single Instance Application - instead of
|
||||||
allowing multiple instances of your app to run, this will ensure that only a
|
allowing multiple instances of your app to run, this will ensure that only a
|
||||||
single instance of your app is running, and other instances signal this
|
single instance of your app is running, and other instances signal this
|
||||||
|
|||||||
@@ -44,31 +44,31 @@ Objects created with `new BrowserView` have the following properties:
|
|||||||
|
|
||||||
#### `view.webContents` _Experimental_
|
#### `view.webContents` _Experimental_
|
||||||
|
|
||||||
A [`webContents`](web-contents.md) object owned by this view.
|
A [`WebContents`](web-contents.md) object owned by this view.
|
||||||
|
|
||||||
#### `win.id` _Experimental_
|
#### `view.id` _Experimental_
|
||||||
|
|
||||||
A `Integer` representing the unique ID of the view.
|
A `Integer` representing the unique ID of the view.
|
||||||
|
|
||||||
### Instance Methods
|
### Instance Methods
|
||||||
|
|
||||||
Objects created with `new BrowserWindow` have the following instance methods:
|
Objects created with `new BrowserView` have the following instance methods:
|
||||||
|
|
||||||
#### `win.setAutoResize(options)` _Experimental_
|
#### `view.setAutoResize(options)` _Experimental_
|
||||||
|
|
||||||
* `options` Object
|
* `options` Object
|
||||||
* `width`: If `true`, the view's width will grow and shrink together with
|
* `width` Boolean - If `true`, the view's width will grow and shrink together
|
||||||
the window. `false` by default.
|
with the window. `false` by default.
|
||||||
* `height`: If `true`, the view's height will grow and shrink together with
|
* `height` Boolean - If `true`, the view's height will grow and shrink
|
||||||
the window. `false` by default.
|
together with the window. `false` by default.
|
||||||
|
|
||||||
#### `win.setBounds(bounds)` _Experimental_
|
#### `view.setBounds(bounds)` _Experimental_
|
||||||
|
|
||||||
* `bounds` [Rectangle](structures/rectangle.md)
|
* `bounds` [Rectangle](structures/rectangle.md)
|
||||||
|
|
||||||
Resizes and moves the view to the supplied bounds relative to the window.
|
Resizes and moves the view to the supplied bounds relative to the window.
|
||||||
|
|
||||||
#### `win.setBackgroundColor(color)` _Experimental_
|
#### `view.setBackgroundColor(color)` _Experimental_
|
||||||
|
|
||||||
* `color` String - Color in `#aarrggbb` or `#argb` form. The alpha channel is
|
* `color` String - Color in `#aarrggbb` or `#argb` form. The alpha channel is
|
||||||
optional.
|
optional.
|
||||||
|
|||||||
@@ -1027,7 +1027,7 @@ Same as `webContents.capturePage([rect, ]callback)`.
|
|||||||
* `httpReferrer` String (optional) - A HTTP Referrer url.
|
* `httpReferrer` String (optional) - A HTTP Referrer url.
|
||||||
* `userAgent` String (optional) - A user agent originating the request.
|
* `userAgent` String (optional) - A user agent originating the request.
|
||||||
* `extraHeaders` String (optional) - Extra headers separated by "\n"
|
* `extraHeaders` String (optional) - Extra headers separated by "\n"
|
||||||
* `postData` ([UploadRawData](structures/upload-raw-data.md) | [UploadFile](structures/upload-file.md) | [UploadFileSystem](structures/upload-file-system.md) | [UploadBlob](structures/upload-blob.md))[] - (optional)
|
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md) | [UploadFileSystem[]](structures/upload-file-system.md) | [UploadBlob[]](structures/upload-blob.md)) - (optional)
|
||||||
* `baseURLForDataURL` String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified `url` is a data url and needs to load other files.
|
* `baseURLForDataURL` String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified `url` is a data url and needs to load other files.
|
||||||
|
|
||||||
Same as `webContents.loadURL(url[, options])`.
|
Same as `webContents.loadURL(url[, options])`.
|
||||||
|
|||||||
@@ -153,6 +153,8 @@ Creates a new `NativeImage` instance from `buffer`.
|
|||||||
|
|
||||||
* `dataURL` String
|
* `dataURL` String
|
||||||
|
|
||||||
|
Returns `NativeImage`
|
||||||
|
|
||||||
Creates a new `NativeImage` instance from `dataURL`.
|
Creates a new `NativeImage` instance from `dataURL`.
|
||||||
|
|
||||||
## Class: NativeImage
|
## Class: NativeImage
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# MemoryInfo Object
|
# MemoryInfo Object
|
||||||
|
|
||||||
* `workingSetSize` Integer - Process id of the process.
|
* `pid` Integer - Process id of the process.
|
||||||
* `workingSetSize` Integer - The amount of memory currently pinned to actual physical RAM.
|
* `workingSetSize` Integer - The amount of memory currently pinned to actual physical RAM.
|
||||||
* `peakWorkingSetSize` Integer - The maximum amount of memory that has ever been pinned
|
* `peakWorkingSetSize` Integer - The maximum amount of memory that has ever been pinned
|
||||||
to actual physical RAM.
|
to actual physical RAM.
|
||||||
@@ -9,4 +9,4 @@
|
|||||||
* `sharedBytes` Integer - The amount of memory shared between processes, typically
|
* `sharedBytes` Integer - The amount of memory shared between processes, typically
|
||||||
memory consumed by the Electron code itself
|
memory consumed by the Electron code itself
|
||||||
|
|
||||||
Note that all statistics are reported in Kilobytes.
|
Note that all statistics are reported in Kilobytes.
|
||||||
|
|||||||
@@ -537,7 +537,7 @@ that can't be set via `<webview>` attributes.
|
|||||||
* `httpReferrer` String (optional) - A HTTP Referrer url.
|
* `httpReferrer` String (optional) - A HTTP Referrer url.
|
||||||
* `userAgent` String (optional) - A user agent originating the request.
|
* `userAgent` String (optional) - A user agent originating the request.
|
||||||
* `extraHeaders` String (optional) - Extra headers separated by "\n"
|
* `extraHeaders` String (optional) - Extra headers separated by "\n"
|
||||||
* `postData` ([UploadRawData](structures/upload-raw-data.md) | [UploadFile](structures/upload-file.md) | [UploadFileSystem](structures/upload-file-system.md) | [UploadBlob](structures/upload-blob.md))[] - (optional)
|
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md) | [UploadFileSystem[]](structures/upload-file-system.md) | [UploadBlob[]](structures/upload-blob.md)) - (optional)
|
||||||
* `baseURLForDataURL` String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified `url` is a data url and needs to load other files.
|
* `baseURLForDataURL` String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified `url` is a data url and needs to load other files.
|
||||||
|
|
||||||
Loads the `url` in the window. The `url` must contain the protocol prefix,
|
Loads the `url` in the window. The `url` must contain the protocol prefix,
|
||||||
|
|||||||
@@ -312,8 +312,8 @@ webview.addEventListener('dom-ready', () => {
|
|||||||
* `httpReferrer` String (optional) - A HTTP Referrer url.
|
* `httpReferrer` String (optional) - A HTTP Referrer url.
|
||||||
* `userAgent` String (optional) - A user agent originating the request.
|
* `userAgent` String (optional) - A user agent originating the request.
|
||||||
* `extraHeaders` String (optional) - Extra headers separated by "\n"
|
* `extraHeaders` String (optional) - Extra headers separated by "\n"
|
||||||
* `postData` ([UploadRawData](structures/upload-raw-data.md) | [UploadFile](structures/upload-file.md) | [UploadFileSystem](structures/upload-file-system.md) | [UploadBlob](structures/upload-blob.md))[] - (optional)
|
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md) | [UploadFileSystem[]](structures/upload-file-system.md) | [UploadBlob[]](structures/upload-blob.md)) - (optional)
|
||||||
* `baseURLForDataURL` String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified `url` is a data url and needs to load other files.
|
* `baseURLForDataURL` String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified `url` is a data url and needs to load other files.
|
||||||
|
|
||||||
Loads the `url` in the webview, the `url` must contain the protocol prefix,
|
Loads the `url` in the webview, the `url` must contain the protocol prefix,
|
||||||
e.g. the `http://` or `file://`.
|
e.g. the `http://` or `file://`.
|
||||||
@@ -511,14 +511,14 @@ Inserts `text` to the focused element.
|
|||||||
|
|
||||||
* `text` String - Content to be searched, must not be empty.
|
* `text` String - Content to be searched, must not be empty.
|
||||||
* `options` Object (optional)
|
* `options` Object (optional)
|
||||||
* `forward` Boolean - Whether to search forward or backward, defaults to `true`.
|
* `forward` Boolean - (optional) Whether to search forward or backward, defaults to `true`.
|
||||||
* `findNext` Boolean - Whether the operation is first request or a follow up,
|
* `findNext` Boolean - (optional) Whether the operation is first request or a follow up,
|
||||||
defaults to `false`.
|
defaults to `false`.
|
||||||
* `matchCase` Boolean - Whether search should be case-sensitive,
|
* `matchCase` Boolean - (optional) Whether search should be case-sensitive,
|
||||||
defaults to `false`.
|
defaults to `false`.
|
||||||
* `wordStart` Boolean - Whether to look only at the start of words.
|
* `wordStart` Boolean - (optional) Whether to look only at the start of words.
|
||||||
defaults to `false`.
|
defaults to `false`.
|
||||||
* `medialCapitalAsWordStart` Boolean - When combined with `wordStart`,
|
* `medialCapitalAsWordStart` Boolean - (optional) When combined with `wordStart`,
|
||||||
accepts a match in the middle of a word if the match begins with an
|
accepts a match in the middle of a word if the match begins with an
|
||||||
uppercase letter followed by a lowercase or non-letter.
|
uppercase letter followed by a lowercase or non-letter.
|
||||||
Accepts several other intra-word matches, defaults to `false`.
|
Accepts several other intra-word matches, defaults to `false`.
|
||||||
|
|||||||
@@ -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%': '1.6.9',
|
'version%': '1.6.13',
|
||||||
'js2c_input_dir': '<(SHARED_INTERMEDIATE_DIR)/js2c',
|
'js2c_input_dir': '<(SHARED_INTERMEDIATE_DIR)/js2c',
|
||||||
},
|
},
|
||||||
'includes': [
|
'includes': [
|
||||||
|
|||||||
@@ -394,6 +394,11 @@ ipcMain.on('ELECTRON_BROWSER_DEREFERENCE', function (event, id) {
|
|||||||
objectsRegistry.remove(event.sender.getId(), id)
|
objectsRegistry.remove(event.sender.getId(), id)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ipcMain.on('ELECTRON_BROWSER_CONTEXT_RELEASE', (e) => {
|
||||||
|
objectsRegistry.clear(e.sender.getId())
|
||||||
|
e.returnValue = null
|
||||||
|
})
|
||||||
|
|
||||||
ipcMain.on('ELECTRON_BROWSER_GUEST_WEB_CONTENTS', function (event, guestInstanceId) {
|
ipcMain.on('ELECTRON_BROWSER_GUEST_WEB_CONTENTS', function (event, guestInstanceId) {
|
||||||
try {
|
try {
|
||||||
let guestViewManager = require('./guest-view-manager')
|
let guestViewManager = require('./guest-view-manager')
|
||||||
|
|||||||
@@ -304,6 +304,10 @@ ipcRenderer.on('ELECTRON_RENDERER_RELEASE_CALLBACK', function (event, id) {
|
|||||||
callbacksRegistry.remove(id)
|
callbacksRegistry.remove(id)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
process.on('exit', () => {
|
||||||
|
ipcRenderer.sendSync('ELECTRON_BROWSER_CONTEXT_RELEASE')
|
||||||
|
})
|
||||||
|
|
||||||
// Get remote module.
|
// Get remote module.
|
||||||
exports.require = function (module) {
|
exports.require = function (module) {
|
||||||
return metaToValue(ipcRenderer.sendSync('ELECTRON_BROWSER_REQUIRE', module))
|
return metaToValue(ipcRenderer.sendSync('ELECTRON_BROWSER_REQUIRE', module))
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "electron",
|
"name": "electron",
|
||||||
"version": "1.6.9",
|
"version": "1.6.13",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"asar": "^0.11.0",
|
"asar": "^0.11.0",
|
||||||
"browserify": "^13.1.0",
|
"browserify": "^13.1.0",
|
||||||
"electabul": "~0.0.4",
|
"electabul": "~0.0.4",
|
||||||
"electron-docs-linter": "^2.1.0",
|
"electron-docs-linter": "^2.3.3",
|
||||||
"electron-typescript-definitions": "^1.2.0",
|
"electron-typescript-definitions": "1.2.7",
|
||||||
"request": "*",
|
"request": "*",
|
||||||
"standard": "^8.4.0",
|
"standard": "^8.4.0",
|
||||||
"standard-markdown": "^2.1.1"
|
"standard-markdown": "^2.1.1"
|
||||||
@@ -40,6 +40,8 @@
|
|||||||
"lint-py": "python ./script/pylint.py",
|
"lint-py": "python ./script/pylint.py",
|
||||||
"lint-api-docs-js": "standard-markdown docs && standard-markdown docs-translations",
|
"lint-api-docs-js": "standard-markdown docs && standard-markdown docs-translations",
|
||||||
"lint-api-docs": "electron-docs-linter",
|
"lint-api-docs": "electron-docs-linter",
|
||||||
|
"create-api-json": "electron-docs-linter docs --outfile=out/electron-api.json --version=$npm_package_version",
|
||||||
|
"create-typescript-definitions": "npm run create-api-json && electron-typescript-definitions --in=out/electron-api.json --out=out/electron.d.ts",
|
||||||
"preinstall": "node -e 'process.exit(0)'",
|
"preinstall": "node -e 'process.exit(0)'",
|
||||||
"release": "./script/upload.py -p",
|
"release": "./script/upload.py -p",
|
||||||
"repl": "python ./script/start.py --interactive",
|
"repl": "python ./script/start.py --interactive",
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ def main():
|
|||||||
os.environ.get('PATH', '')])
|
os.environ.get('PATH', '')])
|
||||||
|
|
||||||
is_release = os.environ.has_key('ELECTRON_RELEASE')
|
is_release = os.environ.has_key('ELECTRON_RELEASE')
|
||||||
args = ['--target_arch=' + target_arch]
|
args = ['--target_arch=' + target_arch, '-v']
|
||||||
if not is_release:
|
if not is_release:
|
||||||
args += ['--dev']
|
args += ['--dev']
|
||||||
run_script('bootstrap.py', args)
|
run_script('bootstrap.py', args)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import sys
|
|||||||
BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \
|
BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \
|
||||||
'https://s3.amazonaws.com/github-janky-artifacts/libchromiumcontent'
|
'https://s3.amazonaws.com/github-janky-artifacts/libchromiumcontent'
|
||||||
LIBCHROMIUMCONTENT_COMMIT = os.getenv('LIBCHROMIUMCONTENT_COMMIT') or \
|
LIBCHROMIUMCONTENT_COMMIT = os.getenv('LIBCHROMIUMCONTENT_COMMIT') or \
|
||||||
'4a0e32606e52c12c50c2e3a0973d015d8cdff494'
|
'a46563ffdf1c3867ecfd19e10d5cf4f0c9f59bca'
|
||||||
|
|
||||||
PLATFORM = {
|
PLATFORM = {
|
||||||
'cygwin': 'win32',
|
'cygwin': 'win32',
|
||||||
|
|||||||
@@ -189,8 +189,8 @@ def create_release_draft(github, tag):
|
|||||||
if body == '':
|
if body == '':
|
||||||
sys.stderr.write('Quit due to empty release note.\n')
|
sys.stderr.write('Quit due to empty release note.\n')
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
data = dict(tag_name=tag, name=name, body=body, draft=True,
|
||||||
data = dict(tag_name=tag, name=name, body=body, draft=True)
|
target_commitish='1-6-x')
|
||||||
r = github.repos(ELECTRON_REPO).releases.post(data=data)
|
r = github.repos(ELECTRON_REPO).releases.post(data=data)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|||||||
@@ -1161,7 +1161,6 @@ describe('BrowserWindow module', function () {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
w.loadURL('file://' + path.join(fixtures, 'api', 'sandbox.html?allocate-memory'))
|
w.loadURL('file://' + path.join(fixtures, 'api', 'sandbox.html?allocate-memory'))
|
||||||
w.webContents.openDevTools({mode: 'detach'})
|
|
||||||
ipcMain.once('answer', function (event, {bytesBeforeOpen, bytesAfterOpen, bytesAfterClose}) {
|
ipcMain.once('answer', function (event, {bytesBeforeOpen, bytesAfterOpen, bytesAfterClose}) {
|
||||||
const memoryIncreaseByOpen = bytesAfterOpen - bytesBeforeOpen
|
const memoryIncreaseByOpen = bytesAfterOpen - bytesBeforeOpen
|
||||||
const memoryDecreaseByClose = bytesAfterOpen - bytesAfterClose
|
const memoryDecreaseByClose = bytesAfterOpen - bytesAfterClose
|
||||||
@@ -1173,6 +1172,73 @@ describe('BrowserWindow module', function () {
|
|||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// see #9387
|
||||||
|
it('properly manages remote object references after page reload', (done) => {
|
||||||
|
w.destroy()
|
||||||
|
w = new BrowserWindow({
|
||||||
|
show: false,
|
||||||
|
webPreferences: {
|
||||||
|
preload: preload,
|
||||||
|
sandbox: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
w.loadURL('file://' + path.join(fixtures, 'api', 'sandbox.html?reload-remote'))
|
||||||
|
|
||||||
|
ipcMain.on('get-remote-module-path', (event) => {
|
||||||
|
event.returnValue = path.join(fixtures, 'module', 'hello.js')
|
||||||
|
})
|
||||||
|
|
||||||
|
let reload = false
|
||||||
|
ipcMain.on('reloaded', (event) => {
|
||||||
|
event.returnValue = reload
|
||||||
|
reload = !reload
|
||||||
|
})
|
||||||
|
|
||||||
|
ipcMain.once('reload', (event) => {
|
||||||
|
event.sender.reload()
|
||||||
|
})
|
||||||
|
|
||||||
|
ipcMain.once('answer', (event, arg) => {
|
||||||
|
ipcMain.removeAllListeners('reloaded')
|
||||||
|
ipcMain.removeAllListeners('get-remote-module-path')
|
||||||
|
assert.equal(arg, 'hi')
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('properly manages remote object references after page reload in child window', (done) => {
|
||||||
|
w.destroy()
|
||||||
|
w = new BrowserWindow({
|
||||||
|
show: false,
|
||||||
|
webPreferences: {
|
||||||
|
preload: preload,
|
||||||
|
sandbox: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
w.loadURL('file://' + path.join(fixtures, 'api', 'sandbox.html?reload-remote-child'))
|
||||||
|
|
||||||
|
ipcMain.on('get-remote-module-path', (event) => {
|
||||||
|
event.returnValue = path.join(fixtures, 'module', 'hello-child.js')
|
||||||
|
})
|
||||||
|
|
||||||
|
let reload = false
|
||||||
|
ipcMain.on('reloaded', (event) => {
|
||||||
|
event.returnValue = reload
|
||||||
|
reload = !reload
|
||||||
|
})
|
||||||
|
|
||||||
|
ipcMain.once('reload', (event) => {
|
||||||
|
event.sender.reload()
|
||||||
|
})
|
||||||
|
|
||||||
|
ipcMain.once('answer', (event, arg) => {
|
||||||
|
ipcMain.removeAllListeners('reloaded')
|
||||||
|
ipcMain.removeAllListeners('get-remote-module-path')
|
||||||
|
assert.equal(arg, 'hi child window')
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ const url = require('url')
|
|||||||
const {closeWindow} = require('./window-helpers')
|
const {closeWindow} = require('./window-helpers')
|
||||||
|
|
||||||
const {remote} = require('electron')
|
const {remote} = require('electron')
|
||||||
|
const isCI = remote.getGlobal('isCi')
|
||||||
const {app, BrowserWindow, crashReporter} = remote.require('electron')
|
const {app, BrowserWindow, crashReporter} = remote.require('electron')
|
||||||
|
|
||||||
describe('crashReporter module', function () {
|
describe('crashReporter module', function () {
|
||||||
@@ -16,6 +17,12 @@ describe('crashReporter module', function () {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME internal Linux CI is failing when it detects a process crashes
|
||||||
|
// which is a false positive here since crashes are explicitly triggered
|
||||||
|
if (isCI && process.platform === 'linux') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var originalTempDirectory = null
|
var originalTempDirectory = null
|
||||||
var tempDirectory = null
|
var tempDirectory = null
|
||||||
|
|
||||||
|
|||||||
@@ -952,16 +952,18 @@ describe('chromium feature', function () {
|
|||||||
slashes: true
|
slashes: true
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(function () {
|
function createBrowserWindow ({plugins}) {
|
||||||
w = new BrowserWindow({
|
w = new BrowserWindow({
|
||||||
show: false,
|
show: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.join(fixtures, 'module', 'preload-inject-ipc.js')
|
preload: path.join(fixtures, 'module', 'preload-inject-ipc.js'),
|
||||||
|
plugins: plugins
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
it('opens when loading a pdf resource as top level navigation', function (done) {
|
it('opens when loading a pdf resource as top level navigation', function (done) {
|
||||||
|
createBrowserWindow({plugins: true})
|
||||||
ipcMain.once('pdf-loaded', function (event, success) {
|
ipcMain.once('pdf-loaded', function (event, success) {
|
||||||
if (success) done()
|
if (success) done()
|
||||||
})
|
})
|
||||||
@@ -983,7 +985,21 @@ describe('chromium feature', function () {
|
|||||||
w.webContents.loadURL(pdfSource)
|
w.webContents.loadURL(pdfSource)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should download a pdf when plugins are disabled', function (done) {
|
||||||
|
createBrowserWindow({plugins: false})
|
||||||
|
ipcRenderer.sendSync('set-download-option', false, false)
|
||||||
|
ipcRenderer.once('download-done', function (event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename) {
|
||||||
|
assert.equal(state, 'completed')
|
||||||
|
assert.equal(filename, 'cat.pdf')
|
||||||
|
assert.equal(mimeType, 'application/pdf')
|
||||||
|
fs.unlinkSync(path.join(fixtures, 'mock.pdf'))
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
w.webContents.loadURL(pdfSource)
|
||||||
|
})
|
||||||
|
|
||||||
it('should not open when pdf is requested as sub resource', function (done) {
|
it('should not open when pdf is requested as sub resource', function (done) {
|
||||||
|
createBrowserWindow({plugins: true})
|
||||||
webFrame.registerURLSchemeAsPrivileged('file', {
|
webFrame.registerURLSchemeAsPrivileged('file', {
|
||||||
secure: false,
|
secure: false,
|
||||||
bypassCSP: false,
|
bypassCSP: false,
|
||||||
|
|||||||
20
spec/fixtures/api/sandbox.html
vendored
20
spec/fixtures/api/sandbox.html
vendored
@@ -13,13 +13,28 @@
|
|||||||
await timeout(100)
|
await timeout(100)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (window.opener) {
|
|
||||||
|
const [,test] = window.location.href.split('?')
|
||||||
|
if (window.opener && test !== 'reload-remote') {
|
||||||
window.callback = () => {
|
window.callback = () => {
|
||||||
opener.require('electron').ipcRenderer.send('answer', document.body.innerHTML)
|
opener.require('electron').ipcRenderer.send('answer', document.body.innerHTML)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const {ipcRenderer} = require('electron')
|
const {ipcRenderer, remote} = require('electron')
|
||||||
const tests = {
|
const tests = {
|
||||||
|
'reload-remote-child': () => {
|
||||||
|
open(`${location.protocol}//${location.pathname}?reload-remote`)
|
||||||
|
},
|
||||||
|
'reload-remote': async () => {
|
||||||
|
const p = ipcRenderer.sendSync('get-remote-module-path')
|
||||||
|
const Hello = remote.require(p)
|
||||||
|
if (!ipcRenderer.sendSync('reloaded')) {
|
||||||
|
ipcRenderer.send('reload')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await invokeGc()
|
||||||
|
ipcRenderer.send('answer', new Hello().say())
|
||||||
|
},
|
||||||
'allocate-memory': async () => {
|
'allocate-memory': async () => {
|
||||||
await invokeGc()
|
await invokeGc()
|
||||||
const {privateBytes: bytesBeforeOpen} = process.getProcessMemoryInfo()
|
const {privateBytes: bytesBeforeOpen} = process.getProcessMemoryInfo()
|
||||||
@@ -95,7 +110,6 @@
|
|||||||
popup.close()
|
popup.close()
|
||||||
}, false)
|
}, false)
|
||||||
|
|
||||||
let [,test] = window.location.href.split('?')
|
|
||||||
if (tests.hasOwnProperty(test))
|
if (tests.hasOwnProperty(test))
|
||||||
tests[test]()
|
tests[test]()
|
||||||
}
|
}
|
||||||
|
|||||||
6
spec/fixtures/module/hello-child.js
vendored
Normal file
6
spec/fixtures/module/hello-child.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
class Hello {
|
||||||
|
say () {
|
||||||
|
return 'hi child window'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.exports = Hello
|
||||||
6
spec/fixtures/module/hello.js
vendored
Normal file
6
spec/fixtures/module/hello.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
class Hello {
|
||||||
|
say () {
|
||||||
|
return 'hi'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.exports = Hello
|
||||||
2
spec/fixtures/module/preload-sandbox.js
vendored
2
spec/fixtures/module/preload-sandbox.js
vendored
@@ -3,9 +3,9 @@
|
|||||||
const {ipcRenderer} = require('electron')
|
const {ipcRenderer} = require('electron')
|
||||||
window.ipcRenderer = ipcRenderer
|
window.ipcRenderer = ipcRenderer
|
||||||
window.setImmediate = setImmediate
|
window.setImmediate = setImmediate
|
||||||
|
window.require = require
|
||||||
if (location.protocol === 'file:') {
|
if (location.protocol === 'file:') {
|
||||||
window.test = 'preload'
|
window.test = 'preload'
|
||||||
window.require = require
|
|
||||||
window.process = process
|
window.process = process
|
||||||
} else if (location.href !== 'about:blank') {
|
} else if (location.href !== 'about:blank') {
|
||||||
addEventListener('DOMContentLoaded', () => {
|
addEventListener('DOMContentLoaded', () => {
|
||||||
|
|||||||
2
vendor/node
vendored
2
vendor/node
vendored
Submodule vendor/node updated: 3fe90cfcf5...9b1683e700
Reference in New Issue
Block a user