OLD | NEW |
1 // Copyright (c) 2008, Google Inc. | 1 // Copyright (c) 2008, Google Inc. |
2 // All rights reserved. | 2 // 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 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1753 // When a context is detached from a frame, turn on the access check. | 1753 // When a context is detached from a frame, turn on the access check. |
1754 // Turning on checks also invalidates inline caches of the object. | 1754 // Turning on checks also invalidates inline caches of the object. |
1755 instance_template->SetAccessCheckCallbacks( | 1755 instance_template->SetAccessCheckCallbacks( |
1756 V8Custom::v8DOMWindowNamedSecurityCheck, | 1756 V8Custom::v8DOMWindowNamedSecurityCheck, |
1757 V8Custom::v8DOMWindowIndexedSecurityCheck, | 1757 V8Custom::v8DOMWindowIndexedSecurityCheck, |
1758 v8::Integer::New(V8ClassIndex::DOMWINDOW), | 1758 v8::Integer::New(V8ClassIndex::DOMWINDOW), |
1759 false); | 1759 false); |
1760 break; | 1760 break; |
1761 } | 1761 } |
1762 case V8ClassIndex::LOCATION: { | 1762 case V8ClassIndex::LOCATION: { |
| 1763 // For security reasons, these functions are on the instance |
| 1764 // instead of on the prototype object to insure that they cannot |
| 1765 // be overwritten. |
| 1766 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); |
| 1767 instance->SetAccessor( |
| 1768 v8::String::New("reload"), |
| 1769 V8Custom::v8LocationReloadAccessorGetter, |
| 1770 0, |
| 1771 v8::Handle<v8::Value>(), |
| 1772 v8::ALL_CAN_READ, |
| 1773 static_cast<v8::PropertyAttribute>(v8::DontDelete|v8::ReadOnly)); |
| 1774 |
| 1775 instance->SetAccessor( |
| 1776 v8::String::New("replace"), |
| 1777 V8Custom::v8LocationReplaceAccessorGetter, |
| 1778 0, |
| 1779 v8::Handle<v8::Value>(), |
| 1780 v8::ALL_CAN_READ, |
| 1781 static_cast<v8::PropertyAttribute>(v8::DontDelete|v8::ReadOnly)); |
| 1782 |
| 1783 instance->SetAccessor( |
| 1784 v8::String::New("assign"), |
| 1785 V8Custom::v8LocationAssignAccessorGetter, |
| 1786 0, |
| 1787 v8::Handle<v8::Value>(), |
| 1788 v8::ALL_CAN_READ, |
| 1789 static_cast<v8::PropertyAttribute>(v8::DontDelete|v8::ReadOnly)); |
1763 break; | 1790 break; |
1764 } | 1791 } |
1765 case V8ClassIndex::HISTORY: { | 1792 case V8ClassIndex::HISTORY: { |
1766 break; | 1793 break; |
1767 } | 1794 } |
1768 | 1795 |
1769 case V8ClassIndex::MESSAGECHANNEL: { | 1796 case V8ClassIndex::MESSAGECHANNEL: { |
1770 // Reserve two more internal fields for referencing the port1 | 1797 // Reserve two more internal fields for referencing the port1 |
1771 // and port2 wrappers. This ensures that the port wrappers are | 1798 // and port2 wrappers. This ensures that the port wrappers are |
1772 // kept alive when the channel wrapper is. | 1799 // kept alive when the channel wrapper is. |
(...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3497 } | 3524 } |
3498 return ToWebCoreString(v8::Debug::Call(frame_source_name)); | 3525 return ToWebCoreString(v8::Debug::Call(frame_source_name)); |
3499 } | 3526 } |
3500 | 3527 |
3501 void V8Proxy::RegisterExtension(v8::Extension* extension) { | 3528 void V8Proxy::RegisterExtension(v8::Extension* extension) { |
3502 v8::RegisterExtension(extension); | 3529 v8::RegisterExtension(extension); |
3503 m_extensions.push_back(extension); | 3530 m_extensions.push_back(extension); |
3504 } | 3531 } |
3505 | 3532 |
3506 } // namespace WebCore | 3533 } // namespace WebCore |
OLD | NEW |