Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 static void constructorOfToString(const v8::FunctionCallbackInfo<v8::Value>& inf o) | 233 static void constructorOfToString(const v8::FunctionCallbackInfo<v8::Value>& inf o) |
| 234 { | 234 { |
| 235 // The DOM constructors' toString functions grab the current toString | 235 // The DOM constructors' toString functions grab the current toString |
| 236 // for Functions by taking the toString function of itself and then | 236 // for Functions by taking the toString function of itself and then |
| 237 // calling it with the constructor as its receiver. This means that | 237 // calling it with the constructor as its receiver. This means that |
| 238 // changes to the Function prototype chain or toString function are | 238 // changes to the Function prototype chain or toString function are |
| 239 // reflected when printing DOM constructors. The only wart is that | 239 // reflected when printing DOM constructors. The only wart is that |
| 240 // changes to a DOM constructor's toString's toString will cause the | 240 // changes to a DOM constructor's toString's toString will cause the |
| 241 // toString of the DOM constructor itself to change. This is extremely | 241 // toString of the DOM constructor itself to change. This is extremely |
| 242 // obscure and unlikely to be a problem. | 242 // obscure and unlikely to be a problem. |
| 243 v8::Handle<v8::Value> value = info.Callee()->Get(v8AtomicString(info.GetIsol ate(), "toString")); | 243 v8::Isolate* isolate = info.GetIsolate(); |
| 244 if (!value->IsFunction()) { | 244 v8::Local<v8::Value> value; |
| 245 v8SetReturnValue(info, v8::String::Empty(info.GetIsolate())); | 245 if (!info.Callee()->Get(isolate->GetCurrentContext(), v8AtomicString(isolate , "toString")).ToLocal(&value) || !value->IsFunction()) { |
|
Yuki
2015/04/07 07:37:57
nit: two spaces after ||.
bashi
2015/04/07 08:47:01
Done.
| |
| 246 v8SetReturnValue(info, v8::String::Empty(isolate)); | |
| 246 return; | 247 return; |
| 247 } | 248 } |
| 248 v8::Local<v8::Value> result; | 249 v8::Local<v8::Value> result; |
| 249 if (V8ScriptRunner::callInternalFunction(v8::Handle<v8::Function>::Cast(valu e), info.This(), 0, 0, info.GetIsolate()).ToLocal(&result)) | 250 if (V8ScriptRunner::callInternalFunction(v8::Handle<v8::Function>::Cast(valu e), info.This(), 0, 0, isolate).ToLocal(&result)) |
| 250 v8SetReturnValue(info, result); | 251 v8SetReturnValue(info, result); |
| 251 } | 252 } |
| 252 | 253 |
| 253 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate() | 254 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate() |
| 254 { | 255 { |
| 255 if (m_toStringTemplate.isEmpty()) | 256 if (m_toStringTemplate.isEmpty()) |
| 256 m_toStringTemplate.set(isolate(), v8::FunctionTemplate::New(isolate(), c onstructorOfToString)); | 257 m_toStringTemplate.set(isolate(), v8::FunctionTemplate::New(isolate(), c onstructorOfToString)); |
| 257 return m_toStringTemplate.newLocal(isolate()); | 258 return m_toStringTemplate.newLocal(isolate()); |
| 258 } | 259 } |
| 259 | 260 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 276 m_endOfScopeTasks.clear(); | 277 m_endOfScopeTasks.clear(); |
| 277 } | 278 } |
| 278 | 279 |
| 279 void V8PerIsolateData::setScriptDebugServer(PassOwnPtrWillBeRawPtr<ScriptDebugSe rver> server) | 280 void V8PerIsolateData::setScriptDebugServer(PassOwnPtrWillBeRawPtr<ScriptDebugSe rver> server) |
| 280 { | 281 { |
| 281 ASSERT(!m_debugServer); | 282 ASSERT(!m_debugServer); |
| 282 m_debugServer = server; | 283 m_debugServer = server; |
| 283 } | 284 } |
| 284 | 285 |
| 285 } // namespace blink | 286 } // namespace blink |
| OLD | NEW |