OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 5132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5143 }; | 5143 }; |
5144 | 5144 |
5145 | 5145 |
5146 /** | 5146 /** |
5147 * A sandboxed execution context with its own set of built-in objects | 5147 * A sandboxed execution context with its own set of built-in objects |
5148 * and functions. | 5148 * and functions. |
5149 */ | 5149 */ |
5150 class V8_EXPORT Context { | 5150 class V8_EXPORT Context { |
5151 public: | 5151 public: |
5152 /** | 5152 /** |
5153 * Returns the global proxy object or global object itself for | 5153 * Returns the global proxy object. |
5154 * detached contexts. | |
5155 * | 5154 * |
5156 * Global proxy object is a thin wrapper whose prototype points to | 5155 * Global proxy object is a thin wrapper whose prototype points to actual |
5157 * actual context's global object with the properties like Object, etc. | 5156 * context's global object with the properties like Object, etc. This is done |
5158 * This is done that way for security reasons (for more details see | 5157 * that way for security reasons (for more details see |
5159 * https://wiki.mozilla.org/Gecko:SplitWindow). | 5158 * https://wiki.mozilla.org/Gecko:SplitWindow). |
5160 * | 5159 * |
5161 * Please note that changes to global proxy object prototype most probably | 5160 * Please note that changes to global proxy object prototype most probably |
5162 * would break VM---v8 expects only global object as a prototype of | 5161 * would break VM---v8 expects only global object as a prototype of global |
5163 * global proxy object. | 5162 * proxy object. |
5164 * | |
5165 * If DetachGlobal() has been invoked, Global() would return actual global | |
5166 * object until global is reattached with ReattachGlobal(). | |
5167 */ | 5163 */ |
5168 Local<Object> Global(); | 5164 Local<Object> Global(); |
5169 | 5165 |
5170 /** | 5166 /** |
5171 * Detaches the global object from its context before | 5167 * Detaches the global object from its context before |
5172 * the global object can be reused to create a new context. | 5168 * the global object can be reused to create a new context. |
5173 */ | 5169 */ |
5174 void DetachGlobal(); | 5170 void DetachGlobal(); |
5175 | 5171 |
5176 /** | 5172 /** |
5177 * Reattaches a global object to a context. This can be used to | |
5178 * restore the connection between a global object and a context | |
5179 * after DetachGlobal has been called. | |
5180 * | |
5181 * \param global_object The global object to reattach to the | |
5182 * context. For this to work, the global object must be the global | |
5183 * object that was associated with this context before a call to | |
5184 * DetachGlobal. | |
5185 */ | |
5186 void ReattachGlobal(Handle<Object> global_object); | |
5187 | |
5188 /** | |
5189 * Creates a new context and returns a handle to the newly allocated | 5173 * Creates a new context and returns a handle to the newly allocated |
5190 * context. | 5174 * context. |
5191 * | 5175 * |
5192 * \param isolate The isolate in which to create the context. | 5176 * \param isolate The isolate in which to create the context. |
5193 * | 5177 * |
5194 * \param extensions An optional extension configuration containing | 5178 * \param extensions An optional extension configuration containing |
5195 * the extensions to be installed in the newly created context. | 5179 * the extensions to be installed in the newly created context. |
5196 * | 5180 * |
5197 * \param global_template An optional object template from which the | 5181 * \param global_template An optional object template from which the |
5198 * global object for the newly created context will be created. | 5182 * global object for the newly created context will be created. |
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6759 */ | 6743 */ |
6760 | 6744 |
6761 | 6745 |
6762 } // namespace v8 | 6746 } // namespace v8 |
6763 | 6747 |
6764 | 6748 |
6765 #undef TYPE_CHECK | 6749 #undef TYPE_CHECK |
6766 | 6750 |
6767 | 6751 |
6768 #endif // V8_H_ | 6752 #endif // V8_H_ |
OLD | NEW |