v8::Handle<v8::Value> V8XMLHttpRequest::responseTextAttrGetterCustom(v8::Local<v8::String> name, const v8::AccessorInfo& info) { XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder()); ExceptionCode ec = 0; const String& text = xmlHttpRequest->responseText(ec); if (ec) return setDOMException(ec, info.GetIsolate()); return v8String(text, info.GetIsolate()); }
v8::Handle<v8::Value> V8XMLHttpRequest::responseTextAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.XMLHttpRequest.responsetext._get"); XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder()); ExceptionCode ec = 0; const ScriptString& text = xmlHttpRequest->responseText(ec); if (ec) return throwError(ec); return text.v8StringOrNull(); }
void V8XMLHttpRequest::responseTextAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>& info) { XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder()); ExceptionState exceptionState(ExceptionState::GetterContext, "responseText", "XMLHttpRequest", info.Holder(), info.GetIsolate()); ScriptString text = xmlHttpRequest->responseText(exceptionState); if (exceptionState.throwIfNeeded()) return; if (text.isEmpty()) { v8SetReturnValueString(info, emptyString(), info.GetIsolate()); return; } v8SetReturnValue(info, text.v8Value()); }
v8::Handle<v8::Value> V8XMLHttpRequest::responseTextAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.XMLHttpRequest.responsetext._get"); XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder()); return xmlHttpRequest->responseText().v8StringOrNull(); }
JSValue* JSXMLHttpRequest::getValueProperty(ExecState* exec, int token) const { switch (token) { case OnabortAttrNum: { return onabort(exec); } case OnerrorAttrNum: { return onerror(exec); } case OnloadAttrNum: { return onload(exec); } case OnloadstartAttrNum: { return onloadstart(exec); } case OnprogressAttrNum: { return onprogress(exec); } case OnreadystatechangeAttrNum: { return onreadystatechange(exec); } case ReadyStateAttrNum: { XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(impl()); return jsNumber(exec, imp->readyState()); } case ResponseTextAttrNum: { XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(impl()); return jsStringOrNull(exec, imp->responseText()); } case ResponseXMLAttrNum: { XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(impl()); return toJS(exec, WTF::getPtr(imp->responseXML())); } case StatusAttrNum: { ExceptionCode ec = 0; XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(impl()); KJS::JSValue* result = jsNumber(exec, imp->status(ec)); setDOMException(exec, ec); return result; } case StatusTextAttrNum: { ExceptionCode ec = 0; XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(impl()); KJS::JSValue* result = jsString(exec, imp->statusText(ec)); setDOMException(exec, ec); return result; } } return 0; }