diff options
Diffstat (limited to 'WebCore/bindings/js/JSWorkerContextBase.cpp')
-rw-r--r-- | WebCore/bindings/js/JSWorkerContextBase.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/WebCore/bindings/js/JSWorkerContextBase.cpp b/WebCore/bindings/js/JSWorkerContextBase.cpp index 24dd50f..c948b85 100644 --- a/WebCore/bindings/js/JSWorkerContextBase.cpp +++ b/WebCore/bindings/js/JSWorkerContextBase.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2009 Google Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -38,6 +39,7 @@ #include "JSMessagePort.h" #include "JSWorkerLocation.h" #include "JSWorkerNavigator.h" +#include "JSXMLHttpRequestConstructor.h" #include "WorkerContext.h" #include "WorkerLocation.h" @@ -45,14 +47,19 @@ using namespace JSC; /* @begin JSWorkerContextBaseTable +# -- Constructors -- + XMLHttpRequest jsWorkerContextBaseXMLHttpRequest DontDelete @end */ +static JSValuePtr jsWorkerContextBaseXMLHttpRequest(ExecState*, const Identifier&, const PropertySlot&); +static void setJSWorkerContextBaseXMLHttpRequest(ExecState*, JSObject*, JSValuePtr); + #include "JSWorkerContextBase.lut.h" namespace WebCore { -ASSERT_CLASS_FITS_IN_CELL(JSWorkerContextBase) +ASSERT_CLASS_FITS_IN_CELL(JSWorkerContextBase); JSWorkerContextBase::JSWorkerContextBase(PassRefPtr<JSC::Structure> structure, PassRefPtr<WorkerContext> impl) : JSDOMGlobalObject(structure, new JSDOMGlobalObjectData, this) @@ -81,6 +88,33 @@ void JSWorkerContextBase::put(ExecState* exec, const Identifier& propertyName, J lookupPut<JSWorkerContextBase, Base>(exec, propertyName, value, getJSWorkerContextBaseTable(exec), this, slot); } +bool JSWorkerContextBase::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + const HashEntry* entry = getJSWorkerContextBaseTable(exec)->entry(exec, propertyName); + if (entry) { + if (entry->attributes() & Function) + setUpStaticFunctionSlot(exec, entry, this, propertyName, slot); + else + slot.setCustom(this, entry->propertyGetter()); + return true; + } + + return Base::getOwnPropertySlot(exec, propertyName, slot); +} + } // namespace WebCore +using namespace WebCore; + +JSValuePtr jsWorkerContextBaseXMLHttpRequest(ExecState* exec, const Identifier&, const PropertySlot& slot) +{ + return getDOMConstructor<JSXMLHttpRequestConstructor>(exec, static_cast<JSWorkerContextBase*>(asObject(slot.slotBase()))); +} + +void setJSWorkerContextBaseXMLHttpRequest(ExecState* exec, JSObject* thisObject, JSValuePtr value) +{ + // Shadowing a built-in constructor + static_cast<JSWorkerContextBase*>(thisObject)->putDirect(Identifier(exec, "XMLHttpRequest"), value); +} + #endif // ENABLE(WORKERS) |