| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 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 25 matching lines...) Expand all Loading... |
| 36 #include "V8Document.h" | 36 #include "V8Document.h" |
| 37 #include "V8CustomBinding.h" | 37 #include "V8CustomBinding.h" |
| 38 #include "V8HTMLDocument.h" | 38 #include "V8HTMLDocument.h" |
| 39 #include "V8ObjectEventListener.h" | 39 #include "V8ObjectEventListener.h" |
| 40 #include "V8Proxy.h" | 40 #include "V8Proxy.h" |
| 41 #include "V8Utilities.h" | 41 #include "V8Utilities.h" |
| 42 #include "WorkerContext.h" | 42 #include "WorkerContext.h" |
| 43 #include "WorkerContextExecutionProxy.h" | 43 #include "WorkerContextExecutionProxy.h" |
| 44 | 44 |
| 45 namespace WebCore { | 45 namespace WebCore { |
| 46 | 46 |
| 47 PassRefPtr<EventListener> getEventListener(XMLHttpRequest* xmlHttpRequest, v8::L
ocal<v8::Value> value, bool findOnly) | 47 static PassRefPtr<EventListener> getEventListener(XMLHttpRequest* xmlHttpRequest
, v8::Local<v8::Value> value, bool findOnly) |
| 48 { | 48 { |
| 49 #if ENABLE(WORKERS) | 49 #if ENABLE(WORKERS) |
| 50 WorkerContextExecutionProxy* workerContextProxy = WorkerContextExecutionProx
y::retrieve(); | 50 WorkerContextExecutionProxy* workerContextProxy = WorkerContextExecutionProx
y::retrieve(); |
| 51 if (workerContextProxy) | 51 if (workerContextProxy) |
| 52 return workerContextProxy->findOrCreateObjectEventListener(value, false,
findOnly); | 52 return workerContextProxy->findOrCreateObjectEventListener(value, false,
findOnly); |
| 53 #endif | 53 #endif |
| 54 | 54 |
| 55 V8Proxy* proxy = V8Proxy::retrieve(xmlHttpRequest->scriptExecutionContext())
; | 55 V8Proxy* proxy = V8Proxy::retrieve(xmlHttpRequest->scriptExecutionContext())
; |
| 56 if (proxy) { | 56 if (proxy) { |
| 57 V8EventListenerList* list = proxy->objectListeners(); | 57 V8EventListenerList* list = proxy->objectListeners(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 if (value->IsNull()) { | 114 if (value->IsNull()) { |
| 115 if (xmlHttpRequest->onerror()) { | 115 if (xmlHttpRequest->onerror()) { |
| 116 V8ObjectEventListener* listener = static_cast<V8ObjectEventListener*
>(xmlHttpRequest->onerror()); | 116 V8ObjectEventListener* listener = static_cast<V8ObjectEventListener*
>(xmlHttpRequest->onerror()); |
| 117 v8::Local<v8::Object> v8Listener = listener->getListenerObject(); | 117 v8::Local<v8::Object> v8Listener = listener->getListenerObject(); |
| 118 removeHiddenDependency(info.Holder(), v8Listener, V8Custom::kXMLHttp
RequestCacheIndex); | 118 removeHiddenDependency(info.Holder(), v8Listener, V8Custom::kXMLHttp
RequestCacheIndex); |
| 119 } | 119 } |
| 120 | 120 |
| 121 // Clear the listener. | 121 // Clear the listener. |
| 122 xmlHttpRequest->setOnerror(0); | 122 xmlHttpRequest->setOnerror(0); |
| 123 } else { | 123 } else { |
| 124 RefPtr<EventListener> listener = getEventListener(xmlHttpRequest, value,
false); | 124 RefPtr<EventListener> listener = getEventListener(xmlHttpRequest, value, f
alse); |
| 125 if (listener) { | 125 if (listener) { |
| 126 xmlHttpRequest->setOnerror(listener); | 126 xmlHttpRequest->setOnerror(listener); |
| 127 createHiddenDependency(info.Holder(), value, V8Custom::kXMLHttpReque
stCacheIndex); | 127 createHiddenDependency(info.Holder(), value, V8Custom::kXMLHttpReque
stCacheIndex); |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 ACCESSOR_GETTER(XMLHttpRequestOnload) | 132 ACCESSOR_GETTER(XMLHttpRequestOnload) |
| 133 { | 133 { |
| 134 INC_STATS("DOM.XMLHttpRequest.onload._get"); | 134 INC_STATS("DOM.XMLHttpRequest.onload._get"); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 return v8::Undefined(); | 437 return v8::Undefined(); |
| 438 } | 438 } |
| 439 | 439 |
| 440 CALLBACK_FUNC_DECL(XMLHttpRequestDispatchEvent) | 440 CALLBACK_FUNC_DECL(XMLHttpRequestDispatchEvent) |
| 441 { | 441 { |
| 442 INC_STATS("DOM.XMLHttpRequest.dispatchEvent()"); | 442 INC_STATS("DOM.XMLHttpRequest.dispatchEvent()"); |
| 443 return v8::Undefined(); | 443 return v8::Undefined(); |
| 444 } | 444 } |
| 445 | 445 |
| 446 } // namespace WebCore | 446 } // namespace WebCore |
| OLD | NEW |