| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 if (method.holderCheckConfiguration == V8DOMConfiguration::DoNotCheckHolder) | 341 if (method.holderCheckConfiguration == V8DOMConfiguration::DoNotCheckHolder) |
| 342 signature = v8::Local<v8::Signature>(); | 342 signature = v8::Local<v8::Signature>(); |
| 343 | 343 |
| 344 DCHECK(method.propertyLocationConfiguration); | 344 DCHECK(method.propertyLocationConfiguration); |
| 345 if (method.propertyLocationConfiguration & | 345 if (method.propertyLocationConfiguration & |
| 346 (V8DOMConfiguration::OnInstance | V8DOMConfiguration::OnPrototype)) { | 346 (V8DOMConfiguration::OnInstance | V8DOMConfiguration::OnPrototype)) { |
| 347 v8::Local<v8::FunctionTemplate> functionTemplate = | 347 v8::Local<v8::FunctionTemplate> functionTemplate = |
| 348 v8::FunctionTemplate::New(isolate, callback, v8::Local<v8::Value>(), | 348 v8::FunctionTemplate::New(isolate, callback, v8::Local<v8::Value>(), |
| 349 signature, method.length); | 349 signature, method.length); |
| 350 functionTemplate->RemovePrototype(); | 350 functionTemplate->RemovePrototype(); |
| 351 if (method.accessCheckConfiguration == V8DOMConfiguration::CheckAccess) |
| 352 functionTemplate->SetAcceptAnyReceiver(false); |
| 351 if (method.propertyLocationConfiguration & V8DOMConfiguration::OnInstance) | 353 if (method.propertyLocationConfiguration & V8DOMConfiguration::OnInstance) |
| 352 instanceTemplate->Set( | 354 instanceTemplate->Set( |
| 353 name, functionTemplate, | 355 name, functionTemplate, |
| 354 static_cast<v8::PropertyAttribute>(method.attribute)); | 356 static_cast<v8::PropertyAttribute>(method.attribute)); |
| 355 if (method.propertyLocationConfiguration & V8DOMConfiguration::OnPrototype) | 357 if (method.propertyLocationConfiguration & V8DOMConfiguration::OnPrototype) |
| 356 prototypeTemplate->Set( | 358 prototypeTemplate->Set( |
| 357 name, functionTemplate, | 359 name, functionTemplate, |
| 358 static_cast<v8::PropertyAttribute>(method.attribute)); | 360 static_cast<v8::PropertyAttribute>(method.attribute)); |
| 359 } | 361 } |
| 360 if (method.propertyLocationConfiguration & V8DOMConfiguration::OnInterface) { | 362 if (method.propertyLocationConfiguration & V8DOMConfiguration::OnInterface) { |
| 361 // Operations installed on the interface object must be static | 363 // Operations installed on the interface object must be static methods, so |
| 362 // operations, so no need to specify a signature, i.e. no need to do | 364 // no need to specify a signature, i.e. no need to do type check against a |
| 363 // type check against a holder. | 365 // holder. |
| 364 v8::Local<v8::FunctionTemplate> functionTemplate = | 366 v8::Local<v8::FunctionTemplate> functionTemplate = |
| 365 v8::FunctionTemplate::New(isolate, callback, v8::Local<v8::Value>(), | 367 v8::FunctionTemplate::New(isolate, callback, v8::Local<v8::Value>(), |
| 366 v8::Local<v8::Signature>(), method.length); | 368 v8::Local<v8::Signature>(), method.length); |
| 367 functionTemplate->RemovePrototype(); | 369 functionTemplate->RemovePrototype(); |
| 370 // Similarly, there is no need to do an access check for static methods, as |
| 371 // there is no holder to check against. |
| 368 interfaceTemplate->Set( | 372 interfaceTemplate->Set( |
| 369 name, functionTemplate, | 373 name, functionTemplate, |
| 370 static_cast<v8::PropertyAttribute>(method.attribute)); | 374 static_cast<v8::PropertyAttribute>(method.attribute)); |
| 371 } | 375 } |
| 372 } | 376 } |
| 373 | 377 |
| 374 void installMethodInternal( | 378 void installMethodInternal( |
| 375 v8::Isolate* isolate, | 379 v8::Isolate* isolate, |
| 376 v8::Local<v8::Object> instance, | 380 v8::Local<v8::Object> instance, |
| 377 v8::Local<v8::Object> prototype, | 381 v8::Local<v8::Object> prototype, |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 void V8DOMConfiguration::setClassString( | 668 void V8DOMConfiguration::setClassString( |
| 665 v8::Isolate* isolate, | 669 v8::Isolate* isolate, |
| 666 v8::Local<v8::ObjectTemplate> objectTemplate, | 670 v8::Local<v8::ObjectTemplate> objectTemplate, |
| 667 const char* classString) { | 671 const char* classString) { |
| 668 objectTemplate->Set( | 672 objectTemplate->Set( |
| 669 v8::Symbol::GetToStringTag(isolate), v8AtomicString(isolate, classString), | 673 v8::Symbol::GetToStringTag(isolate), v8AtomicString(isolate, classString), |
| 670 static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); | 674 static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); |
| 671 } | 675 } |
| 672 | 676 |
| 673 } // namespace blink | 677 } // namespace blink |
| OLD | NEW |