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

Unified Diff: Source/bindings/core/v8/PrivateScriptRunner.cpp

Issue 394493003: Revert of Make error messages about private scripts more descriptive (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/PrivateScriptRunner.cpp
diff --git a/Source/bindings/core/v8/PrivateScriptRunner.cpp b/Source/bindings/core/v8/PrivateScriptRunner.cpp
index 11ab0e21b3ebf0de879375beed14634e8c7ef37c..a089a9987f518e00ef235597531f4a2e9deb0ee2 100644
--- a/Source/bindings/core/v8/PrivateScriptRunner.cpp
+++ b/Source/bindings/core/v8/PrivateScriptRunner.cpp
@@ -37,21 +37,9 @@
if (className == kPrivateScriptSources[index].name)
break;
}
- if (index == WTF_ARRAY_LENGTH(kPrivateScriptSources)) {
- FATAL("Private script error: Target source code was not found. (Class name = %s)\n", className.utf8().data());
- RELEASE_ASSERT_NOT_REACHED();
- }
-
- v8::TryCatch block;
+ RELEASE_ASSERT(index != WTF_ARRAY_LENGTH(kPrivateScriptSources));
String source(reinterpret_cast<const char*>(kPrivateScriptSources[index].source), kPrivateScriptSources[index].size);
- v8::Handle<v8::Value> result = V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, source), isolate);
- if (block.HasCaught()) {
- FATAL("Private script error: Compile failed. (Class name = %s)\n", className.utf8().data());
- if (!block.Message().IsEmpty())
- FATAL("%s\n", toCoreString(block.Message()->Get()).utf8().data());
- RELEASE_ASSERT_NOT_REACHED();
- }
- return result;
+ return V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, source), isolate);
}
static v8::Handle<v8::Object> classObjectOfPrivateScript(ScriptState* scriptState, String className)
@@ -105,14 +93,7 @@
if (isInitialized.IsEmpty()) {
v8::Handle<v8::Value> initializeFunction = classObject->Get(v8String(isolate, "constructor"));
if (!initializeFunction.IsEmpty() && initializeFunction->IsFunction()) {
- v8::TryCatch block;
V8ScriptRunner::callFunction(v8::Handle<v8::Function>::Cast(initializeFunction), scriptState->executionContext(), holder, 0, 0, isolate);
- if (block.HasCaught()) {
- FATAL("Private script error: Object constructor threw an exception.\n");
- if (!block.Message().IsEmpty())
- FATAL("%s\n", toCoreString(block.Message()->Get()).utf8().data());
- RELEASE_ASSERT_NOT_REACHED();
- }
}
isInitialized = v8Boolean(true, isolate);
V8HiddenValue::setHiddenValue(isolate, holderObject, V8HiddenValue::privateScriptObjectIsInitialized(isolate), isInitialized);
@@ -139,10 +120,8 @@
v8::Handle<v8::Object> classObject = classObjectOfPrivateScript(scriptState, className);
v8::Handle<v8::Object> descriptor = getOwnPropertyDescriptor(scriptState, classObject, attributeName);
v8::Handle<v8::Value> getter = descriptor->Get(v8String(scriptState->isolate(), "get"));
- if (getter.IsEmpty() || !getter->IsFunction()) {
- FATAL("Private script error: Target DOM attribute getter was not found. (Class name = %s, Attribute name = %s)\n", className.utf8().data(), attributeName.utf8().data());
- RELEASE_ASSERT_NOT_REACHED();
- }
+ RELEASE_ASSERT(!getter.IsEmpty());
+ RELEASE_ASSERT(getter->IsFunction());
initializeHolderIfNeeded(scriptState, classObject, holder);
return V8ScriptRunner::callFunction(v8::Handle<v8::Function>::Cast(getter), scriptState->executionContext(), holder, 0, 0, scriptState->isolate());
}
@@ -152,10 +131,8 @@
v8::Handle<v8::Object> classObject = classObjectOfPrivateScript(scriptState, className);
v8::Handle<v8::Object> descriptor = getOwnPropertyDescriptor(scriptState, classObject, attributeName);
v8::Handle<v8::Value> setter = descriptor->Get(v8String(scriptState->isolate(), "set"));
- if (setter.IsEmpty() || !setter->IsFunction()) {
- FATAL("Private script error: Target DOM attribute setter was not found. (Class name = %s, Attribute name = %s)\n", className.utf8().data(), attributeName.utf8().data());
- RELEASE_ASSERT_NOT_REACHED();
- }
+ RELEASE_ASSERT(!setter.IsEmpty());
+ RELEASE_ASSERT(setter->IsFunction());
initializeHolderIfNeeded(scriptState, classObject, holder);
v8::Handle<v8::Value> argv[] = { v8Value };
V8ScriptRunner::callFunction(v8::Handle<v8::Function>::Cast(setter), scriptState->executionContext(), holder, WTF_ARRAY_LENGTH(argv), argv, scriptState->isolate());
@@ -165,10 +142,8 @@
{
v8::Handle<v8::Object> classObject = classObjectOfPrivateScript(scriptState, className);
v8::Handle<v8::Value> method = classObject->Get(v8String(scriptState->isolate(), methodName));
- if (method.IsEmpty() || !method->IsFunction()) {
- FATAL("Private script error: Target DOM method was not found. (Class name = %s, Method name = %s)\n", className.utf8().data(), methodName.utf8().data());
- RELEASE_ASSERT_NOT_REACHED();
- }
+ RELEASE_ASSERT(!method.IsEmpty());
+ RELEASE_ASSERT(method->IsFunction());
initializeHolderIfNeeded(scriptState, classObject, holder);
return V8ScriptRunner::callFunction(v8::Handle<v8::Function>::Cast(method), scriptState->executionContext(), holder, argc, argv, scriptState->isolate());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698