| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* info, v8::Handle<v8::V
alue> value, WrapperWorldType currentWorldType) | 142 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* info, v8::Handle<v8::V
alue> value, WrapperWorldType currentWorldType) |
| 143 { | 143 { |
| 144 TemplateMap& templates = rawTemplateMap(currentWorldType); | 144 TemplateMap& templates = rawTemplateMap(currentWorldType); |
| 145 TemplateMap::iterator result = templates.find(info); | 145 TemplateMap::iterator result = templates.find(info); |
| 146 if (result == templates.end()) | 146 if (result == templates.end()) |
| 147 return false; | 147 return false; |
| 148 v8::HandleScope handleScope(m_isolate); | 148 v8::HandleScope handleScope(m_isolate); |
| 149 return result->value.newLocal(m_isolate)->HasInstance(value); | 149 return result->value.newLocal(m_isolate)->HasInstance(value); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void V8PerIsolateData::constructorOfToString(const v8::FunctionCallbackInfo<v8::
Value>& args) | 152 void V8PerIsolateData::constructorOfToString(const v8::FunctionCallbackInfo<v8::
Value>& info) |
| 153 { | 153 { |
| 154 // The DOM constructors' toString functions grab the current toString | 154 // The DOM constructors' toString functions grab the current toString |
| 155 // for Functions by taking the toString function of itself and then | 155 // for Functions by taking the toString function of itself and then |
| 156 // calling it with the constructor as its receiver. This means that | 156 // calling it with the constructor as its receiver. This means that |
| 157 // changes to the Function prototype chain or toString function are | 157 // changes to the Function prototype chain or toString function are |
| 158 // reflected when printing DOM constructors. The only wart is that | 158 // reflected when printing DOM constructors. The only wart is that |
| 159 // changes to a DOM constructor's toString's toString will cause the | 159 // changes to a DOM constructor's toString's toString will cause the |
| 160 // toString of the DOM constructor itself to change. This is extremely | 160 // toString of the DOM constructor itself to change. This is extremely |
| 161 // obscure and unlikely to be a problem. | 161 // obscure and unlikely to be a problem. |
| 162 v8::Handle<v8::Value> value = args.Callee()->Get(v8::String::NewSymbol("toSt
ring")); | 162 v8::Handle<v8::Value> value = info.Callee()->Get(v8::String::NewSymbol("toSt
ring")); |
| 163 if (!value->IsFunction()) { | 163 if (!value->IsFunction()) { |
| 164 v8SetReturnValue(args, v8::String::Empty(args.GetIsolate())); | 164 v8SetReturnValue(info, v8::String::Empty(info.GetIsolate())); |
| 165 return; | 165 return; |
| 166 } | 166 } |
| 167 v8SetReturnValue(args, V8ScriptRunner::callInternalFunction(v8::Handle<v8::F
unction>::Cast(value), args.This(), 0, 0, v8::Isolate::GetCurrent())); | 167 v8SetReturnValue(info, V8ScriptRunner::callInternalFunction(v8::Handle<v8::F
unction>::Cast(value), info.This(), 0, 0, v8::Isolate::GetCurrent())); |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace WebCore | 170 } // namespace WebCore |
| OLD | NEW |