LayoutTests:
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Feb 2007 09:12:14 +0000 (09:12 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Feb 2007 09:12:14 +0000 (09:12 +0000)
        Regression not reviewed, based loosely on test case from Ian Eng.

        - test case for <rdar://problem/4988091> objects attached to Window not cleared (memory leak)

        * fast/dom/Window/resources/window-appendages-cleared-results.html: Added.
        * fast/dom/Window/window-appendages-cleared.html: Added.

WebCore:

        Reviewed by me, patch from Ian Eng (cleaned up by me some).

        - fixed <rdar://problem/4988091> objects attached to Window not cleared (memory leak)

        Test case: fast/dom/Window/window-appendages-cleared.html

        * bindings/js/kjs_window.cpp:
        (KJS::Window::clearHelperObjectProperties):
        (KJS::Window::clear):
        * bindings/js/kjs_window.h:

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

LayoutTests/ChangeLog
LayoutTests/fast/dom/Window/resources/window-appendages-cleared-results.html [new file with mode: 0644]
LayoutTests/fast/dom/Window/window-appendages-cleared.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/bindings/js/kjs_window.cpp
WebCore/bindings/js/kjs_window.h

index ffe5a3e1a373f9e48c583ce3f396143658f52a16..e6ce0db94b2ee3133dfac9e1cab8492e40209ec3 100644 (file)
@@ -1,3 +1,12 @@
+2007-02-10  Maciej Stachowiak  <mjs@apple.com>
+
+        Regression not reviewed, based loosely on test case from Ian Eng.
+
+        - test case for <rdar://problem/4988091> objects attached to Window not cleared (memory leak)
+        
+        * fast/dom/Window/resources/window-appendages-cleared-results.html: Added.
+        * fast/dom/Window/window-appendages-cleared.html: Added.
+
 2007-02-09  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by darin
diff --git a/LayoutTests/fast/dom/Window/resources/window-appendages-cleared-results.html b/LayoutTests/fast/dom/Window/resources/window-appendages-cleared-results.html
new file mode 100644 (file)
index 0000000..de276cc
--- /dev/null
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../js/resources/js-test-style.css">
+<script src="../../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+for (var prop in window.history) {
+    shouldBeFalse('history.' + prop + ' == "LEFTOVER"', "false");
+}
+
+for (var prop in screen) {
+    shouldBeFalse('screen.' + prop + ' == "LEFTOVER"', "false");
+}
+
+for (var prop in frames) {
+    shouldBeFalse('frames.' + prop + ' == "LEFTOVER"', "false");
+}
+
+for (var prop in location) {
+    shouldBeFalse('location.' + prop + ' == "LEFTOVER"', "false");
+}
+
+for (var prop in locationbar) {
+    shouldBeFalse('locationbar.' + prop + ' == "LEFTOVER"', "false");
+}
+
+for (var prop in menubar) {
+    shouldBeFalse('menubar.' + prop + ' == "LEFTOVER"', "false");
+}
+
+for (var prop in personalbar) {
+    shouldBeFalse('personalbar.' + prop + ' == "LEFTOVER"', "false");
+}
+
+for (var prop in scrollbars) {
+    shouldBeFalse('scrollbars.' + prop + ' == "LEFTOVER"', "false");
+}
+
+for (var prop in statusbar) {
+    shouldBeFalse('statusbar.' + prop + ' == "LEFTOVER"', "false");
+}
+
+for (var prop in toolbar) {
+    shouldBeFalse('toolbar.' + prop + ' == "LEFTOVER"', "false");
+}
+
+shouldBeUndefined('window.event');
+
+var successfullyParsed = true;
+</script>
+<script src="../../../js/resources/js-test-post.js"></script>
+</body>
+</html>
+
+
diff --git a/LayoutTests/fast/dom/Window/window-appendages-cleared.html b/LayoutTests/fast/dom/Window/window-appendages-cleared.html
new file mode 100644 (file)
index 0000000..b945c1a
--- /dev/null
@@ -0,0 +1,46 @@
+<html>
+<body onload="test()">
+<script type="text/javascript">
+function test()
+{
+history.go = "LEFTOVER";
+history.length = "LEFTOVER";
+history.back = "LEFTOVER";
+history.forward = "LEFTOVER";
+history.randomProperty = "LEFTOVER";
+
+frames.location = "LEFTOVER";
+frames.length = "LEFTOVER";
+frames.randomProperty = "LEFTOVER";
+location.assign = "LEFTOVER";
+location.reload = "LEFTOVER";
+location.toString = "LEFTOVER";
+location.replace = "LEFTOVER";
+location.host = "LEFTOVER";
+location.pathname = "LEFTOVER";
+location.port = "LEFTOVER";
+location.href = "LEFTOVER";
+location.search = "LEFTOVER";
+location.hash = "LEFTOVER";
+location.hostname = "LEFTOVER";
+location.protocol = "LEFTOVER";
+location.randomProperty = "LEFTOVER";
+locationbar.visible = "LEFTOVER";
+locationbar.randomProperty = "LEFTOVER";
+menubar.visible = "LEFTOVER";
+menubar.randomProperty = "LEFTOVER";
+personalbar.visible = "LEFTOVER";
+personalbar.randomProperty = "LEFTOVER";
+scrollbars.visible = "LEFTOVER";
+scrollbars.randomProperty = "LEFTOVER";
+statusbar.visible = "LEFTOVER";
+statusbar.randomProperty = "LEFTOVER";
+toolbar.visible = "LEFTOVER";
+toolbar.randomProperty = "LEFTOVER";
+event.randomProperty = "LEFTOVER";
+
+location = 'resources/window-appendages-cleared-results.html';
+}
+</script>
+</body>
+</html>
index 85311021b7e3c7810f5aa9d06a29f5d90b31bf8f..5e96fb9f9be3e1ae6c19bc14ec64170934bd47c4 100644 (file)
@@ -1,3 +1,16 @@
+2007-02-10  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by me, patch from Ian Eng (cleaned up by me some).
+
+        - fixed <rdar://problem/4988091> objects attached to Window not cleared (memory leak)
+        
+        Test case: fast/dom/Window/window-appendages-cleared.html
+
+        * bindings/js/kjs_window.cpp:
+        (KJS::Window::clearHelperObjectProperties):
+        (KJS::Window::clear):
+        * bindings/js/kjs_window.h:
+
 2007-02-09  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Tim Hatcher
