Reviewed by Geoff.
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Dec 2007 08:41:14 +0000 (08:41 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Dec 2007 08:41:14 +0000 (08:41 +0000)
        Fix for <rdar://problem/5646478>
        REGRESSION: fast/events/event-view-toString fails on Leopard

        This fixes an issue where we were incorrectly setting the lastInPrototypeChain
        for the JSDOMWindow (the global object) before a call to setPrototype overwrote
        it. This fixes it by passing the prototype up the constructor chain so that it
        is set before any calls can be made.

        * bindings/js/kjs_window.cpp:
        (KJS::Window::Window):
        * bindings/js/kjs_window.h:
        * bindings/scripts/CodeGeneratorJS.pm:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28858 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/bindings/js/kjs_window.cpp
WebCore/bindings/js/kjs_window.h
WebCore/bindings/scripts/CodeGeneratorJS.pm

index ea874062708e577933fb834403cf3ee26bdaccfe..172cfdd1fabd0d81bce535afdbfa8cbfb641c9ab 100644 (file)
@@ -1,3 +1,20 @@
+2007-12-18  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Geoff.
+
+        Fix for <rdar://problem/5646478>
+        REGRESSION: fast/events/event-view-toString fails on Leopard
+
+        This fixes an issue where we were incorrectly setting the lastInPrototypeChain
+        for the JSDOMWindow (the global object) before a call to setPrototype overwrote
+        it. This fixes it by passing the prototype up the constructor chain so that it
+        is set before any calls can be made.
+
+        * bindings/js/kjs_window.cpp:
+        (KJS::Window::Window):
+        * bindings/js/kjs_window.h:
+        * bindings/scripts/CodeGeneratorJS.pm:
+
 2007-12-18  Beth Dakin  <bdakin@apple.com>
 
         Reviewed by Oliver.
index 79412433e8fe5b8ccc277042cacf4abf6e460ee0..800e3c7f55b335edf141fad963d46ef39ac2d9f6 100644 (file)
@@ -202,8 +202,9 @@ const ClassInfo Window::info = { "Window", 0, &WindowTable };
 @end
 */
 
-Window::Window(DOMWindow* window)
-    : m_impl(window)
+Window::Window(DOMWindow* window, JSValue* prototype)
+    : JSGlobalObject(prototype)
+    , m_impl(window)
     , d(new WindowPrivate)
 {
     // Window destruction is not thread-safe because of
index fc901e8fdd373fa225dae6c043ce632f1547b971..ece8425f43eaa79e71735f2c3f5674d124e3eda4 100644 (file)
@@ -51,7 +51,7 @@ namespace KJS {
     friend class WebCore::JSLocation;
     friend class WebCore::ScheduledAction;
   protected:
-    Window(WebCore::DOMWindow*);
+    Window(WebCore::DOMWindow*, JSValue* prototype);
 
   public:
     virtual ~Window();
index 0f62af79a21f8c44d09fa849aa9bfc0a20f9b40a..d9a449058c358a40f57646dd70111444e648a27e 100644 (file)
@@ -774,7 +774,7 @@ sub GenerateImplementation
     # Constructor
     if ($dataNode->extendedAttributes->{"DoNotCache"}) {
         push(@implContent, "${className}::$className($passType impl)\n");
-        push(@implContent, "    : $parentClassName(impl)\n");
+        push(@implContent, "    : $parentClassName(impl, ${className}Prototype::self())\n");
     } else {
         my $needsSVGContext = IsSVGTypeNeedingContextParameter($implClassName);
         if ($needsSVGContext) {
@@ -799,12 +799,14 @@ sub GenerateImplementation
         }
     }
 
-    if ($dataNode->extendedAttributes->{"DoNotCache"}) {
-        push(@implContent, "{\n    setPrototype(${className}Prototype::self());\n}\n\n");
-    } else {
-        push(@implContent, "{\n    setPrototype(${className}Prototype::self(exec));\n}\n\n");
+    push(@implContent, "{\n");
+
+    if (!$dataNode->extendedAttributes->{"DoNotCache"}) {
+        push(@implContent, "    setPrototype(${className}Prototype::self(exec));\n");
     }
 
+    push(@implContent, "}\n\n");
+
     # Destructor
     if (!$hasParent) {
         push(@implContent, "${className}::~$className()\n");