Commit a0c6d6e9 authored by weinig@apple.com's avatar weinig@apple.com

2009-04-22 Sam Weinig <sam@webkit.org>

        Reviewed by Anders Carlsson.

        Autogenerate the XMLHttpRequest constructor getter/setter for the
        WorkerContext and remove the now no longer needed JSWorkerContextBase.lut.h
        file.

        * DerivedSources.make: Remove JSWorkerContextBase.lut.h
        * WebCore.xcodeproj/project.pbxproj: Ditto.

        * bindings/js/JSWorkerContextBase.cpp:
        * bindings/js/JSWorkerContextBase.h: Remove code to support hand written
        code for XMLHttpRequest constructor lookup and shadowing.

        * bindings/js/JSWorkerContextCustom.cpp:
        (WebCore::JSWorkerContext::customGetOwnPropertySlot): Remove JSC prefixes.
        (WebCore::JSWorkerContext::xmlHttpRequest): Added. Custom implementation of
        cached constructor lookup.
        * workers/WorkerContext.idl: Make the XMLHttpRequestConstructor accessor not
        V8 specific.



git-svn-id: svn://svn.chromium.org/blink/trunk@42768 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 71dee2bd
2009-04-22 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
Autogenerate the XMLHttpRequest constructor getter/setter for the
WorkerContext and remove the now no longer needed JSWorkerContextBase.lut.h
file.
* DerivedSources.make: Remove JSWorkerContextBase.lut.h
* WebCore.xcodeproj/project.pbxproj: Ditto.
* bindings/js/JSWorkerContextBase.cpp:
* bindings/js/JSWorkerContextBase.h: Remove code to support hand written
code for XMLHttpRequest constructor lookup and shadowing.
* bindings/js/JSWorkerContextCustom.cpp:
(WebCore::JSWorkerContext::customGetOwnPropertySlot): Remove JSC prefixes.
(WebCore::JSWorkerContext::xmlHttpRequest): Added. Custom implementation of
cached constructor lookup.
* workers/WorkerContext.idl: Make the XMLHttpRequestConstructor accessor not
V8 specific.
2009-04-22 Darin Adler <darin@apple.com>
* page/Navigator.idl: Touch this file to fix build since Geolocation
......@@ -387,7 +387,6 @@ all : \
$(filter-out JSEventListener.h JSEventTarget.h JSRGBColor.h,$(DOM_CLASSES:%=JS%.h)) \
\
JSRGBColor.lut.h \
JSWorkerContextBase.lut.h \
\
JSJavaScriptCallFrame.h \
\
......
......@@ -4334,7 +4334,6 @@
E182568F0EF2B02D00933242 /* JSWorkerContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E182568D0EF2B02D00933242 /* JSWorkerContext.cpp */; };
E18256900EF2B02D00933242 /* JSWorkerContext.h in Headers */ = {isa = PBXBuildFile; fileRef = E182568E0EF2B02D00933242 /* JSWorkerContext.h */; };
E18258AC0EF3CD7000933242 /* JSWorkerContextCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18258AB0EF3CD7000933242 /* JSWorkerContextCustom.cpp */; };
E18259E70EF3E34B00933242 /* JSWorkerContextBase.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = E18259E60EF3E34B00933242 /* JSWorkerContextBase.lut.h */; };
E1A302BC0DE8370300C52F2C /* StringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A302BB0DE8370300C52F2C /* StringBuilder.h */; };
E1A302C10DE8376900C52F2C /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1A302C00DE8376900C52F2C /* StringBuilder.cpp */; };
E1A5F99B0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1A5F99A0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp */; };
......@@ -9146,7 +9145,6 @@
E182568D0EF2B02D00933242 /* JSWorkerContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerContext.cpp; sourceTree = "<group>"; };
E182568E0EF2B02D00933242 /* JSWorkerContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorkerContext.h; sourceTree = "<group>"; };
E18258AB0EF3CD7000933242 /* JSWorkerContextCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerContextCustom.cpp; sourceTree = "<group>"; };
E18259E60EF3E34B00933242 /* JSWorkerContextBase.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorkerContextBase.lut.h; sourceTree = "<group>"; };
E1A302BB0DE8370300C52F2C /* StringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringBuilder.h; sourceTree = "<group>"; };
E1A302C00DE8376900C52F2C /* StringBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringBuilder.cpp; sourceTree = "<group>"; };
E1A5F99A0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageChannelCustom.cpp; sourceTree = "<group>"; };
......@@ -13872,7 +13870,6 @@
E1CAA5C50E8BD23600A73ECA /* JSWorker.h */,
E182568D0EF2B02D00933242 /* JSWorkerContext.cpp */,
E182568E0EF2B02D00933242 /* JSWorkerContext.h */,
E18259E60EF3E34B00933242 /* JSWorkerContextBase.lut.h */,
E1C362EE0EAF2AA9007410BC /* JSWorkerLocation.cpp */,
E1C362ED0EAF2AA9007410BC /* JSWorkerLocation.h */,
E1271A570EEECDE400F61213 /* JSWorkerNavigator.cpp */,
......@@ -16086,7 +16083,6 @@
E1CA5CD30E8CDE8000E8EF90 /* JSWorkerConstructor.h in Headers */,
E18256900EF2B02D00933242 /* JSWorkerContext.h in Headers */,
E1C36D350EB0A094007410BC /* JSWorkerContextBase.h in Headers */,
E18259E70EF3E34B00933242 /* JSWorkerContextBase.lut.h in Headers */,
E1C362EF0EAF2AA9007410BC /* JSWorkerLocation.h in Headers */,
E1271A580EEECDE400F61213 /* JSWorkerNavigator.h in Headers */,
BC348BD40DB7F804004ABAB9 /* JSXMLHttpRequest.h in Headers */,
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
* Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2009 Google Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
......@@ -31,36 +31,16 @@
#include "JSWorkerContextBase.h"
#include "Event.h"
#include "JSDOMBinding.h"
#include "JSEventListener.h"
#include "JSMessageChannelConstructor.h"
#include "JSMessageEvent.h"
#include "JSMessagePort.h"
#include "JSWorkerLocation.h"
#include "JSWorkerNavigator.h"
#include "JSXMLHttpRequestConstructor.h"
#include "WorkerContext.h"
#include "WorkerLocation.h"
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);
const ClassInfo JSWorkerContextBase::s_info = { "WorkerContext", 0, 0, 0 };
JSWorkerContextBase::JSWorkerContextBase(PassRefPtr<JSC::Structure> structure, PassRefPtr<WorkerContext> impl)
: JSDOMGlobalObject(structure, new JSDOMGlobalObjectData, this)
, m_impl(impl)
......@@ -76,45 +56,6 @@ ScriptExecutionContext* JSWorkerContextBase::scriptExecutionContext() const
return m_impl.get();
}
static const HashTable* getJSWorkerContextBaseTable(ExecState* exec)
{
return getHashTableForGlobalData(exec->globalData(), &JSWorkerContextBaseTable);
}
const ClassInfo JSWorkerContextBase::s_info = { "WorkerContext", 0, 0, getJSWorkerContextBaseTable };
void JSWorkerContextBase::put(ExecState* exec, const Identifier& propertyName, JSValuePtr value, PutPropertySlot& slot)
{
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)
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
* Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -41,15 +41,12 @@ namespace WebCore {
JSWorkerContextBase(PassRefPtr<JSC::Structure>, PassRefPtr<WorkerContext>);
virtual ~JSWorkerContextBase();
virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValuePtr, JSC::PutPropertySlot&);
virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
static const JSC::ClassInfo s_info;
WorkerContext* impl() const { return m_impl.get(); }
virtual ScriptExecutionContext* scriptExecutionContext() const;
bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
private:
RefPtr<WorkerContext> m_impl;
};
......
......@@ -31,6 +31,7 @@
#include "JSDOMBinding.h"
#include "JSEventListener.h"
#include "JSXMLHttpRequestConstructor.h"
#include "ScheduledAction.h"
#include "WorkerContext.h"
#include <interpreter/Interpreter.h>
......@@ -39,7 +40,7 @@ using namespace JSC;
namespace WebCore {
bool JSWorkerContext::customGetOwnPropertySlot(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::PropertySlot& slot)
bool JSWorkerContext::customGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
// Look for overrides before looking at any of our own properties.
if (JSGlobalObject::getOwnPropertySlot(exec, propertyName, slot))
......@@ -74,6 +75,11 @@ void JSWorkerContext::setSelf(ExecState* exec, JSValuePtr value)
putDirect(Identifier(exec, "self"), value);
}
JSValuePtr JSWorkerContext::xmlHttpRequest(ExecState* exec) const
{
return getDOMConstructor<JSXMLHttpRequestConstructor>(exec, this);
}
JSValuePtr JSWorkerContext::importScripts(ExecState* exec, const ArgList& args)
{
if (!args.size())
......
......@@ -48,9 +48,7 @@ module threads {
attribute MessageEventConstructor MessageEvent;
attribute WorkerLocationConstructor WorkerLocation;
#if defined(V8_BINDING)
attribute XMLHttpRequestConstructor XMLHttpRequest;
#endif // V8_BINDING
attribute [JSCCustomGetter] XMLHttpRequestConstructor XMLHttpRequest;
// Timers
[Custom] long setTimeout(in TimeoutHandler handler, in long timeout);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment