JSObject* cachedDocumentWrapper(ExecState& state, JSDOMGlobalObject& globalObject, Document& document) { if (auto* wrapper = getCachedWrapper(globalObject.world(), document)) return wrapper; auto* window = document.domWindow(); if (!window) return nullptr; // Creating a wrapper for domWindow might have created a wrapper for document as well. return getCachedWrapper(toJSDOMWindow(toJS(&state, *window))->world(), document); }
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Document* document) { if (!document) return jsNull(); JSDOMWrapper* wrapper = getCachedWrapper(currentWorld(exec), document); if (wrapper) return wrapper; if (document->isHTMLDocument()) wrapper = CREATE_DOM_WRAPPER(exec, globalObject, HTMLDocument, document); #if ENABLE(SVG) else if (document->isSVGDocument()) wrapper = CREATE_DOM_WRAPPER(exec, globalObject, SVGDocument, document); #endif else wrapper = CREATE_DOM_WRAPPER(exec, globalObject, Document, document); // Make sure the document is kept around by the window object, and works right with the // back/forward cache. if (!document->frame()) { size_t nodeCount = 0; for (Node* n = document; n; n = n->traverseNextNode()) nodeCount++; exec->heap()->reportExtraMemoryCost(nodeCount * sizeof(Node)); } return wrapper; }
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, CSSValue* value) { if (!value) return jsNull(); JSDOMWrapper* wrapper = getCachedWrapper(currentWorld(exec), value); if (wrapper) return wrapper; if (value->isWebKitCSSTransformValue()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, WebKitCSSTransformValue, value); else if (value->isValueList()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, CSSValueList, value); #if ENABLE(SVG) else if (value->isSVGPaint()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPaint, value); else if (value->isSVGColor()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGColor, value); #endif else if (value->isPrimitiveValue()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, CSSPrimitiveValue, value); else wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, CSSValue, value); return wrapper; }
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, CSSRule* rule) { if (!rule) return jsNull(); JSDOMWrapper* wrapper = getCachedWrapper(currentWorld(exec), rule); if (wrapper) return wrapper; switch (rule->type()) { case CSSRule::STYLE_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSStyleRule, rule); break; case CSSRule::MEDIA_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSMediaRule, rule); break; case CSSRule::FONT_FACE_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSFontFaceRule, rule); break; case CSSRule::PAGE_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSPageRule, rule); break; case CSSRule::IMPORT_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSImportRule, rule); break; case CSSRule::CHARSET_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSCharsetRule, rule); break; case CSSRule::WEBKIT_KEYFRAME_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebKitCSSKeyframeRule, rule); break; case CSSRule::WEBKIT_KEYFRAMES_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebKitCSSKeyframesRule, rule); break; #if ENABLE(CSS3_CONDITIONAL_RULES) case CSSRule::SUPPORTS_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSSupportsRule, rule); break; #endif #if ENABLE(CSS_DEVICE_ADAPTATION) case CSSRule::WEBKIT_VIEWPORT_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebKitCSSViewportRule, rule); break; #endif #if ENABLE(CSS_REGIONS) case CSSRule::WEBKIT_REGION_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebKitCSSRegionRule, rule); break; #endif #if ENABLE(SHADOW_DOM) case CSSRule::HOST_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSHostRule, rule); break; #endif default: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSRule, rule); } return wrapper; }
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TrackBase* track) { if (!track) return jsNull(); JSObject* wrapper = getCachedWrapper(globalObject->world(), track); if (wrapper) return wrapper; switch (track->type()) { case TrackBase::BaseTrack: // This should never happen. ASSERT_NOT_REACHED(); break; case TrackBase::AudioTrack: return CREATE_DOM_WRAPPER(globalObject, AudioTrack, track); case TrackBase::VideoTrack: return CREATE_DOM_WRAPPER(globalObject, VideoTrack, track); case TrackBase::TextTrack: return CREATE_DOM_WRAPPER(globalObject, TextTrack, track); } return jsNull(); }
JSValue toJS(ExecState*, JSDOMGlobalObject* globalObject, CSSValue* value) { if (!value) return jsNull(); // Scripts should only ever see cloned CSSValues, never the internal ones. ASSERT(value->isCSSOMSafe()); // If we're here under erroneous circumstances, prefer returning null over a potentially insecure value. if (!value->isCSSOMSafe()) return jsNull(); JSObject* wrapper = getCachedWrapper(globalObject->world(), value); if (wrapper) return wrapper; if (value->isWebKitCSSTransformValue()) wrapper = CREATE_DOM_WRAPPER(globalObject, WebKitCSSTransformValue, value); else if (value->isWebKitCSSFilterValue()) wrapper = CREATE_DOM_WRAPPER(globalObject, WebKitCSSFilterValue, value); else if (value->isValueList()) wrapper = CREATE_DOM_WRAPPER(globalObject, CSSValueList, value); else if (value->isSVGPaint()) wrapper = CREATE_DOM_WRAPPER(globalObject, SVGPaint, value); else if (value->isSVGColor()) wrapper = CREATE_DOM_WRAPPER(globalObject, SVGColor, value); else if (value->isPrimitiveValue()) wrapper = CREATE_DOM_WRAPPER(globalObject, CSSPrimitiveValue, value); else wrapper = CREATE_DOM_WRAPPER(globalObject, CSSValue, value); return wrapper; }
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, HTMLCollection* collection) { if (!collection) return jsNull(); JSDOMWrapper* wrapper = getCachedWrapper(currentWorld(exec), collection); if (wrapper) return wrapper; switch (collection->type()) { case SelectOptions: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, HTMLOptionsCollection, collection); break; case DocAll: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, HTMLAllCollection, collection); break; #if ENABLE(MICRODATA) case ItemProperties: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, HTMLPropertiesCollection, collection); break; #endif default: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, HTMLCollection, collection); break; } return wrapper; }
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, SVGPathSeg* object) { if (!object) return jsNull(); if (JSDOMWrapper* wrapper = getCachedWrapper(currentWorld(exec), object)) return wrapper; switch (object->pathSegType()) { case SVGPathSeg::PATHSEG_CLOSEPATH: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegClosePath, object); case SVGPathSeg::PATHSEG_MOVETO_ABS: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegMovetoAbs, object); case SVGPathSeg::PATHSEG_MOVETO_REL: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegMovetoRel, object); case SVGPathSeg::PATHSEG_LINETO_ABS: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoAbs, object); case SVGPathSeg::PATHSEG_LINETO_REL: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoRel, object); case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoCubicAbs, object); case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoCubicRel, object); case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoQuadraticAbs, object); case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoQuadraticRel, object); case SVGPathSeg::PATHSEG_ARC_ABS: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegArcAbs, object); case SVGPathSeg::PATHSEG_ARC_REL: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegArcRel, object); case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoHorizontalAbs, object); case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoHorizontalRel, object); case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoVerticalAbs, object); case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoVerticalRel, object); case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoCubicSmoothAbs, object); case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoCubicSmoothRel, object); case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoQuadraticSmoothAbs, object); case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoQuadraticSmoothRel, object); case SVGPathSeg::PATHSEG_UNKNOWN: default: return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSeg, object); } }
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, StyleSheet* styleSheet) { if (!styleSheet) return JSC::jsNull(); if (JSC::JSObject* wrapper = getCachedWrapper(globalObject->world(), styleSheet)) return wrapper; if (styleSheet->isCSSStyleSheet()) return CREATE_DOM_WRAPPER(globalObject, CSSStyleSheet, styleSheet); return CREATE_DOM_WRAPPER(globalObject, StyleSheet, styleSheet); }
JSValue JSDocument::location(ExecState* exec) const { Frame* frame = static_cast<Document*>(impl())->frame(); if (!frame) return jsNull(); Location* location = frame->domWindow()->location(); if (JSDOMWrapper* wrapper = getCachedWrapper(currentWorld(exec), location)) return wrapper; JSLocation* jsLocation = JSLocation::create(getDOMStructure<JSLocation>(exec, globalObject()), globalObject(), location); cacheWrapper(currentWorld(exec), location, jsLocation); return jsLocation; }
JSValue JSDocument::location(ExecState* exec) const { RefPtr<Frame> frame = impl().frame(); if (!frame) return jsNull(); RefPtr<Location> location = frame->document()->domWindow()->location(); if (JSObject* wrapper = getCachedWrapper(globalObject()->world(), location.get())) return wrapper; JSLocation* jsLocation = JSLocation::create(getDOMStructure<JSLocation>(exec->vm(), globalObject()), globalObject(), location.get()); cacheWrapper(globalObject()->world(), location.get(), jsLocation); return jsLocation; }
JSValue JSHTMLTemplateElement::content(ExecState* exec) const { JSLockHolder lock(exec); DocumentFragment* content = impl().content(); JSObject* wrapper = getCachedWrapper(currentWorld(exec), content); if (wrapper) return wrapper; wrapper = CREATE_DOM_WRAPPER(exec, globalObject(), DocumentFragment, content); PrivateName propertyName; const_cast<JSHTMLTemplateElement*>(this)->putDirect(globalObject()->vm(), propertyName, wrapper); return wrapper; }
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Document* document) { if (!document) return jsNull(); JSObject* wrapper = getCachedWrapper(globalObject->world(), document); if (wrapper) return wrapper; if (DOMWindow* domWindow = document->domWindow()) { globalObject = toJSDOMWindow(toJS(exec, domWindow)); // Creating a wrapper for domWindow might have created a wrapper for document as well. wrapper = getCachedWrapper(globalObject->world(), document); if (wrapper) return wrapper; } if (document->isHTMLDocument()) wrapper = CREATE_DOM_WRAPPER(globalObject, HTMLDocument, document); else if (document->isSVGDocument()) wrapper = CREATE_DOM_WRAPPER(globalObject, SVGDocument, document); else wrapper = CREATE_DOM_WRAPPER(globalObject, Document, document); // Make sure the document is kept around by the window object, and works right with the // back/forward cache. if (!document->frame()) { size_t nodeCount = 0; for (Node* n = document; n; n = NodeTraversal::next(n)) nodeCount++; exec->heap()->reportExtraMemoryCost(nodeCount * sizeof(Node)); } return wrapper; }
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, StyleSheet* styleSheet) { if (!styleSheet) return jsNull(); JSObject* wrapper = getCachedWrapper(currentWorld(exec), styleSheet); if (wrapper) return wrapper; if (styleSheet->isCSSStyleSheet()) wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSStyleSheet, styleSheet); else wrapper = CREATE_DOM_WRAPPER(exec, globalObject, StyleSheet, styleSheet); return wrapper; }
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, ImageData* imageData) { if (!imageData) return jsNull(); JSDOMWrapper* wrapper = getCachedWrapper(currentWorld(exec), imageData); if (wrapper) return wrapper; wrapper = CREATE_DOM_WRAPPER(exec, globalObject, ImageData, imageData); Identifier dataName(exec, "data"); wrapper->putDirect(exec->globalData(), dataName, toJS(exec, globalObject, imageData->data()), DontDelete | ReadOnly); exec->heap()->reportExtraMemoryCost(imageData->data()->length()); return wrapper; }
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, ImageData* imageData) { if (!imageData) return jsNull(); JSDOMWrapper* wrapper = getCachedWrapper(currentWorld(exec), imageData); if (wrapper) return wrapper; wrapper = CREATE_DOM_WRAPPER(exec, globalObject, ImageData, imageData); Identifier dataName(exec, "data"); static const ClassInfo cpaClassInfo = { "CanvasPixelArray", &JSByteArray::Base::s_info, 0, 0 }; DEFINE_STATIC_LOCAL(Strong<Structure>, cpaStructure, (exec->globalData(), JSByteArray::createStructure(exec->globalData(), jsNull(), &cpaClassInfo))); wrapper->putDirect(exec->globalData(), dataName, new (exec) JSByteArray(exec, cpaStructure.get(), imageData->data()->data()), DontDelete | ReadOnly); exec->heap()->reportExtraMemoryCost(imageData->data()->length()); return wrapper; }
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, CSSRule* rule) { if (!rule) return jsNull(); JSDOMWrapper* wrapper = getCachedWrapper(currentWorld(exec), rule); if (wrapper) return wrapper; switch (rule->type()) { case CSSRule::STYLE_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSStyleRule, rule); break; case CSSRule::MEDIA_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSMediaRule, rule); break; case CSSRule::FONT_FACE_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSFontFaceRule, rule); break; case CSSRule::PAGE_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSPageRule, rule); break; case CSSRule::IMPORT_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSImportRule, rule); break; case CSSRule::CHARSET_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSCharsetRule, rule); break; case CSSRule::WEBKIT_KEYFRAME_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebKitCSSKeyframeRule, rule); break; case CSSRule::WEBKIT_KEYFRAMES_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebKitCSSKeyframesRule, rule); break; case CSSRule::WEBKIT_REGION_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebKitCSSRegionRule, rule); break; default: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSRule, rule); } return wrapper; }
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, TextTrackCue* cue) { if (!cue) return jsNull(); JSObject* wrapper = getCachedWrapper(currentWorld(exec), cue); if (wrapper) return wrapper; // This switch will make more sense once we support DataCue switch (cue->cueType()) { case TextTrackCue::WebVTT: case TextTrackCue::Generic: return CREATE_DOM_WRAPPER(exec, globalObject, VTTCue, cue); default: ASSERT_NOT_REACHED(); return jsNull(); } }
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, HTMLCollection* collection) { if (!collection) return jsNull(); JSDOMWrapper* wrapper = getCachedWrapper(currentWorld(exec), collection); if (wrapper) return wrapper; switch (collection->type()) { case FormControls: return CREATE_DOM_WRAPPER(exec, globalObject, HTMLFormControlsCollection, collection); case SelectOptions: return CREATE_DOM_WRAPPER(exec, globalObject, HTMLOptionsCollection, collection); case DocAll: return CREATE_DOM_WRAPPER(exec, globalObject, HTMLAllCollection, collection); default: break; } return CREATE_DOM_WRAPPER(exec, globalObject, HTMLCollection, collection); }
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, TextTrack* impl) { if (!impl) return jsNull(); JSDOMWrapper* wrapper = getCachedWrapper(currentWorld(exec), impl); if (wrapper) return wrapper; switch (impl->trackType()) { case TextTrack::LoadableTextTrack: case TextTrack::BaseTextTrack: return CREATE_DOM_WRAPPER(exec, globalObject, TextTrack, impl); break; case TextTrack::MutableTextTrack: return CREATE_DOM_WRAPPER(exec, globalObject, MutableTextTrack, impl); break; } ASSERT_NOT_REACHED(); return jsNull(); }
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Event* event) { JSLock lock(SilenceAssertionsOnly); if (!event) return jsNull(); JSDOMWrapper* wrapper = getCachedWrapper(currentWorld(exec), event); if (wrapper) return wrapper; if (event->isUIEvent()) { if (event->isKeyboardEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, KeyboardEvent, event); else if (event->isTextEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, TextEvent, event); else if (event->isMouseEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, MouseEvent, event); else if (event->isWheelEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, WheelEvent, event); #if ENABLE(SVG) else if (event->isSVGZoomEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGZoomEvent, event); #endif else if (event->isCompositionEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, CompositionEvent, event); #if ENABLE(TOUCH_EVENTS) else if (event->isTouchEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, TouchEvent, event); #endif else wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, UIEvent, event); } else if (event->isMutationEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, MutationEvent, event); else if (event->isOverflowEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, OverflowEvent, event); else if (event->isMessageEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, MessageEvent, event); else if (event->isPageTransitionEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, PageTransitionEvent, event); else if (event->isProgressEvent()) { if (event->isXMLHttpRequestProgressEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, XMLHttpRequestProgressEvent, event); else wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, ProgressEvent, event); } else if (event->isBeforeLoadEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, BeforeLoadEvent, event); #if ENABLE(DOM_STORAGE) else if (event->isStorageEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, StorageEvent, event); #endif #if ENABLE(INDEXED_DATABASE) else if (event->isIDBVersionChangeEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, IDBVersionChangeEvent, event); #endif else if (event->isWebKitAnimationEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, WebKitAnimationEvent, event); else if (event->isWebKitTransitionEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, WebKitTransitionEvent, event); #if ENABLE(WORKERS) else if (event->isErrorEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, ErrorEvent, event); #endif else if (event->isHashChangeEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, HashChangeEvent, event); else if (event->isPopStateEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, PopStateEvent, event); else if (event->isCustomEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, CustomEvent, event); #if ENABLE(DEVICE_ORIENTATION) else if (event->isDeviceMotionEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, DeviceMotionEvent, event); else if (event->isDeviceOrientationEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, DeviceOrientationEvent, event); #endif #if ENABLE(WEB_AUDIO) else if (event->isAudioProcessingEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, AudioProcessingEvent, event); else if (event->isOfflineAudioCompletionEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, OfflineAudioCompletionEvent, event); #endif #if ENABLE(INPUT_SPEECH) else if (event->isSpeechInputEvent()) wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SpeechInputEvent, event); #endif else wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, Event, event); return wrapper; }