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

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

Issue 1938943002: Use v8::Object::CreateDataProperty() for object construction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 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 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // argument wrapping the event source code. The reason for this is 181 // argument wrapping the event source code. The reason for this is
182 // that some web sites use toString on event functions and eval the 182 // that some web sites use toString on event functions and eval the
183 // source returned (sometimes a RegExp is applied as well) for some 183 // source returned (sometimes a RegExp is applied as well) for some
184 // other use. That fails miserably if the actual wrapper source is 184 // other use. That fails miserably if the actual wrapper source is
185 // returned. 185 // returned.
186 v8::Local<v8::Function> toStringFunction = v8::Function::New(isolate(), V8La zyEventListenerToString); 186 v8::Local<v8::Function> toStringFunction = v8::Function::New(isolate(), V8La zyEventListenerToString);
187 if (toStringFunction.IsEmpty()) 187 if (toStringFunction.IsEmpty())
188 return; 188 return;
189 String toStringString = "function " + m_functionName + "(" + m_eventParamete rName + ") {\n " + m_code + "\n}"; 189 String toStringString = "function " + m_functionName + "(" + m_eventParamete rName + ") {\n " + m_code + "\n}";
190 V8HiddenValue::setHiddenValue(scriptState, wrappedFunction, V8HiddenValue::t oStringString(isolate()), v8String(isolate(), toStringString)); 190 V8HiddenValue::setHiddenValue(scriptState, wrappedFunction, V8HiddenValue::t oStringString(isolate()), v8String(isolate(), toStringString));
191 if (!v8CallBoolean(wrappedFunction->Set(scriptState->context(), v8AtomicStri ng(isolate(), "toString"), toStringFunction))) 191 if (!v8CallBoolean(wrappedFunction->CreateDataProperty(scriptState->context( ), v8AtomicString(isolate(), "toString"), toStringFunction)))
192 return; 192 return;
193 wrappedFunction->SetName(v8String(isolate(), m_functionName)); 193 wrappedFunction->SetName(v8String(isolate(), m_functionName));
194 194
195 // FIXME: Remove the following comment-outs. 195 // FIXME: Remove the following comment-outs.
196 // See https://bugs.webkit.org/show_bug.cgi?id=85152 for more details. 196 // See https://bugs.webkit.org/show_bug.cgi?id=85152 for more details.
197 // 197 //
198 // For the time being, we comment out the following code since the 198 // For the time being, we comment out the following code since the
199 // second parsing can happen. 199 // second parsing can happen.
200 // // Since we only parse once, there's no need to keep data used for parsin g around anymore. 200 // // Since we only parse once, there's no need to keep data used for parsin g around anymore.
201 // m_functionName = String(); 201 // m_functionName = String();
(...skipping 16 matching lines...) Expand all
218 AccessControlStatus accessControlStatus = NotSharableCrossOrigin; 218 AccessControlStatus accessControlStatus = NotSharableCrossOrigin;
219 if (message->IsOpaque()) 219 if (message->IsOpaque())
220 accessControlStatus = OpaqueResource; 220 accessControlStatus = OpaqueResource;
221 else if (message->IsSharedCrossOrigin()) 221 else if (message->IsSharedCrossOrigin())
222 accessControlStatus = SharableCrossOrigin; 222 accessControlStatus = SharableCrossOrigin;
223 223
224 executionContext->reportException(event, 0, nullptr, accessControlStatus); 224 executionContext->reportException(event, 0, nullptr, accessControlStatus);
225 } 225 }
226 226
227 } // namespace blink 227 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698