void setDOMException(ExecState* exec, ExceptionCode ec) { if (!ec || exec->hadException()) return; // FIXME: All callers to setDOMException need to pass in the right global object // for now, we're going to assume the lexicalGlobalObject. Which is wrong in cases like this: // frames[0].document.createElement(null, null); // throws an exception which should have the subframes prototypes. JSDOMGlobalObject* globalObject = deprecatedGlobalObjectForPrototype(exec); ExceptionCodeDescription description; getExceptionCodeDescription(ec, description); JSValue errorObject; switch (description.type) { case DOMExceptionType: errorObject = toJS(exec, globalObject, DOMCoreException::create(description)); break; case RangeExceptionType: errorObject = toJS(exec, globalObject, RangeException::create(description)); break; case EventExceptionType: errorObject = toJS(exec, globalObject, EventException::create(description)); break; case XMLHttpRequestExceptionType: errorObject = toJS(exec, globalObject, XMLHttpRequestException::create(description)); break; #if ENABLE(SVG) case SVGExceptionType: errorObject = toJS(exec, globalObject, SVGException::create(description).get()); break; #endif #if ENABLE(XPATH) case XPathExceptionType: errorObject = toJS(exec, globalObject, XPathException::create(description)); break; #endif #if ENABLE(DATABASE) case SQLExceptionType: errorObject = toJS(exec, globalObject, SQLException::create(description)); break; #endif #if ENABLE(BLOB) || ENABLE(FILE_SYSTEM) case FileExceptionType: errorObject = toJS(exec, globalObject, FileException::create(description)); break; #endif #if ENABLE(INDEXED_DATABASE) case IDBDatabaseExceptionType: errorObject = toJS(exec, globalObject, IDBDatabaseException::create(description)); break; #endif } ASSERT(errorObject); throwError(exec, errorObject); }
void V8Proxy::setDOMException(int exceptionCode) { if (exceptionCode <= 0) return; ExceptionCodeDescription description; getExceptionCodeDescription(exceptionCode, description); v8::Handle<v8::Value> exception; switch (description.type) { case DOMExceptionType: exception = toV8(DOMCoreException::create(description)); break; case RangeExceptionType: exception = toV8(RangeException::create(description)); break; case EventExceptionType: exception = toV8(EventException::create(description)); break; case XMLHttpRequestExceptionType: exception = toV8(XMLHttpRequestException::create(description)); break; #if ENABLE(SVG) case SVGExceptionType: exception = toV8(SVGException::create(description)); break; #endif #if ENABLE(XPATH) case XPathExceptionType: exception = toV8(XPathException::create(description)); break; #endif #if ENABLE(DATABASE) case SQLExceptionType: exception = toV8(SQLException::create(description)); break; #endif #if ENABLE(BLOB) || ENABLE(FILE_SYSTEM) case FileExceptionType: exception = toV8(FileException::create(description)); break; #endif #if ENABLE(INDEXED_DATABASE) case IDBDatabaseExceptionType: exception = toV8(IDBDatabaseException::create(description)); break; #endif default: ASSERT_NOT_REACHED(); } if (!exception.IsEmpty()) v8::ThrowException(exception); }
void V8Proxy::setDOMException(int exceptionCode) { if (exceptionCode <= 0) return; ExceptionCodeDescription description; getExceptionCodeDescription(exceptionCode, description); v8::Handle<v8::Value> exception; switch (description.type) { case DOMExceptionType: exception = toV8(DOMCoreException::create(description)); break; case RangeExceptionType: exception = toV8(RangeException::create(description)); break; case EventExceptionType: exception = toV8(EventException::create(description)); break; case XMLHttpRequestExceptionType: exception = toV8(XMLHttpRequestException::create(description)); break; #if ENABLE(SVG) case SVGExceptionType: exception = toV8(SVGException::create(description)); break; #endif #if ENABLE(XPATH) case XPathExceptionType: exception = toV8(XPathException::create(description)); break; #endif } ASSERT(!exception.IsEmpty()); v8::ThrowException(exception); }
void V8Proxy::setDOMException(int exceptionCode) { if (exceptionCode <= 0) return; ExceptionCodeDescription description; getExceptionCodeDescription(exceptionCode, description); v8::Handle<v8::Value> exception; switch (description.type) { case DOMExceptionType: exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMCOREEXCEPTION, DOMCoreException::create(description)); break; case RangeExceptionType: exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::RANGEEXCEPTION, RangeException::create(description)); break; case EventExceptionType: exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::EVENTEXCEPTION, EventException::create(description)); break; case XMLHttpRequestExceptionType: exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::XMLHTTPREQUESTEXCEPTION, XMLHttpRequestException::create(description)); break; #if ENABLE(SVG) case SVGExceptionType: exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::SVGEXCEPTION, SVGException::create(description)); break; #endif #if ENABLE(XPATH) case XPathExceptionType: exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::XPATHEXCEPTION, XPathException::create(description)); break; #endif } ASSERT(!exception.IsEmpty()); v8::ThrowException(exception); }