| 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 2935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2946 result->SetInternalField(V8Custom::kHTMLDocumentMarkerIndex, marker); | 2946 result->SetInternalField(V8Custom::kHTMLDocumentMarkerIndex, marker); |
| 2947 result->SetInternalField(V8Custom::kHTMLDocumentShadowIndex, marker); | 2947 result->SetInternalField(V8Custom::kHTMLDocumentShadowIndex, marker); |
| 2948 } | 2948 } |
| 2949 } | 2949 } |
| 2950 | 2950 |
| 2951 return result; | 2951 return result; |
| 2952 } | 2952 } |
| 2953 | 2953 |
| 2954 | 2954 |
| 2955 // A JS object of type EventTarget can only be the following possible types: | 2955 // A JS object of type EventTarget can only be the following possible types: |
| 2956 // 1) EventTargetNode; 2) XMLHttpRequest; 3) MessagePort; 4) SVGElementInstance; | 2956 // 1) EventTargetNode; 2) DOMWindow 3) XMLHttpRequest; 4) MessagePort; |
| 2957 // 5) XMLHttpRequestUpload 6) Worker | 2957 // 5) XMLHttpRequestUpload |
| 2958 // check EventTarget.h for new type conversion methods | 2958 // check EventTarget.h for new type conversion methods |
| 2959 v8::Handle<v8::Value> V8Proxy::EventTargetToV8Object(EventTarget* target) | 2959 v8::Handle<v8::Value> V8Proxy::EventTargetToV8Object(EventTarget* target) |
| 2960 { | 2960 { |
| 2961 if (!target) | 2961 if (!target) |
| 2962 return v8::Null(); | 2962 return v8::Null(); |
| 2963 | 2963 |
| 2964 #if ENABLE(SVG) | 2964 #if ENABLE(SVG) |
| 2965 SVGElementInstance* instance = target->toSVGElementInstance(); | 2965 SVGElementInstance* instance = target->toSVGElementInstance(); |
| 2966 if (instance) | 2966 if (instance) |
| 2967 return ToV8Object(V8ClassIndex::SVGELEMENTINSTANCE, instance); | 2967 return ToV8Object(V8ClassIndex::SVGELEMENTINSTANCE, instance); |
| 2968 #endif | 2968 #endif |
| 2969 | 2969 |
| 2970 #if ENABLE(WORKERS) | 2970 #if ENABLE(WORKERS) |
| 2971 Worker* worker = target->toWorker(); | 2971 Worker* worker = target->toWorker(); |
| 2972 if (worker) | 2972 if (worker) |
| 2973 return ToV8Object(V8ClassIndex::WORKER, worker); | 2973 return ToV8Object(V8ClassIndex::WORKER, worker); |
| 2974 #endif // WORKERS | 2974 #endif // WORKERS |
| 2975 | 2975 |
| 2976 Node* node = target->toNode(); | 2976 Node* node = target->toNode(); |
| 2977 if (node) | 2977 if (node) |
| 2978 return NodeToV8Object(node); | 2978 return NodeToV8Object(node); |
| 2979 | 2979 |
| 2980 if (DOMWindow* domWindow = target->toDOMWindow()) |
| 2981 return ToV8Object(V8ClassIndex::DOMWINDOW, domWindow); |
| 2982 |
| 2980 // XMLHttpRequest is created within its JS counterpart. | 2983 // XMLHttpRequest is created within its JS counterpart. |
| 2981 XMLHttpRequest* xhr = target->toXMLHttpRequest(); | 2984 XMLHttpRequest* xhr = target->toXMLHttpRequest(); |
| 2982 if (xhr) { | 2985 if (xhr) { |
| 2983 v8::Handle<v8::Object> wrapper = getActiveDOMObjectMap().get(xhr); | 2986 v8::Handle<v8::Object> wrapper = getActiveDOMObjectMap().get(xhr); |
| 2984 ASSERT(!wrapper.IsEmpty()); | 2987 ASSERT(!wrapper.IsEmpty()); |
| 2985 return wrapper; | 2988 return wrapper; |
| 2986 } | 2989 } |
| 2987 | 2990 |
| 2988 // MessagePort is created within its JS counterpart | 2991 // MessagePort is created within its JS counterpart |
| 2989 MessagePort* port = target->toMessagePort(); | 2992 MessagePort* port = target->toMessagePort(); |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3283 } | 3286 } |
| 3284 | 3287 |
| 3285 void V8Proxy::RegisterExtension(v8::Extension* extension, | 3288 void V8Proxy::RegisterExtension(v8::Extension* extension, |
| 3286 const String& schemeRestriction) { | 3289 const String& schemeRestriction) { |
| 3287 v8::RegisterExtension(extension); | 3290 v8::RegisterExtension(extension); |
| 3288 V8ExtensionInfo info = {schemeRestriction, extension}; | 3291 V8ExtensionInfo info = {schemeRestriction, extension}; |
| 3289 m_extensions.push_back(info); | 3292 m_extensions.push_back(info); |
| 3290 } | 3293 } |
| 3291 | 3294 |
| 3292 } // namespace WebCore | 3295 } // namespace WebCore |
| OLD | NEW |