Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp

Issue 2838933003: [not-for-commit] kitsune changes + pending kouhei changes (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 v8::Local<v8::Integer>(), // script id 516 v8::Local<v8::Integer>(), // script id
517 v8::String::Empty(isolate), // source_map_url 517 v8::String::Empty(isolate), // source_map_url
518 v8::Boolean::New(isolate, access_control_status == kOpaqueResource), 518 v8::Boolean::New(isolate, access_control_status == kOpaqueResource),
519 v8::False(isolate), // is_wasm 519 v8::False(isolate), // is_wasm
520 v8::True(isolate)); // is_module 520 v8::True(isolate)); // is_module
521 521
522 v8::ScriptCompiler::Source script_source(V8String(isolate, source), origin); 522 v8::ScriptCompiler::Source script_source(V8String(isolate, source), origin);
523 return v8::ScriptCompiler::CompileModule(isolate, &script_source); 523 return v8::ScriptCompiler::CompileModule(isolate, &script_source);
524 } 524 }
525 525
526 void V8ScriptRunner::ReportExceptionForModule(v8::Isolate* isolate,
527 v8::Local<v8::Value> exception,
528 const String& file_name) {
529 // |origin| is for compiling a fragment that throws |exception|.
530 // Therefore |is_module| is false and |access_control_status| is
531 // kSharableCrossOrigin.
532 AccessControlStatus access_control_status = kSharableCrossOrigin;
533 v8::ScriptOrigin origin(
534 V8String(isolate, file_name),
535 v8::Integer::New(isolate, 0), // line_offset
536 v8::Integer::New(isolate, 0), // col_offset
537 v8::Boolean::New(isolate, access_control_status == kSharableCrossOrigin),
538 v8::Local<v8::Integer>(), // script id
539 v8::String::Empty(isolate), // source_map_url
540 v8::Boolean::New(isolate, access_control_status == kOpaqueResource),
541 v8::False(isolate), // is_wasm
542 v8::False(isolate)); // is_module
543
544 ThrowException(isolate, exception, origin);
545 // v8::Exception::TypeError(V8String(isolate, "FOXME Message"))
546 }
547
526 v8::MaybeLocal<v8::Value> V8ScriptRunner::RunCompiledScript( 548 v8::MaybeLocal<v8::Value> V8ScriptRunner::RunCompiledScript(
527 v8::Isolate* isolate, 549 v8::Isolate* isolate,
528 v8::Local<v8::Script> script, 550 v8::Local<v8::Script> script,
529 ExecutionContext* context) { 551 ExecutionContext* context) {
530 DCHECK(!script.IsEmpty()); 552 DCHECK(!script.IsEmpty());
531 ScopedFrameBlamer frame_blamer( 553 ScopedFrameBlamer frame_blamer(
532 context->IsDocument() ? ToDocument(context)->GetFrame() : nullptr); 554 context->IsDocument() ? ToDocument(context)->GetFrame() : nullptr);
533 TRACE_EVENT1("v8", "v8.run", "fileName", 555 TRACE_EVENT1("v8", "v8.run", "fileName",
534 TRACE_STR_COPY(*v8::String::Utf8Value( 556 TRACE_STR_COPY(*v8::String::Utf8Value(
535 script->GetUnboundScript()->GetScriptName()))); 557 script->GetUnboundScript()->GetScriptName())));
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 if (!context->GetExtrasBindingObject() 764 if (!context->GetExtrasBindingObject()
743 ->Get(context, V8AtomicString(isolate, name)) 765 ->Get(context, V8AtomicString(isolate, name))
744 .ToLocal(&function_value)) 766 .ToLocal(&function_value))
745 return v8::MaybeLocal<v8::Value>(); 767 return v8::MaybeLocal<v8::Value>();
746 v8::Local<v8::Function> function = function_value.As<v8::Function>(); 768 v8::Local<v8::Function> function = function_value.As<v8::Function>();
747 return V8ScriptRunner::CallInternalFunction(function, v8::Undefined(isolate), 769 return V8ScriptRunner::CallInternalFunction(function, v8::Undefined(isolate),
748 num_args, args, isolate); 770 num_args, args, isolate);
749 } 771 }
750 772
751 } // namespace blink 773 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698