Diff
Modified: trunk/Source/_javascript_Core/CMakeLists.txt (98908 => 98909)
--- trunk/Source/_javascript_Core/CMakeLists.txt 2011-10-31 23:40:41 UTC (rev 98908)
+++ trunk/Source/_javascript_Core/CMakeLists.txt 2011-10-31 23:43:58 UTC (rev 98909)
@@ -127,6 +127,7 @@
runtime/JSGlobalData.cpp
runtime/JSGlobalObject.cpp
runtime/JSGlobalObjectFunctions.cpp
+ runtime/JSGlobalThis.cpp
runtime/JSLock.cpp
runtime/JSNotAnObject.cpp
runtime/JSObject.cpp
Modified: trunk/Source/_javascript_Core/ChangeLog (98908 => 98909)
--- trunk/Source/_javascript_Core/ChangeLog 2011-10-31 23:40:41 UTC (rev 98908)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-10-31 23:43:58 UTC (rev 98909)
@@ -1,3 +1,39 @@
+2011-10-31 Sam Weinig <s...@webkit.org>
+
+ Remove need for virtual JSObject::unwrappedObject
+ https://bugs.webkit.org/show_bug.cgi?id=71034
+
+ Reviewed by Geoffrey Garen.
+
+ * _javascript_Core.exp:
+ Update exports.
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * _javascript_Core.exp:
+ * _javascript_Core.gypi:
+ * _javascript_Core.pro:
+ * _javascript_Core.vcproj/_javascript_Core/_javascript_Core.vcproj:
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ Add JSGlobalThis.cpp.
+
+ * runtime/JSGlobalThis.cpp: Added.
+ (JSC::JSGlobalThis::visitChildren):
+ (JSC::JSGlobalThis::unwrappedObject):
+ * runtime/JSGlobalThis.h:
+ (JSC::JSGlobalThis::createStructure):
+ Move underlying object from JSDOMWindowShell down to JSGlobalThis
+ and corresponding visitChildren method.
+
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::unwrappedObject):
+ Change unwrappedObject from virtual, to just needing an if check.
+
+ * runtime/JSObject.h:
+ (JSC::JSObject::isGlobalThis):
+ * runtime/JSType.h:
+ Add isGlobalThis predicate and type.
+
2011-10-31 Xianzhu Wang <wangxian...@chromium.org>
WTF::StringImpl::create(const char*, unsigned) calls itself
Modified: trunk/Source/_javascript_Core/GNUmakefile.list.am (98908 => 98909)
--- trunk/Source/_javascript_Core/GNUmakefile.list.am 2011-10-31 23:40:41 UTC (rev 98908)
+++ trunk/Source/_javascript_Core/GNUmakefile.list.am 2011-10-31 23:43:58 UTC (rev 98909)
@@ -371,6 +371,7 @@
Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp \
Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h \
Source/_javascript_Core/runtime/JSGlobalObject.h \
+ Source/_javascript_Core/runtime/JSGlobalThis.cpp \
Source/_javascript_Core/runtime/JSGlobalThis.h \
Source/_javascript_Core/runtime/JSLock.cpp \
Source/_javascript_Core/runtime/JSLock.h \
Modified: trunk/Source/_javascript_Core/_javascript_Core.exp (98908 => 98909)
--- trunk/Source/_javascript_Core/_javascript_Core.exp 2011-10-31 23:40:41 UTC (rev 98908)
+++ trunk/Source/_javascript_Core/_javascript_Core.exp 2011-10-31 23:43:58 UTC (rev 98909)
@@ -144,6 +144,8 @@
__ZN3JSC12JSGlobalData23releaseExecutableMemoryEv
__ZN3JSC12JSGlobalData6createENS_15ThreadStackTypeENS_8HeapSizeE
__ZN3JSC12JSGlobalDataD1Ev
+__ZN3JSC12JSGlobalThis13visitChildrenEPNS_6JSCellERNS_11SlotVisitorE
+__ZN3JSC12JSGlobalThis6s_infoE
__ZN3JSC12RegExpObject14finishCreationEPNS_14JSGlobalObjectE
__ZN3JSC12RegExpObject6s_infoE
__ZN3JSC12RegExpObjectC1EPNS_14JSGlobalObjectEPNS_9StructureEPNS_6RegExpE
@@ -308,7 +310,6 @@
__ZN3JSC8JSObject12toThisObjectEPNS_6JSCellEPNS_9ExecStateE
__ZN3JSC8JSObject13visitChildrenEPNS_6JSCellERNS_11SlotVisitorE
__ZN3JSC8JSObject14deletePropertyEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierE
-__ZN3JSC8JSObject15unwrappedObjectEv
__ZN3JSC8JSObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
__ZN3JSC8JSObject17defineOwnPropertyEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorEb
__ZN3JSC8JSObject17preventExtensionsERNS_12JSGlobalDataE
Modified: trunk/Source/_javascript_Core/_javascript_Core.gypi (98908 => 98909)
--- trunk/Source/_javascript_Core/_javascript_Core.gypi 2011-10-31 23:40:41 UTC (rev 98908)
+++ trunk/Source/_javascript_Core/_javascript_Core.gypi 2011-10-31 23:43:58 UTC (rev 98909)
@@ -87,6 +87,7 @@
'runtime/JSBoundFunction.h',
'runtime/JSGlobalData.h',
'runtime/JSGlobalObject.h',
+ 'runtime/JSGlobalThis.h',
'runtime/JSLock.h',
'runtime/JSObject.h',
'runtime/JSString.h',
@@ -482,6 +483,7 @@
'runtime/JSGlobalObject.cpp',
'runtime/JSGlobalObjectFunctions.cpp',
'runtime/JSGlobalObjectFunctions.h',
+ 'runtime/JSGlobalThis.cpp',
'runtime/JSLock.cpp',
'runtime/JSNotAnObject.cpp',
'runtime/JSNotAnObject.h',
Modified: trunk/Source/_javascript_Core/_javascript_Core.pro (98908 => 98909)
--- trunk/Source/_javascript_Core/_javascript_Core.pro 2011-10-31 23:40:41 UTC (rev 98908)
+++ trunk/Source/_javascript_Core/_javascript_Core.pro 2011-10-31 23:43:58 UTC (rev 98909)
@@ -158,6 +158,7 @@
runtime/JSGlobalData.cpp \
runtime/JSGlobalObject.cpp \
runtime/JSGlobalObjectFunctions.cpp \
+ runtime/JSGlobalThis.cpp \
runtime/JSLock.cpp \
runtime/JSNotAnObject.cpp \
runtime/JSObject.cpp \
Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def (98908 => 98909)
--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def 2011-10-31 23:40:41 UTC (rev 98908)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def 2011-10-31 23:43:58 UTC (rev 98909)
@@ -353,10 +353,10 @@
?unlock@Mutex@WTF@@QAEXXZ
?unlockAtomicallyInitializedStaticMutex@WTF@@YAXXZ
?unprotect@Heap@JSC@@QAE_NVJSValue@2@@Z
- ?unwrappedObject@JSObject@JSC@@UAEPAV12@XZ
?utf8@UString@JSC@@QBE?AVCString@WTF@@_N@Z
?validate@MarkStack@JSC@@KAXPAVJSCell@2@@Z
?visitChildren@JSGlobalObject@JSC@@SAXPAVJSCell@2@AAVSlotVisitor@2@@Z
+ ?visitChildren@JSGlobalThis@JSC@@KAXPAVJSCell@2@AAVSlotVisitor@2@@Z
?visitChildren@JSObject@JSC@@SAXPAVJSCell@2@AAVSlotVisitor@2@@Z
?vtableAnchor@InternalFunction@JSC@@EAEXXZ
?wait@ThreadCondition@WTF@@QAEXAAVMutex@2@@Z
Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.vcproj (98908 => 98909)
--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.vcproj 2011-10-31 23:40:41 UTC (rev 98908)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.vcproj 2011-10-31 23:43:58 UTC (rev 98909)
@@ -838,6 +838,14 @@
>
</File>
<File
+ RelativePath="..\..\runtime\JSGlobalThis.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSGlobalThis.h"
+ >
+ </File>
+ <File
RelativePath="..\..\runtime\JSLock.cpp"
>
</File>
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (98908 => 98909)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2011-10-31 23:40:41 UTC (rev 98908)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2011-10-31 23:43:58 UTC (rev 98909)
@@ -612,6 +612,7 @@
BC3046070E1F497F003232CF /* Error.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3046060E1F497F003232CF /* Error.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC3135640F302FA3003DFD3A /* DebuggerActivation.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3135620F302FA3003DFD3A /* DebuggerActivation.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC3135650F302FA3003DFD3A /* DebuggerActivation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC3135630F302FA3003DFD3A /* DebuggerActivation.cpp */; };
+ BC3C4CA01458F5450025FB62 /* JSGlobalThis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC3C4C9F1458F5450025FB62 /* JSGlobalThis.cpp */; };
BC5F7BBE11823B590052C02C /* Atomics.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5F7BBB11823B590052C02C /* Atomics.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC5F7BBF11823B590052C02C /* ThreadingPrimitives.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5F7BBC11823B590052C02C /* ThreadingPrimitives.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC5F7BC011823B590052C02C /* ThreadSafeRefCounted.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5F7BBD11823B590052C02C /* ThreadSafeRefCounted.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1337,6 +1338,7 @@
BC3135630F302FA3003DFD3A /* DebuggerActivation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DebuggerActivation.cpp; sourceTree = "<group>"; };
BC337BDE0E1AF0B80076918A /* GetterSetter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetterSetter.h; sourceTree = "<group>"; };
BC337BEA0E1B00CB0076918A /* Error.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Error.cpp; sourceTree = "<group>"; };
+ BC3C4C9F1458F5450025FB62 /* JSGlobalThis.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalThis.cpp; sourceTree = "<group>"; };
BC5F7BBB11823B590052C02C /* Atomics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Atomics.h; sourceTree = "<group>"; };
BC5F7BBC11823B590052C02C /* ThreadingPrimitives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadingPrimitives.h; sourceTree = "<group>"; };
BC5F7BBD11823B590052C02C /* ThreadSafeRefCounted.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadSafeRefCounted.h; sourceTree = "<group>"; };
@@ -2126,6 +2128,7 @@
BC756FC60E2031B200DE7D12 /* JSGlobalObjectFunctions.cpp */,
BC756FC70E2031B200DE7D12 /* JSGlobalObjectFunctions.h */,
8604F503143CE1C100B295F5 /* JSGlobalThis.h */,
+ BC3C4C9F1458F5450025FB62 /* JSGlobalThis.cpp */,
65EA4C99092AF9E20093D800 /* JSLock.cpp */,
65EA4C9A092AF9E20093D800 /* JSLock.h */,
A72700780DAC605600E548D7 /* JSNotAnObject.cpp */,
@@ -3412,6 +3415,7 @@
86880F4D14353B2100B08D42 /* DFGSpeculativeJIT64.cpp in Sources */,
0FE228EE1436AB2C00196C48 /* Heuristics.cpp in Sources */,
0F620179143FCD480068B77C /* DFGAbstractState.cpp in Sources */,
+ BC3C4CA01458F5450025FB62 /* JSGlobalThis.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Added: trunk/Source/_javascript_Core/runtime/JSGlobalThis.cpp (0 => 98909)
--- trunk/Source/_javascript_Core/runtime/JSGlobalThis.cpp (rev 0)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalThis.cpp 2011-10-31 23:43:58 UTC (rev 98909)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSGlobalThis.h"
+
+#include "JSGlobalObject.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(JSGlobalThis);
+
+const ClassInfo JSGlobalThis::s_info = { "JSGlobalThis", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSGlobalThis) };
+
+void JSGlobalThis::visitChildren(JSCell* cell, SlotVisitor& visitor)
+{
+ JSGlobalThis* thisObject = static_cast<JSGlobalThis*>(cell);
+ ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
+
+ COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
+ ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
+
+ Base::visitChildren(thisObject, visitor);
+ if (thisObject->m_unwrappedObject)
+ visitor.append(&thisObject->m_unwrappedObject);
+}
+
+JSGlobalObject* JSGlobalThis::unwrappedObject()
+{
+ return m_unwrappedObject.get();
+}
+
+} // namespace JSC
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalThis.h (98908 => 98909)
--- trunk/Source/_javascript_Core/runtime/JSGlobalThis.h 2011-10-31 23:40:41 UTC (rev 98908)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalThis.h 2011-10-31 23:43:58 UTC (rev 98909)
@@ -41,6 +41,15 @@
return globalThis;
}
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, 0, prototype, TypeInfo(GlobalThisType, StructureFlags), &s_info);
+ }
+
+ static JS_EXPORTDATA const JSC::ClassInfo s_info;
+
+ JSGlobalObject* unwrappedObject();
+
protected:
JSGlobalThis(JSGlobalData& globalData, Structure* structure)
: JSNonFinalObject(globalData, structure)
@@ -51,8 +60,14 @@
{
Base::finishCreation(globalData);
}
+
+ static const unsigned StructureFlags = OverridesVisitChildren | Base::StructureFlags;
+
+ static void visitChildren(JSCell*, SlotVisitor&);
+
+ WriteBarrier<JSGlobalObject> m_unwrappedObject;
};
-}
+} // namespace JSC
-#endif
+#endif // JSGlobalThis_h
Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (98908 => 98909)
--- trunk/Source/_javascript_Core/runtime/JSObject.cpp 2011-10-31 23:40:41 UTC (rev 98908)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp 2011-10-31 23:43:58 UTC (rev 98909)
@@ -29,13 +29,14 @@
#include "GetterSetter.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
+#include "JSGlobalThis.h"
+#include "Lookup.h"
#include "NativeErrorConstructor.h"
+#include "Nodes.h"
#include "ObjectPrototype.h"
+#include "Operations.h"
#include "PropertyDescriptor.h"
#include "PropertyNameArray.h"
-#include "Lookup.h"
-#include "Nodes.h"
-#include "Operations.h"
#include <math.h>
#include <wtf/Assertions.h>
@@ -564,6 +565,8 @@
JSObject* JSObject::unwrappedObject()
{
+ if (isGlobalThis())
+ return static_cast<JSGlobalThis*>(this)->unwrappedObject();
return this;
}
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (98908 => 98909)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2011-10-31 23:40:41 UTC (rev 98908)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2011-10-31 23:43:58 UTC (rev 98909)
@@ -136,7 +136,7 @@
UString toString(ExecState*) const;
static JSObject* toThisObject(JSCell*, ExecState*);
- virtual JSObject* unwrappedObject();
+ JSObject* unwrappedObject();
bool getPropertySpecificValue(ExecState* exec, const Identifier& propertyName, JSCell*& specificFunction) const;
@@ -195,6 +195,7 @@
bool isVariableObject() const;
bool isActivationObject() const;
bool isErrorInstance() const;
+ bool isGlobalThis() const;
void seal(JSGlobalData&);
void freeze(JSGlobalData&);
@@ -424,6 +425,11 @@
return structure()->typeInfo().type() == ErrorInstanceType;
}
+inline bool JSObject::isGlobalThis() const
+{
+ return structure()->typeInfo().type() == GlobalThisType;
+}
+
inline JSObject* constructEmptyObject(ExecState* exec, Structure* structure)
{
return JSFinalObject::create(exec, structure);
Modified: trunk/Source/_javascript_Core/runtime/JSType.h (98908 => 98909)
--- trunk/Source/_javascript_Core/runtime/JSType.h 2011-10-31 23:40:41 UTC (rev 98908)
+++ trunk/Source/_javascript_Core/runtime/JSType.h 2011-10-31 23:43:58 UTC (rev 98909)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -43,11 +43,12 @@
JSFunctionType = 12,
NumberObjectType = 13,
ErrorInstanceType = 14,
+ GlobalThisType = 15,
// VariableObjectType must be less than all of the types of its subclasses and only its subclasses.
- VariableObjectType = 15,
- GlobalObjectType = 16,
- ActivationObjectType = 17,
+ VariableObjectType = 16,
+ GlobalObjectType = 17,
+ ActivationObjectType = 18,
};
} // namespace JSC
Modified: trunk/Source/WebCore/ChangeLog (98908 => 98909)
--- trunk/Source/WebCore/ChangeLog 2011-10-31 23:40:41 UTC (rev 98908)
+++ trunk/Source/WebCore/ChangeLog 2011-10-31 23:43:58 UTC (rev 98909)
@@ -1,3 +1,35 @@
+2011-10-31 Sam Weinig <s...@webkit.org>
+
+ Remove need for virtual JSObject::unwrappedObject
+ https://bugs.webkit.org/show_bug.cgi?id=71034
+
+ Reviewed by Geoffrey Garen.
+
+ Move the member containing the global object from the JSDOMWindowShell
+ down to the JSGlobalThis class, and update JSDOMWindowShell to go through
+ an inline helper (which just casts) to get the window.
+
+ * bindings/js/JSDOMWindowShell.cpp:
+ (WebCore::JSDOMWindowShell::setWindow):
+ (WebCore::JSDOMWindowShell::className):
+ (WebCore::JSDOMWindowShell::getOwnPropertySlot):
+ (WebCore::JSDOMWindowShell::getOwnPropertyDescriptor):
+ (WebCore::JSDOMWindowShell::put):
+ (WebCore::JSDOMWindowShell::putWithAttributes):
+ (WebCore::JSDOMWindowShell::defineOwnProperty):
+ (WebCore::JSDOMWindowShell::deleteProperty):
+ (WebCore::JSDOMWindowShell::getPropertyNames):
+ (WebCore::JSDOMWindowShell::getOwnPropertyNames):
+ (WebCore::JSDOMWindowShell::defineGetter):
+ (WebCore::JSDOMWindowShell::defineSetter):
+ (WebCore::JSDOMWindowShell::lookupGetter):
+ (WebCore::JSDOMWindowShell::lookupSetter):
+ (WebCore::JSDOMWindowShell::impl):
+ * bindings/js/JSDOMWindowShell.h:
+ (WebCore::JSDOMWindowShell::window):
+ (WebCore::JSDOMWindowShell::setWindow):
+ (WebCore::JSDOMWindowShell::createStructure):
+
2011-10-29 Ryosuke Niwa <rn...@webkit.org>
WebKit nests pre on copy and paste when the pre is the root editable element
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp (98908 => 98909)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp 2011-10-31 23:40:41 UTC (rev 98908)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp 2011-10-31 23:43:58 UTC (rev 98909)
@@ -65,7 +65,7 @@
{
// Replacing JSDOMWindow via telling JSDOMWindowShell to use the same DOMWindow it already uses makes no sense,
// so we'd better never try to.
- ASSERT(!m_window || domWindow.get() != m_window->impl());
+ ASSERT(!window() || domWindow.get() != window()->impl());
// Explicitly protect the global object's prototype so it isn't collected
// when we allocate the global object. (Once the global object is fully
// constructed, it can mark its own prototype.)
@@ -84,90 +84,75 @@
// JSObject methods
// ----
-void JSDOMWindowShell::visitChildren(JSCell* cell, SlotVisitor& visitor)
-{
- JSDOMWindowShell* thisObject = static_cast<JSDOMWindowShell*>(cell);
- ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
- COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
- ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
- Base::visitChildren(thisObject, visitor);
- if (thisObject->m_window)
- visitor.append(&thisObject->m_window);
-}
-
UString JSDOMWindowShell::className() const
{
- return m_window->className();
+ return window()->className();
}
bool JSDOMWindowShell::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
JSDOMWindowShell* thisObject = static_cast<JSDOMWindowShell*>(cell);
- return thisObject->m_window->methodTable()->getOwnPropertySlot(thisObject->m_window.get(), exec, propertyName, slot);
+ return thisObject->window()->methodTable()->getOwnPropertySlot(thisObject->window(), exec, propertyName, slot);
}
bool JSDOMWindowShell::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
- return m_window->getOwnPropertyDescriptor(exec, propertyName, descriptor);
+ return window()->getOwnPropertyDescriptor(exec, propertyName, descriptor);
}
void JSDOMWindowShell::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
{
JSDOMWindowShell* thisObject = static_cast<JSDOMWindowShell*>(cell);
- thisObject->m_window->methodTable()->put(thisObject->m_window.get(), exec, propertyName, value, slot);
+ thisObject->window()->methodTable()->put(thisObject->window(), exec, propertyName, value, slot);
}
void JSDOMWindowShell::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes)
{
- m_window->putWithAttributes(exec, propertyName, value, attributes);
+ window()->putWithAttributes(exec, propertyName, value, attributes);
}
bool JSDOMWindowShell::defineOwnProperty(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::PropertyDescriptor& descriptor, bool shouldThrow)
{
- return m_window->defineOwnProperty(exec, propertyName, descriptor, shouldThrow);
+ return window()->defineOwnProperty(exec, propertyName, descriptor, shouldThrow);
}
bool JSDOMWindowShell::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName)
{
JSDOMWindowShell* thisObject = static_cast<JSDOMWindowShell*>(cell);
- return thisObject->m_window->methodTable()->deleteProperty(thisObject->m_window.get(), exec, propertyName);
+ return thisObject->window()->methodTable()->deleteProperty(thisObject->window(), exec, propertyName);
}
void JSDOMWindowShell::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
- m_window->getPropertyNames(exec, propertyNames, mode);
+ window()->getPropertyNames(exec, propertyNames, mode);
}
void JSDOMWindowShell::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
- m_window->getOwnPropertyNames(exec, propertyNames, mode);
+ window()->getOwnPropertyNames(exec, propertyNames, mode);
}
void JSDOMWindowShell::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
{
JSDOMWindowShell* thisObject = static_cast<JSDOMWindowShell*>(object);
- thisObject->m_window->methodTable()->defineGetter(thisObject->m_window.get(), exec, propertyName, getterFunction, attributes);
+ thisObject->window()->methodTable()->defineGetter(thisObject->window(), exec, propertyName, getterFunction, attributes);
}
void JSDOMWindowShell::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes)
{
- m_window->defineSetter(exec, propertyName, setterFunction, attributes);
+ window()->defineSetter(exec, propertyName, setterFunction, attributes);
}
JSValue JSDOMWindowShell::lookupGetter(ExecState* exec, const Identifier& propertyName)
{
- return m_window->lookupGetter(exec, propertyName);
+ return window()->lookupGetter(exec, propertyName);
}
JSValue JSDOMWindowShell::lookupSetter(ExecState* exec, const Identifier& propertyName)
{
- return m_window->lookupSetter(exec, propertyName);
+ return window()->lookupSetter(exec, propertyName);
}
-JSObject* JSDOMWindowShell::unwrappedObject()
-{
- return m_window.get();
-}
// ----
// JSDOMWindow methods
@@ -175,7 +160,7 @@
DOMWindow* JSDOMWindowShell::impl() const
{
- return m_window->impl();
+ return window()->impl();
}
void* JSDOMWindowShell::operator new(size_t size)
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h (98908 => 98909)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h 2011-10-31 23:40:41 UTC (rev 98908)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h 2011-10-31 23:43:58 UTC (rev 98909)
@@ -43,11 +43,11 @@
JSDOMWindowShell(PassRefPtr<DOMWindow>, JSC::Structure*, DOMWrapperWorld*);
virtual ~JSDOMWindowShell();
- JSDOMWindow* window() const { return m_window.get(); }
+ JSDOMWindow* window() const { return static_cast<JSDOMWindow*>(m_unwrappedObject.get()); }
void setWindow(JSC::JSGlobalData& globalData, JSDOMWindow* window)
{
ASSERT_ARG(window, window);
- m_window.set(globalData, this, window);
+ m_unwrappedObject.set(globalData, this, window);
setPrototype(globalData, window->prototype());
}
void setWindow(PassRefPtr<DOMWindow>);
@@ -65,7 +65,7 @@
static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
{
- return JSC::Structure::create(globalData, 0, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info);
+ return JSC::Structure::create(globalData, 0, prototype, JSC::TypeInfo(JSC::GlobalThisType, StructureFlags), &s_info);
}
DOMWrapperWorld* world() { return m_world.get(); }
@@ -76,9 +76,8 @@
private:
void* operator new(size_t);
- static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::OverridesVisitChildren | JSC::OverridesGetPropertyNames | Base::StructureFlags;
+ static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
- static void visitChildren(JSC::JSCell*, JSC::SlotVisitor&);
virtual JSC::UString className() const;
static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);
@@ -92,9 +91,7 @@
virtual bool defineOwnProperty(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&, bool shouldThrow);
virtual JSC::JSValue lookupGetter(JSC::ExecState*, const JSC::Identifier& propertyName);
virtual JSC::JSValue lookupSetter(JSC::ExecState*, const JSC::Identifier& propertyName);
- virtual JSC::JSObject* unwrappedObject();
- JSC::WriteBarrier<JSDOMWindow> m_window;
RefPtr<DOMWrapperWorld> m_world;
};