feat: Upgrade to Chromium 71.0.3578.98 (#15966)

This commit is contained in:
Robo 2019-01-12 06:30:43 +05:30 committed by Jeremy Apthorp
parent 92ddfd0d4c
commit 52fe92d02e
204 changed files with 2291 additions and 1760 deletions

View file

@ -25,7 +25,8 @@
#include "third_party/blink/public/web/web_document.h"
#include "atom/common/node_includes.h"
#include "atom_natives.h" // NOLINT: This file is generated with js2c
#include "third_party/electron_node/src/node_binding.h"
#include "third_party/electron_node/src/node_native_module.h"
namespace atom {
@ -68,7 +69,7 @@ v8::Local<v8::Value> GetBinding(v8::Isolate* isolate,
return exports;
}
auto* mod = node::get_builtin_module(module_key.c_str());
auto* mod = node::binding::get_builtin_module(module_key.c_str());
if (!mod) {
char errmsg[1024];
@ -182,30 +183,21 @@ void AtomSandboxedRendererClient::DidCreateScriptContext(
!IsDevToolsExtension(render_frame))
return;
// Wrap the bundle into a function that receives the binding object as
// argument.
auto* isolate = context->GetIsolate();
v8::HandleScope handle_scope(isolate);
v8::Context::Scope context_scope(context);
// Wrap the bundle into a function that receives the binding object and the
// preload script path as arguments.
std::string left = "(function(binding, require) {\n";
std::string right = "\n})";
// Compile the wrapper and run it to get the function object
auto source = v8::String::Concat(
isolate, mate::ConvertToV8(isolate, left)->ToString(isolate),
v8::String::Concat(isolate,
node::preload_bundle_value.ToStringChecked(isolate),
mate::ConvertToV8(isolate, right)->ToString(isolate)));
auto result = RunScript(context, source);
DCHECK(result->IsFunction());
// Create and initialize the binding object
auto binding = v8::Object::New(isolate);
InitializeBindings(binding, context);
AddRenderBindings(isolate, binding);
v8::Local<v8::Value> args[] = {binding};
// Execute the function with proper arguments
ignore_result(result.As<v8::Function>()->Call(context, v8::Null(isolate),
node::arraysize(args), args));
std::vector<v8::Local<v8::String>> preload_bundle_params = {
node::FIXED_ONE_BYTE_STRING(isolate, "binding")};
std::vector<v8::Local<v8::Value>> preload_bundle_args = {binding};
node::per_process::native_module_loader.CompileAndCall(
isolate->GetCurrentContext(), "electron/js2c/preload_bundle",
&preload_bundle_params, &preload_bundle_args, nullptr);
}
void AtomSandboxedRendererClient::WillReleaseScriptContext(