| 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 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 // Information about an extension that is registered for use with V8. If | 122 // Information about an extension that is registered for use with V8. If |
| 123 // scheme is non-empty, it contains the URL scheme the extension should be | 123 // scheme is non-empty, it contains the URL scheme the extension should be |
| 124 // used with. If group is non-zero, the extension will only be loaded into | 124 // used with. If group is non-zero, the extension will only be loaded into |
| 125 // script contexts that belong to that group. Otherwise, the extension is | 125 // script contexts that belong to that group. Otherwise, the extension is |
| 126 // used with all schemes and contexts. | 126 // used with all schemes and contexts. |
| 127 struct V8ExtensionInfo { | 127 struct V8ExtensionInfo { |
| 128 String scheme; | 128 String scheme; |
| 129 int group; | 129 int group; |
| 130 v8::Extension* extension; | 130 v8::Extension* extension; |
| 131 bool useCallback; // FIXME: remove |
| 131 }; | 132 }; |
| 132 typedef WTF::Vector<V8ExtensionInfo> V8Extensions; | 133 typedef WTF::Vector<V8ExtensionInfo> V8Extensions; |
| 133 | 134 |
| 134 class V8Proxy { | 135 class V8Proxy { |
| 135 public: | 136 public: |
| 136 // The types of javascript errors that can be thrown. | 137 // The types of javascript errors that can be thrown. |
| 137 enum ErrorType { | 138 enum ErrorType { |
| 138 RangeError, | 139 RangeError, |
| 139 ReferenceError, | 140 ReferenceError, |
| 140 SyntaxError, | 141 SyntaxError, |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 // Registers a v8 extension to be available on webpages. The two forms | 323 // Registers a v8 extension to be available on webpages. The two forms |
| 323 // offer various restrictions on what types of contexts the extension is | 324 // offer various restrictions on what types of contexts the extension is |
| 324 // loaded into. If a scheme is provided, only pages whose URL has the gi
ven | 325 // loaded into. If a scheme is provided, only pages whose URL has the gi
ven |
| 325 // scheme will match. If extensionGroup is provided, the extension will | 326 // scheme will match. If extensionGroup is provided, the extension will |
| 326 // only be loaded into scripts run via evaluateInNewWorld with the | 327 // only be loaded into scripts run via evaluateInNewWorld with the |
| 327 // matching group. Will only affect v8 contexts initialized after this | 328 // matching group. Will only affect v8 contexts initialized after this |
| 328 // call. Takes ownership of the v8::Extension object passed. | 329 // call. Takes ownership of the v8::Extension object passed. |
| 329 static void registerExtension(v8::Extension*, const String& schemeRestri
ction); | 330 static void registerExtension(v8::Extension*, const String& schemeRestri
ction); |
| 330 static void registerExtension(v8::Extension*, int extensionGroup); | 331 static void registerExtension(v8::Extension*, int extensionGroup); |
| 331 | 332 |
| 333 // Same as above, but new version. |
| 334 // FIXME: remove the other 2 versions in phase 3 of multipart checkin: |
| 335 // https://bugs.webkit.org/show_bug.cgi?id=45721 |
| 336 static void registerExtension(v8::Extension*); |
| 337 |
| 332 static void registerExtensionWithV8(v8::Extension*); | 338 static void registerExtensionWithV8(v8::Extension*); |
| 333 static bool registeredExtensionWithV8(v8::Extension*); | 339 static bool registeredExtensionWithV8(v8::Extension*); |
| 334 | 340 |
| 335 static const V8Extensions& extensions() { return m_extensions; } | 341 static const V8Extensions& extensions() { return m_extensions; } |
| 336 | 342 |
| 337 // Report an unsafe attempt to access the given frame on the console. | 343 // Report an unsafe attempt to access the given frame on the console. |
| 338 static void reportUnsafeAccessTo(Frame* target, DelayReporting delay); | 344 static void reportUnsafeAccessTo(Frame* target, DelayReporting delay); |
| 339 | 345 |
| 340 private: | 346 private: |
| 341 void didLeaveScriptContext(); | 347 void didLeaveScriptContext(); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 template <class T> inline v8::Handle<v8::Object> toV8(PassRefPtr<T> object,
v8::Local<v8::Object> holder) | 477 template <class T> inline v8::Handle<v8::Object> toV8(PassRefPtr<T> object,
v8::Local<v8::Object> holder) |
| 472 { | 478 { |
| 473 object->ref(); | 479 object->ref(); |
| 474 V8DOMWrapper::setJSWrapperForDOMObject(object.get(), v8::Persistent<v8::
Object>::New(holder)); | 480 V8DOMWrapper::setJSWrapperForDOMObject(object.get(), v8::Persistent<v8::
Object>::New(holder)); |
| 475 return holder; | 481 return holder; |
| 476 } | 482 } |
| 477 | 483 |
| 478 } | 484 } |
| 479 | 485 |
| 480 #endif // V8Proxy_h | 486 #endif // V8Proxy_h |
| OLD | NEW |