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

Side by Side Diff: Source/bindings/v8/V8ErrorHandler.cpp

Issue 135843008: Remove V8HiddenPropertyName (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/V8DOMWrapper.cpp ('k') | Source/bindings/v8/V8EventListenerList.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "bindings/v8/V8ErrorHandler.h" 32 #include "bindings/v8/V8ErrorHandler.h"
33 33
34 #include "V8ErrorEvent.h" 34 #include "V8ErrorEvent.h"
35 #include "bindings/v8/ScriptController.h" 35 #include "bindings/v8/ScriptController.h"
36 #include "bindings/v8/V8Binding.h" 36 #include "bindings/v8/V8Binding.h"
37 #include "bindings/v8/V8HiddenPropertyName.h"
38 #include "bindings/v8/V8ScriptRunner.h" 37 #include "bindings/v8/V8ScriptRunner.h"
39 #include "core/dom/Document.h" 38 #include "core/dom/Document.h"
40 #include "core/dom/ExecutionContext.h" 39 #include "core/dom/ExecutionContext.h"
41 #include "core/events/ErrorEvent.h" 40 #include "core/events/ErrorEvent.h"
42 #include "core/events/ThreadLocalEventNames.h" 41 #include "core/events/ThreadLocalEventNames.h"
43 #include "core/frame/Frame.h" 42 #include "core/frame/Frame.h"
44 43
45 namespace WebCore { 44 namespace WebCore {
46 45
47 V8ErrorHandler::V8ErrorHandler(v8::Local<v8::Object> listener, bool isInline, v8 ::Isolate* isolate) 46 V8ErrorHandler::V8ErrorHandler(v8::Local<v8::Object> listener, bool isInline, v8 ::Isolate* isolate)
(...skipping 11 matching lines...) Expand all
59 v8::Isolate* isolate = toV8Context(context, world())->GetIsolate(); 58 v8::Isolate* isolate = toV8Context(context, world())->GetIsolate();
60 if (errorEvent->world() && errorEvent->world() != world()) 59 if (errorEvent->world() && errorEvent->world() != world())
61 return v8::Null(isolate); 60 return v8::Null(isolate);
62 61
63 v8::Local<v8::Object> listener = getListenerObject(context); 62 v8::Local<v8::Object> listener = getListenerObject(context);
64 v8::Local<v8::Value> returnValue; 63 v8::Local<v8::Value> returnValue;
65 if (!listener.IsEmpty() && listener->IsFunction()) { 64 if (!listener.IsEmpty() && listener->IsFunction()) {
66 v8::Local<v8::Function> callFunction = v8::Local<v8::Function>::Cast(lis tener); 65 v8::Local<v8::Function> callFunction = v8::Local<v8::Function>::Cast(lis tener);
67 v8::Local<v8::Object> thisValue = isolate->GetCurrentContext()->Global() ; 66 v8::Local<v8::Object> thisValue = isolate->GetCurrentContext()->Global() ;
68 67
69 v8::Local<v8::Value> error = jsEvent->ToObject()->GetHiddenValue(V8Hidde nPropertyName::error(isolate)); 68 v8::Local<v8::Value> error = getHiddenValue(isolate, jsEvent->ToObject() , "error");
70 if (error.IsEmpty()) 69 if (error.IsEmpty())
71 error = v8::Null(isolate); 70 error = v8::Null(isolate);
72 71
73 v8::Handle<v8::Value> parameters[5] = { v8String(isolate, errorEvent->me ssage()), v8String(isolate, errorEvent->filename()), v8::Integer::New(isolate, e rrorEvent->lineno()), v8::Integer::New(isolate, errorEvent->colno()), error }; 72 v8::Handle<v8::Value> parameters[5] = { v8String(isolate, errorEvent->me ssage()), v8String(isolate, errorEvent->filename()), v8::Integer::New(isolate, e rrorEvent->lineno()), v8::Integer::New(isolate, errorEvent->colno()), error };
74 v8::TryCatch tryCatch; 73 v8::TryCatch tryCatch;
75 tryCatch.SetVerbose(true); 74 tryCatch.SetVerbose(true);
76 if (worldType(isolate) == WorkerWorld) 75 if (worldType(isolate) == WorkerWorld)
77 returnValue = V8ScriptRunner::callFunction(callFunction, context, th isValue, WTF_ARRAY_LENGTH(parameters), parameters, isolate); 76 returnValue = V8ScriptRunner::callFunction(callFunction, context, th isValue, WTF_ARRAY_LENGTH(parameters), parameters, isolate);
78 else 77 else
79 returnValue = ScriptController::callFunction(context, callFunction, thisValue, WTF_ARRAY_LENGTH(parameters), parameters, isolate); 78 returnValue = ScriptController::callFunction(context, callFunction, thisValue, WTF_ARRAY_LENGTH(parameters), parameters, isolate);
80 } 79 }
81 return returnValue; 80 return returnValue;
82 } 81 }
83 82
84 // static 83 // static
85 void V8ErrorHandler::storeExceptionOnErrorEventWrapper(ErrorEvent* event, v8::Ha ndle<v8::Value> data, v8::Isolate* isolate) 84 void V8ErrorHandler::storeExceptionOnErrorEventWrapper(ErrorEvent* event, v8::Ha ndle<v8::Value> data, v8::Isolate* isolate)
86 { 85 {
87 v8::Local<v8::Value> wrappedEvent = toV8(event, v8::Handle<v8::Object>(), is olate); 86 v8::Local<v8::Value> wrappedEvent = toV8(event, v8::Handle<v8::Object>(), is olate);
88 if (!wrappedEvent.IsEmpty()) { 87 if (!wrappedEvent.IsEmpty()) {
89 ASSERT(wrappedEvent->IsObject()); 88 ASSERT(wrappedEvent->IsObject());
90 v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenProper tyName::error(isolate), data); 89 setHiddenValue(isolate, v8::Local<v8::Object>::Cast(wrappedEvent), "erro r", data);
91 } 90 }
92 } 91 }
93 92
94 bool V8ErrorHandler::shouldPreventDefault(v8::Local<v8::Value> returnValue) 93 bool V8ErrorHandler::shouldPreventDefault(v8::Local<v8::Value> returnValue)
95 { 94 {
96 return returnValue->IsBoolean() && returnValue->BooleanValue(); 95 return returnValue->IsBoolean() && returnValue->BooleanValue();
97 } 96 }
98 97
99 } // namespace WebCore 98 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8DOMWrapper.cpp ('k') | Source/bindings/v8/V8EventListenerList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698