index 467134e789e1736b902521d676fb483909841b96..0e66a13c6949f2f4288400fa45dc786a0f8ce3c1 100644 (file)
@@ -1341,6 +1341,22 @@ JSUnprotectedEventListener *Window::getJSUnprotectedEventListener(JSValue *val,
   return new JSUnprotectedEventListener(object, this, html);
 }
 
+void Window::clearHelperObjectProperties()
+{
+  screen = 0;
+  history = 0;
+  frames = 0;
+  loc = 0;
+  m_selection = 0;
+  m_locationbar = 0;
+  m_menubar = 0;
+  m_personalbar = 0;
+  m_scrollbars = 0;
+  m_statusbar = 0;
+  m_toolbar = 0;
+  m_evt = 0;
+}
+
 void Window::clear()
 {
   JSLock lock;
@@ -1350,6 +1366,7 @@ void Window::clear()
 
   clearAllTimeouts();
   clearProperties();
+  clearHelperObjectProperties();
   setPrototype(JSDOMWindowPrototype::self()); // clear the prototype
 
   // Now recreate a working global object for the next URL that will use us; but only if we haven't been
index 2f747ed3aa95941b7b9f182d89e11f57da028399..ec588148b642319f2fe91ccb6c85103de7be4442 100644 (file)
@@ -182,6 +182,7 @@ namespace KJS {
 
     void updateLayout() const;
 
+    void clearHelperObjectProperties();
     void clearAllTimeouts();
     int installTimeout(ScheduledAction*, int interval, bool singleShot);