Merge remote-tracking branch 'refs/remotes/atom/master'

This commit is contained in:
Plusb Preco 2015-11-29 18:46:01 +09:00
commit 9fbe2e6c0f
13 changed files with 57 additions and 25 deletions

View file

@ -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.35.1', 'version%': '0.35.2',
}, },
'includes': [ 'includes': [
'filenames.gypi', 'filenames.gypi',

View file

@ -17,9 +17,9 @@
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
<string>atom.icns</string> <string>atom.icns</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>0.35.1</string> <string>0.35.2</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.35.1</string> <string>0.35.2</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>

View file

@ -56,8 +56,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,35,1,0 FILEVERSION 0,35,2,0
PRODUCTVERSION 0,35,1,0 PRODUCTVERSION 0,35,2,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.35.1" VALUE "FileVersion", "0.35.2"
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.35.1" VALUE "ProductVersion", "0.35.2"
VALUE "SquirrelAwareVersion", "1" VALUE "SquirrelAwareVersion", "1"
END END
END END

View file

@ -54,7 +54,6 @@ class Archive : public mate::Wrappable {
mate::Dictionary dict(isolate, v8::Object::New(isolate)); mate::Dictionary dict(isolate, v8::Object::New(isolate));
dict.Set("size", stats.size); dict.Set("size", stats.size);
dict.Set("offset", stats.offset); dict.Set("offset", stats.offset);
dict.Set("executable", stats.executable);
dict.Set("isFile", stats.is_file); dict.Set("isFile", stats.is_file);
dict.Set("isDirectory", stats.is_directory); dict.Set("isDirectory", stats.is_directory);
dict.Set("isLink", stats.is_link); dict.Set("isLink", stats.is_link);

View file

@ -13,6 +13,7 @@
#include "atom/common/asar/scoped_temporary_file.h" #include "atom/common/asar/scoped_temporary_file.h"
#include "base/files/file.h" #include "base/files/file.h"
#include "base/files/file_util.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/pickle.h" #include "base/pickle.h"
#include "base/json/json_reader.h" #include "base/json/json_reader.h"
@ -96,7 +97,6 @@ bool FillFileInfoWithNode(Archive::FileInfo* info,
return false; return false;
info->size = static_cast<uint32>(size); info->size = static_cast<uint32>(size);
info->unpacked = false;
if (node->GetBoolean("unpacked", &info->unpacked) && info->unpacked) if (node->GetBoolean("unpacked", &info->unpacked) && info->unpacked)
return true; return true;
@ -107,7 +107,6 @@ bool FillFileInfoWithNode(Archive::FileInfo* info,
return false; return false;
info->offset += header_size; info->offset += header_size;
info->executable = false;
node->GetBoolean("executable", &info->executable); node->GetBoolean("executable", &info->executable);
return true; return true;
@ -276,6 +275,13 @@ bool Archive::CopyFileOut(const base::FilePath& path, base::FilePath* out) {
if (!temp_file->InitFromFile(&file_, info.offset, info.size)) if (!temp_file->InitFromFile(&file_, info.offset, info.size))
return false; return false;
#if defined(OS_POSIX)
if (info.executable) {
// chmod a+x temp_file;
base::SetPosixFilePermissions(temp_file->path(), 0755);
}
#endif
*out = temp_file->path(); *out = temp_file->path();
external_files_.set(path, temp_file.Pass()); external_files_.set(path, temp_file.Pass());
return true; return true;

View file

@ -25,7 +25,7 @@ class ScopedTemporaryFile;
class Archive { class Archive {
public: public:
struct FileInfo { struct FileInfo {
FileInfo() : size(0), offset(0) {} FileInfo() : unpacked(false), executable(false), size(0), offset(0) {}
bool unpacked; bool unpacked;
bool executable; bool executable;
uint32 size; uint32 size;

View file

@ -7,7 +7,7 @@
#define ATOM_MAJOR_VERSION 0 #define ATOM_MAJOR_VERSION 0
#define ATOM_MINOR_VERSION 35 #define ATOM_MINOR_VERSION 35
#define ATOM_PATCH_VERSION 1 #define ATOM_PATCH_VERSION 2
#define ATOM_VERSION_IS_RELEASE 1 #define ATOM_VERSION_IS_RELEASE 1

View file

@ -1,6 +1,5 @@
asar = process.binding 'atom_common_asar' asar = process.binding 'atom_common_asar'
child_process = require 'child_process' child_process = require 'child_process'
fs = require 'fs'
path = require 'path' path = require 'path'
util = require 'util' util = require 'util'
@ -84,11 +83,6 @@ overrideAPISync = (module, name, arg = 0) ->
newPath = archive.copyFileOut filePath newPath = archive.copyFileOut filePath
notFoundError asarPath, filePath unless newPath notFoundError asarPath, filePath unless newPath
stat = archive.stat filePath
if stat.executable
fs.chmodSync(newPath, 0o755)
arguments[arg] = newPath arguments[arg] = newPath
old.apply this, arguments old.apply this, arguments
@ -108,11 +102,6 @@ overrideAPI = (module, name, arg = 0) ->
newPath = archive.copyFileOut filePath newPath = archive.copyFileOut filePath
return notFoundError asarPath, filePath, callback unless newPath return notFoundError asarPath, filePath, callback unless newPath
stat = archive.stat filePath
if stat.executable
fs.chmodSync(newPath, 0o755)
arguments[arg] = newPath arguments[arg] = newPath
old.apply this, arguments old.apply this, arguments

View file

@ -46,7 +46,10 @@ The `global-shortcut` module has the following methods:
* `callback` Function * `callback` Function
Registers a global shortcut of `accelerator`. The `callback` is called when Registers a global shortcut of `accelerator`. The `callback` is called when
the registered shortcut is pressed by the user. the registered shortcut is pressed by the user. Returns `true` if the shortcut
`accelerator` was registered, `false` otherwise. For example, the specified
`accelerator` has already been registered by another caller or other native
applications.
### `globalShortcut.isRegistered(accelerator)` ### `globalShortcut.isRegistered(accelerator)`

View file

@ -499,7 +499,14 @@ win.webContents.on("did-finish-load", function() {
* `path` String * `path` String
Adds the specified path to DevTools workspace. Adds the specified path to DevTools workspace. Must be used after DevTools
creation:
```javascript
mainWindow.webContents.on('devtools-opened', function() {
mainWindow.webContents.addWorkSpace(__dirname);
});
```
### `webContents.removeWorkSpace(path)` ### `webContents.removeWorkSpace(path)`

View file

@ -132,6 +132,7 @@ work. This adds a little overhead for those APIs.
APIs that requires extra unpacking are: APIs that requires extra unpacking are:
* `child_process.execFile` * `child_process.execFile`
* `child_process.execFileSync`
* `fs.open` * `fs.open`
* `fs.openSync` * `fs.openSync`
* `process.dlopen` - Used by `require` on native modules * `process.dlopen` - Used by `require` on native modules
@ -143,6 +144,17 @@ archives is generated by guessing, because those files do not exist on the
filesystem. So you should not trust the `Stats` object except for getting file filesystem. So you should not trust the `Stats` object except for getting file
size and checking file type. size and checking file type.
### Executing Binaries Inside `asar` Archive
There are Node APIs that can execute binaries like `child_process.exec`,
`child_process.spawn` and `child_process.execFile`, but only `execFile` is
supported to execute binaries inside `asar` archive.
This is because `exec` and `spawn` accept `command` instead of `file` as input,
and `command`s are executed under shell. There is no reliable way to determine
whether a command uses a file in asar archive, and even if we do, we can not be
sure whether we can replace the path in command without side effects.
## Adding Unpacked Files in `asar` Archive ## Adding Unpacked Files in `asar` Archive
As stated above, some Node APIs will unpack the file to filesystem when As stated above, some Node APIs will unpack the file to filesystem when

View file

@ -392,6 +392,22 @@ describe 'asar package', ->
done() done()
child.send file child.send file
describe 'child_process.execFile', ->
return unless process.platform is 'darwin'
{execFile, execFileSync} = require 'child_process'
echo = path.join fixtures, 'asar', 'echo.asar', 'echo'
it 'executes binaries', (done) ->
child = execFile echo, ['test'], (error, stdout) ->
assert.equal error, null
assert.equal stdout, 'test\n'
done()
it 'execFileSync executes binaries', ->
output = execFileSync echo, ['test']
assert.equal String(output), 'test\n'
describe 'internalModuleReadFile', -> describe 'internalModuleReadFile', ->
internalModuleReadFile = process.binding('fs').internalModuleReadFile internalModuleReadFile = process.binding('fs').internalModuleReadFile

BIN
spec/fixtures/asar/echo.asar vendored Normal file

Binary file not shown.