Ignore:
Timestamp:
May 23, 2010, 7:15:02 PM (15 years ago)
Author:
[email protected]
Message:

Fix for https://bugs.webkit.org/show_bug.cgi?id=39575
Make JS DOMObject inherit from JSObjectWithGlobalObject instead of JSObject

Reviewed by Oliver Hunt.

JavaScriptCore:

Expose the global object stored in JSObjectWithGlobalObject.

(JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
(JSC::JSObjectWithGlobalObject::globalObject):

  • runtime/JSObjectWithGlobalObject.h:

WebCore:

  • Changes JSDOMWindowShell to inherit from JSObject instead of DOMObject since it doesn't ever go into any DOMObject tables. In a separate change, we may want to make this inherit from JSObjectWithGlobalObject since JSDOMWindowShell does store a global object pointer.
  • Change DOMObject to inherit from JSObjectWithGlobalObject instead of JSObject. In this change I am keeping around DOMObjectWithGlobalPointer, which now just uses the capabilities of JSObjectWithGlobalObject instead of implementing them itself. DOMObjectWithGlobalPointer will go away in a subsequent patch.
  • bindings/js/JSDOMBinding.h:

(WebCore::DOMObjectWithGlobalPointer::globalObject):
(WebCore::DOMObjectWithGlobalPointer::DOMObjectWithGlobalPointer):

  • bindings/js/JSDOMWindowShell.h:
  • bindings/js/JSDOMWrapper.h:

(WebCore::DOMObject::DOMObject):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp

    r59941 r60057  
    3434    : JSObject(structure)
    3535{
     36    COMPILE_ASSERT(AnonymousSlotCount == 1, AnonymousSlotCount_must_be_one);
    3637    ASSERT(!globalObject || globalObject->isGlobalObject());
    37     putAnonymousValue(0, globalObject);
     38    putAnonymousValue(GlobalObjectSlot, globalObject);
    3839}
    3940
     41JSGlobalObject* JSObjectWithGlobalObject::globalObject() const
     42{
     43    return asGlobalObject((getAnonymousValue(GlobalObjectSlot).asCell()));
    4044}
     45
     46} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.