Skip to content

Commit fd67c89

Browse files
GnorTechrogerwang
authored andcommitted
rebase to Chromium 65
1 parent 2b8b654 commit fd67c89

8 files changed

+36
-35
lines changed

src/api/nw_window_api.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ bool NwCurrentWindowInternalSetPrintSettingsInternalFunction::RunNWSync(base::Li
660660
return false;
661661
base::Value* spec = NULL;
662662
EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &spec) && spec);
663-
if (!spec->IsType(base::Value::Type::DICTIONARY))
663+
if (!spec->is_dict())
664664
return false;
665665
const base::DictionaryValue* dict = static_cast<const base::DictionaryValue*>(spec);
666666
bool auto_print;

src/browser/menubar_view.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ class MenuBarButton : public views::MenuButton {
5757
};
5858

5959
MenuBarView::MenuBarView() {
60-
SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, gfx::Insets(), 0));
60+
auto layout = std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal, gfx::Insets(), 0);
61+
SetLayoutManager(std::move(layout));
6162
}
6263

6364
MenuBarView::~MenuBarView() {

src/browser/nw_extensions_browser_hooks.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ std::unique_ptr<base::DictionaryValue> MergeManifest() {
141141
// retrieve `window` manifest set by `new-win-policy`
142142
std::string manifest_str = base::UTF16ToUTF8(nw::GetCurrentNewWinManifest());
143143
std::unique_ptr<base::Value> val = base::JSONReader().ReadToValue(manifest_str);
144-
if (val && val->IsType(base::Value::Type::DICTIONARY)) {
144+
if (val && val->is_dict()) {
145145
manifest.reset(static_cast<base::DictionaryValue*>(val.release()));
146146
} else {
147147
manifest.reset(new base::DictionaryValue());

src/nw_content_verifier_delegate.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "chrome/browser/extensions/extension_assets_manager_chromeos.h"
3232
#endif
3333

34-
#include "chrome/browser/extensions/extension_error_reporter.h"
34+
#include "chrome/browser/extensions/load_error_reporter.h"
3535

3636
namespace {
3737

@@ -140,7 +140,7 @@ void NWContentVerifierDelegate::VerifyFailed(
140140
ExtensionSystem* system = ExtensionSystem::Get(context_);
141141
Mode mode = ShouldBeVerified(*extension);
142142
if (mode >= ContentVerifierDelegate::ENFORCE) {
143-
ExtensionErrorReporter::GetInstance()->
143+
LoadErrorReporter::GetInstance()->
144144
ReportLoadError(extension->path(), "Extension file corrupted: " + relative_path.AsUTF8Unsafe(),
145145
system->extension_service()->profile(), true);
146146
system->extension_service()->DisableExtension(extension_id,

src/nw_custom_bindings.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ using namespace blink;
7272
#include "third_party/WebKit/public/web/WebDocument.h"
7373
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
7474
#include "third_party/WebKit/Source/platform/heap/Handle.h"
75-
#include "third_party/WebKit/Source/core/dom/Modulator.h"
76-
#include "third_party/WebKit/Source/core/dom/ModuleScript.h"
77-
#include "third_party/WebKit/Source/core/dom/ScriptModuleResolver.h"
75+
#include "third_party/WebKit/Source/core/script/Modulator.h"
76+
#include "third_party/WebKit/Source/core/script/ModuleScript.h"
77+
#include "third_party/WebKit/Source/core/script/ScriptModuleResolver.h"
7878

7979
//#include "third_party/WebKit/Source/core/inspector/InspectorInstrumentation.h"
8080
//#include "third_party/WebKit/Source/core/inspector/InspectorResourceAgent.h"
@@ -253,10 +253,10 @@ void NWCustomBindings::EvalNWBin(
253253
script = v8::ScriptCompiler::CompileUnboundScript(
254254
isolate, &source, v8::ScriptCompiler::kConsumeCodeCache).ToLocalChecked();
255255
CHECK(!cache->rejected);
256-
v8::Handle<v8::Value> result;
256+
v8::Local<v8::Value> result;
257257
v8::Context::Scope cscope (local_frame->MainWorldScriptContext());
258258
v8::FixSourceNWBin(isolate, script);
259-
result = script->BindToCurrentContext()->Run();
259+
ignore_result(script->BindToCurrentContext()->Run(local_frame->MainWorldScriptContext()).ToLocal(&result));
260260
args.GetReturnValue().Set(result);
261261
} else {
262262
v8::ScriptOrigin origin(

src/nw_package.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ bool Package::InitFromPath(const base::FilePath& path_in) {
320320
manifest_path.AsUTF8Unsafe() :
321321
error);
322322
return false;
323-
} else if (!root->IsType(base::Value::Type::DICTIONARY)) {
323+
} else if (!root->is_dict()) {
324324
ReportError("Invalid package.json",
325325
"package.json's content should be a object type.");
326326
return false;

src/nw_version.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
#define NW_VERSION_H
2323

2424
#define NW_MAJOR_VERSION 0
25-
#define NW_MINOR_VERSION 28
26-
#define NW_PATCH_VERSION 3
25+
#define NW_MINOR_VERSION 29
26+
#define NW_PATCH_VERSION 0
2727

28-
#define NW_VERSION_IS_RELEASE 1
28+
#define NW_VERSION_IS_RELEASE 0
2929

3030
#ifndef NW_STRINGIFY
3131
#define NW_STRINGIFY(n) NW_STRINGIFY_HELPER(n)
@@ -39,7 +39,7 @@
3939
#else
4040
# define NW_VERSION_STRING NW_STRINGIFY(NW_MAJOR_VERSION) "." \
4141
NW_STRINGIFY(NW_MINOR_VERSION) "." \
42-
NW_STRINGIFY(NW_PATCH_VERSION) "-rc1"
42+
NW_STRINGIFY(NW_PATCH_VERSION) "-beta1"
4343
#endif
4444

4545
#define NW_VERSION "v" NW_VERSION_STRING

src/renderer/nw_extensions_renderer_hooks.cc

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -248,40 +248,40 @@ void ContextCreationHook(blink::WebLocalFrame* frame, ScriptContext* context) {
248248
std::string flavor = "normal";
249249
#endif
250250
v8::Local<v8::Script> script =
251-
v8::Script::Compile(v8::String::NewFromUtf8(isolate,
251+
v8::Script::Compile(dom_context, v8::String::NewFromUtf8(isolate,
252252
(std::string("process.versions['nw'] = '" NW_VERSION_STRING "';") +
253253
"process.versions['node-webkit'] = '" NW_VERSION_STRING "';"
254254
"process.versions['nw-commit-id'] = '" NW_COMMIT_HASH "';"
255255
"process.versions['nw-flavor'] = '" + flavor + "';"
256256
"process.versions['chromium'] = '" + GetChromiumVersion() + "';").c_str()
257-
));
258-
script->Run();
257+
)).ToLocalChecked();
258+
ignore_result(script->Run(dom_context));
259259
}
260260

261261
if (extension && extension->manifest()->GetString(manifest_keys::kNWJSInternalMainFilename, &main_fn)) {
262-
v8::Local<v8::Script> script = v8::Script::Compile(v8::String::NewFromUtf8(isolate,
263-
("global.__filename = '" + main_fn + "';").c_str()));
264-
script->Run();
262+
v8::Local<v8::Script> script = v8::Script::Compile(dom_context, v8::String::NewFromUtf8(isolate,
263+
("global.__filename = '" + main_fn + "';").c_str())).ToLocalChecked();
264+
ignore_result(script->Run(dom_context));
265265
}
266266
{
267267
std::string root_path = extension_root;
268268
#if defined(OS_WIN)
269269
base::ReplaceChars(root_path, "\\", "\\\\", &root_path);
270270
#endif
271271
base::ReplaceChars(root_path, "'", "\\'", &root_path);
272-
v8::Local<v8::Script> script = v8::Script::Compile(v8::String::NewFromUtf8(isolate,
273-
("global.__dirname = '" + root_path + "';").c_str()));
274-
script->Run();
272+
v8::Local<v8::Script> script = v8::Script::Compile(dom_context, v8::String::NewFromUtf8(isolate,
273+
("global.__dirname = '" + root_path + "';").c_str())).ToLocalChecked();
274+
ignore_result(script->Run(dom_context));
275275
}
276276
bool content_verification = false;
277277
if (extension && extension->manifest()->GetBoolean(manifest_keys::kNWJSContentVerifyFlag,
278278
&content_verification) && content_verification) {
279279
v8::Local<v8::Script> script =
280-
v8::Script::Compile(v8::String::NewFromUtf8(isolate,
280+
v8::Script::Compile(dom_context, v8::String::NewFromUtf8(isolate,
281281
(std::string("global.__nwjs_cv = true;") +
282-
"global.__nwjs_ext_id = '" + extension->id() + "';").c_str()));
282+
"global.__nwjs_ext_id = '" + extension->id() + "';").c_str())).ToLocalChecked();
283283

284-
script->Run();
284+
ignore_result(script->Run(dom_context));
285285
}
286286

287287
dom_context->Exit();
@@ -334,7 +334,8 @@ void ContextCreationHook(blink::WebLocalFrame* frame, ScriptContext* context) {
334334
base::ReplaceChars(root_path, "\\", "\\\\", &root_path);
335335
#endif
336336
base::ReplaceChars(root_path, "'", "\\'", &root_path);
337-
v8::Local<v8::Script> script = v8::Script::Compile(v8::String::NewFromUtf8(isolate, (
337+
v8::ScriptOrigin origin(v8::String::NewFromUtf8(isolate, "process_main"));
338+
v8::Local<v8::Script> script = v8::Script::Compile(context->v8_context(), v8::String::NewFromUtf8(isolate, (
338339
set_nw_script +
339340
// Make node's relative modules work
340341
"if (typeof nw.process != 'undefined' && "
@@ -345,10 +346,9 @@ void ContextCreationHook(blink::WebLocalFrame* frame, ScriptContext* context) {
345346
"nw.process.mainModule.filename = root + p;"
346347
"nw.process.mainModule.paths = nw.global.require('module')._nodeModulePaths(nw.process.cwd());"
347348
"nw.process.mainModule.loaded = true;"
348-
"}").c_str()),
349-
v8::String::NewFromUtf8(isolate, "process_main"));
349+
"}").c_str()), &origin).ToLocalChecked();
350350
CHECK(*script);
351-
script->Run();
351+
ignore_result(script->Run(context->v8_context()));
352352
}
353353
}
354354

@@ -473,17 +473,17 @@ void DocumentElementHook(blink::WebLocalFrame* frame,
473473
#endif
474474
base::ReplaceChars(root_path, "'", "\\'", &root_path);
475475

476-
v8::Local<v8::Script> script2 = v8::Script::Compile(v8::String::NewFromUtf8(isolate, (
476+
v8::ScriptOrigin origin(v8::String::NewFromUtf8(isolate, "process_main2"));
477+
v8::Local<v8::Script> script2 = v8::Script::Compile(v8_context, v8::String::NewFromUtf8(isolate, (
477478
"'use strict';"
478479
"if (typeof nw != 'undefined' && typeof __filename == 'undefined') {"
479480
" let root = '" + root_path + "';"
480481
" let path = '" + path + "';"
481482
"nw.__filename = root + path;"
482483
"nw.__dirname = root;"
483-
"}").c_str()),
484-
v8::String::NewFromUtf8(isolate, "process_main2"));
484+
"}").c_str()), &origin).ToLocalChecked();
485485
CHECK(*script2);
486-
script2->Run();
486+
ignore_result(script2->Run(v8_context));
487487
}
488488
RenderViewImpl* rv = RenderViewImpl::FromWebView(frame->View());
489489
if (!rv)

0 commit comments

Comments
 (0)