| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_PROXY_H__ | 5 #ifndef V8_PROXY_H__ |
| 6 #define V8_PROXY_H__ | 6 #define V8_PROXY_H__ |
| 7 | 7 |
| 8 #include <v8.h> | 8 #include <v8.h> |
| 9 #include "v8_index.h" | 9 #include "v8_index.h" |
| 10 #include "v8_utility.h" | 10 #include "v8_utility.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 static void GCUnprotect(void* dom_object); | 235 static void GCUnprotect(void* dom_object); |
| 236 | 236 |
| 237 #if ENABLE(SVG) | 237 #if ENABLE(SVG) |
| 238 static void SetSVGContext(void* object, SVGElement* context); | 238 static void SetSVGContext(void* object, SVGElement* context); |
| 239 static SVGElement* GetSVGContext(void* object); | 239 static SVGElement* GetSVGContext(void* object); |
| 240 #endif | 240 #endif |
| 241 | 241 |
| 242 void setEventHandlerLineno(int lineno) { m_handlerLineno = lineno; } | 242 void setEventHandlerLineno(int lineno) { m_handlerLineno = lineno; } |
| 243 void finishedWithEvent(Event* event) { } | 243 void finishedWithEvent(Event* event) { } |
| 244 | 244 |
| 245 // Evaluate JavaScript in a new isolated world. The script gets its own |
| 246 // global scope, its own prototypes for intrinsic JavaScript objects (String, |
| 247 // Array, and so-on), and its own wrappers for all DOM nodes and DOM |
| 248 // constructors. |
| 249 void evaluateInNewWorld(const Vector<ScriptSourceCode>& sources); |
| 250 |
| 245 // Evaluate JavaScript in a new context. The script gets its own global scope | 251 // Evaluate JavaScript in a new context. The script gets its own global scope |
| 246 // and its own prototypes for intrinsic JavaScript objects (String, Array, | 252 // and its own prototypes for intrinsic JavaScript objects (String, Array, |
| 247 // and so-on). It shares the wrappers for all DOM nodes and DOM constructors. | 253 // and so-on). It shares the wrappers for all DOM nodes and DOM constructors. |
| 248 void evaluateInNewContext(const Vector<ScriptSourceCode>& sources); | 254 void evaluateInNewContext(const Vector<ScriptSourceCode>& sources); |
| 249 | 255 |
| 250 // Evaluate a script file in the current execution environment. | 256 // Evaluate a script file in the current execution environment. |
| 251 // The caller must hold an execution context. | 257 // The caller must hold an execution context. |
| 252 // If cannot evalute the script, it returns an error. | 258 // If cannot evalute the script, it returns an error. |
| 253 v8::Local<v8::Value> evaluate(const ScriptSourceCode& source, | 259 v8::Local<v8::Value> evaluate(const ScriptSourceCode& source, |
| 254 Node* node); | 260 Node* node); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 // Registers an extension to be available on webpages with a particular scheme | 502 // Registers an extension to be available on webpages with a particular scheme |
| 497 // If the scheme argument is empty, the extension is available on all pages. | 503 // If the scheme argument is empty, the extension is available on all pages. |
| 498 // Will only affect v8 contexts initialized after this call. Takes ownership | 504 // Will only affect v8 contexts initialized after this call. Takes ownership |
| 499 // of the v8::Extension object passed. | 505 // of the v8::Extension object passed. |
| 500 static void RegisterExtension(v8::Extension* extension, | 506 static void RegisterExtension(v8::Extension* extension, |
| 501 const String& schemeRestriction); | 507 const String& schemeRestriction); |
| 502 | 508 |
| 503 static void* ToSVGPODTypeImpl(V8ClassIndex::V8WrapperType type, | 509 static void* ToSVGPODTypeImpl(V8ClassIndex::V8WrapperType type, |
| 504 v8::Handle<v8::Value> object); | 510 v8::Handle<v8::Value> object); |
| 505 | 511 |
| 512 // TODO(abarth): Separate these concerns from V8Proxy? |
| 513 v8::Persistent<v8::Context> createNewContext(v8::Handle<v8::Object> global); |
| 514 bool installDOMWindow(v8::Handle<v8::Context> context, DOMWindow* window); |
| 515 |
| 506 private: | 516 private: |
| 507 static const char* kContextDebugDataType; | 517 static const char* kContextDebugDataType; |
| 508 static const char* kContextDebugDataValue; | 518 static const char* kContextDebugDataValue; |
| 509 | 519 |
| 510 v8::Persistent<v8::Context> createNewContext(v8::Handle<v8::Object> global); | |
| 511 void InitContextIfNeeded(); | 520 void InitContextIfNeeded(); |
| 512 void DisconnectEventListeners(); | 521 void DisconnectEventListeners(); |
| 513 void SetSecurityToken(); | 522 void SetSecurityToken(); |
| 514 void ClearDocumentWrapper(); | 523 void ClearDocumentWrapper(); |
| 515 void UpdateDocumentWrapper(v8::Handle<v8::Value> wrapper); | 524 void UpdateDocumentWrapper(v8::Handle<v8::Value> wrapper); |
| 516 | 525 |
| 517 // The JavaScript wrapper for the document object is cached on the global | 526 // The JavaScript wrapper for the document object is cached on the global |
| 518 // object for fast access. UpdateDocumentWrapperCache sets the wrapper | 527 // object for fast access. UpdateDocumentWrapperCache sets the wrapper |
| 519 // for the current document on the global object. ClearDocumentWrapperCache | 528 // for the current document on the global object. ClearDocumentWrapperCache |
| 520 // deletes the document wrapper from the global object. | 529 // deletes the document wrapper from the global object. |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 V8Proxy::SetDOMWrapper(args.Holder(), tag, obj.get()); | 664 V8Proxy::SetDOMWrapper(args.Holder(), tag, obj.get()); |
| 656 obj->ref(); | 665 obj->ref(); |
| 657 V8Proxy::SetJSWrapperForDOMObject( | 666 V8Proxy::SetJSWrapperForDOMObject( |
| 658 obj.get(), v8::Persistent<v8::Object>::New(args.Holder())); | 667 obj.get(), v8::Persistent<v8::Object>::New(args.Holder())); |
| 659 return args.Holder(); | 668 return args.Holder(); |
| 660 } | 669 } |
| 661 | 670 |
| 662 } // namespace WebCore | 671 } // namespace WebCore |
| 663 | 672 |
| 664 #endif // V8_PROXY_H__ | 673 #endif // V8_PROXY_H__ |
| OLD | NEW |