Cleanup and docs for the --js-flags
This commit is contained in:
parent
0321a77a94
commit
78934dceb9
2 changed files with 16 additions and 10 deletions
|
@ -2,11 +2,12 @@
|
||||||
// Use of this source code is governed by the MIT license that can be
|
// Use of this source code is governed by the MIT license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "atom/browser/javascript_environment.h"
|
#include "atom/browser/javascript_environment.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
|
#include "content/public/common/content_switches.h"
|
||||||
#include "gin/array_buffer.h"
|
#include "gin/array_buffer.h"
|
||||||
#include "gin/v8_initializer.h"
|
#include "gin/v8_initializer.h"
|
||||||
|
|
||||||
|
@ -30,17 +31,13 @@ bool JavascriptEnvironment::Initialize() {
|
||||||
v8::V8::SetFlagsFromString(expose_debug_as, sizeof(expose_debug_as) - 1);
|
v8::V8::SetFlagsFromString(expose_debug_as, sizeof(expose_debug_as) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string js_flags_switch = "js-flags";
|
// --js-flags.
|
||||||
|
std::string js_flags = cmd->GetSwitchValueASCII(switches::kJavaScriptFlags);
|
||||||
if (cmd->HasSwitch(js_flags_switch)) {
|
if (!js_flags.empty())
|
||||||
const char *js_flags_value =
|
v8::V8::SetFlagsFromString(js_flags.c_str(), js_flags.size());
|
||||||
(cmd->GetSwitchValueASCII(js_flags_switch)).c_str();
|
|
||||||
v8::V8::SetFlagsFromString(js_flags_value, strlen(js_flags_value));
|
|
||||||
}
|
|
||||||
|
|
||||||
gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
|
gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
|
||||||
gin::ArrayBufferAllocator::SharedInstance());
|
gin::ArrayBufferAllocator::SharedInstance());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,15 @@ Disables the disk cache for HTTP requests.
|
||||||
|
|
||||||
Enables remote debugging over HTTP on the specified `port`.
|
Enables remote debugging over HTTP on the specified `port`.
|
||||||
|
|
||||||
|
## --js-flags=`flags`
|
||||||
|
|
||||||
|
Specifies the flags passed to JS engine. It has to be passed when starting
|
||||||
|
Electron if you want to enable the `flags` in the main process.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ electron --js-flags="--harmony_proxies --harmony_collections" your-app
|
||||||
|
```
|
||||||
|
|
||||||
## --proxy-server=`address:port`
|
## --proxy-server=`address:port`
|
||||||
|
|
||||||
Use a specified proxy server, which overrides the system setting. This switch
|
Use a specified proxy server, which overrides the system setting. This switch
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue