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

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

Issue 2150303002: Remove the prototype from all V8 functions that aren't constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 5 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/PrivateScriptRunner.h" 5 #include "bindings/core/v8/PrivateScriptRunner.h"
6 6
7 #include "bindings/core/v8/DOMWrapperWorld.h" 7 #include "bindings/core/v8/DOMWrapperWorld.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/V8Binding.h" 9 #include "bindings/core/v8/V8Binding.h"
10 #include "bindings/core/v8/V8PerContextData.h" 10 #include "bindings/core/v8/V8PerContextData.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 v8::Local<v8::Context> context = scriptState->context(); 54 v8::Local<v8::Context> context = scriptState->context();
55 v8::Local<v8::Object> global = context->Global(); 55 v8::Local<v8::Object> global = context->Global();
56 v8::Local<v8::Value> privateScriptController = global->Get(context, v8String (isolate, "privateScriptController")).ToLocalChecked(); 56 v8::Local<v8::Value> privateScriptController = global->Get(context, v8String (isolate, "privateScriptController")).ToLocalChecked();
57 RELEASE_ASSERT(privateScriptController->IsUndefined() || privateScriptContro ller->IsObject()); 57 RELEASE_ASSERT(privateScriptController->IsUndefined() || privateScriptContro ller->IsObject());
58 if (privateScriptController->IsObject()) { 58 if (privateScriptController->IsObject()) {
59 v8::Local<v8::Object> privateScriptControllerObject = privateScriptContr oller.As<v8::Object>(); 59 v8::Local<v8::Object> privateScriptControllerObject = privateScriptContr oller.As<v8::Object>();
60 v8::Local<v8::Value> importFunctionValue = privateScriptControllerObject ->Get(context, v8String(isolate, "import")).ToLocalChecked(); 60 v8::Local<v8::Value> importFunctionValue = privateScriptControllerObject ->Get(context, v8String(isolate, "import")).ToLocalChecked();
61 if (importFunctionValue->IsUndefined()) { 61 if (importFunctionValue->IsUndefined()) {
62 v8::Local<v8::Function> function; 62 v8::Local<v8::Function> function;
63 // This is a memory leak, FunctionTemplates are eternal.
63 if (!v8::FunctionTemplate::New(isolate, importFunction)->GetFunction (context).ToLocal(&function) 64 if (!v8::FunctionTemplate::New(isolate, importFunction)->GetFunction (context).ToLocal(&function)
64 || !v8CallBoolean(privateScriptControllerObject->Set(context, v8 String(isolate, "import"), function))) { 65 || !v8CallBoolean(privateScriptControllerObject->Set(context, v8 String(isolate, "import"), function))) {
65 fprintf(stderr, "Private script error: Setting import function f ailed. (Class name = %s)\n", scriptClassName.utf8().data()); 66 fprintf(stderr, "Private script error: Setting import function f ailed. (Class name = %s)\n", scriptClassName.utf8().data());
66 dumpV8Message(context, block.Message()); 67 dumpV8Message(context, block.Message());
67 RELEASE_NOTREACHED(); 68 RELEASE_NOTREACHED();
68 } 69 }
69 } 70 }
70 } 71 }
71 72
72 v8::Local<v8::Script> script; 73 v8::Local<v8::Script> script;
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 v8::Local<v8::Value> result; 353 v8::Local<v8::Value> result;
353 if (!V8ScriptRunner::callFunction(v8::Local<v8::Function>::Cast(method), scr iptState->getExecutionContext(), holder, argc, argv, scriptState->isolate()).ToL ocal(&result)) { 354 if (!V8ScriptRunner::callFunction(v8::Local<v8::Function>::Cast(method), scr iptState->getExecutionContext(), holder, argc, argv, scriptState->isolate()).ToL ocal(&result)) {
354 rethrowExceptionInPrivateScript(scriptState->isolate(), block, scriptSta teInUserScript, ExceptionState::ExecutionContext, methodName, className); 355 rethrowExceptionInPrivateScript(scriptState->isolate(), block, scriptSta teInUserScript, ExceptionState::ExecutionContext, methodName, className);
355 block.ReThrow(); 356 block.ReThrow();
356 return v8::Local<v8::Value>(); 357 return v8::Local<v8::Value>();
357 } 358 }
358 return result; 359 return result;
359 } 360 }
360 361
361 } // namespace blink 362 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698