Title: [243661] trunk
Revision
243661
Author
cdu...@apple.com
Date
2019-03-29 13:46:57 -0700 (Fri, 29 Mar 2019)

Log Message

Set window.closed immediately when close() is invoked
https://bugs.webkit.org/show_bug.cgi?id=195409

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline WPT tests now that more checks are passing.

* web-platform-tests/html/browsers/the-window-object/close-method.window-expected.txt:
* web-platform-tests/html/browsers/the-window-object/closed-attribute.window-expected.txt:

Source/WebCore:

Window.closed should return true if it is closing:
- https://html.spec.whatwg.org/#dom-window-closed

Window.close() sets the 'is closing' flag to true synchronously, as per:
- https://html.spec.whatwg.org/#dom-window-close (step 3.1)

No new tests, rebaselined existing tests.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::closed const):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (243660 => 243661)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-03-29 20:26:49 UTC (rev 243660)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-03-29 20:46:57 UTC (rev 243661)
@@ -1,5 +1,17 @@
 2019-03-29  Chris Dumez  <cdu...@apple.com>
 
+        Set window.closed immediately when close() is invoked
+        https://bugs.webkit.org/show_bug.cgi?id=195409
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline WPT tests now that more checks are passing.
+
+        * web-platform-tests/html/browsers/the-window-object/close-method.window-expected.txt:
+        * web-platform-tests/html/browsers/the-window-object/closed-attribute.window-expected.txt:
+
+2019-03-29  Chris Dumez  <cdu...@apple.com>
+
         Unreviewed, rebaseline WPT test after r243638.
 
         * web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/navigated-named-objects.window-expected.txt:

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/close-method.window-expected.txt (243660 => 243661)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/close-method.window-expected.txt	2019-03-29 20:26:49 UTC (rev 243660)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/close-method.window-expected.txt	2019-03-29 20:46:57 UTC (rev 243661)
@@ -1,4 +1,4 @@
 
-FAIL window.close() queues a task to discard, but window.closed knows immediately assert_equals: expected true but got false
-FAIL window.close() affects name targeting immediately assert_equals: expected true but got false
+PASS window.close() queues a task to discard, but window.closed knows immediately 
+PASS window.close() affects name targeting immediately 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/closed-attribute.window-expected.txt (243660 => 243661)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/closed-attribute.window-expected.txt	2019-03-29 20:26:49 UTC (rev 243660)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/closed-attribute.window-expected.txt	2019-03-29 20:46:57 UTC (rev 243661)
@@ -2,7 +2,7 @@
 Harness Error (TIMEOUT), message = null
 
 PASS closed and same-origin nested browsing context 
-FAIL closed/close() and same-origin auxiliary browsing context assert_equals: expected true but got false
+PASS closed/close() and same-origin auxiliary browsing context 
 TIMEOUT closed and cross-origin nested browsing context Test timed out
 TIMEOUT closed/close() and cross-origin auxiliary browsing context Test timed out
 TIMEOUT closed and cross-site nested browsing context Test timed out

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/self-et-al.window-expected.txt (243660 => 243661)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/self-et-al.window-expected.txt	2019-03-29 20:26:49 UTC (rev 243660)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/self-et-al.window-expected.txt	2019-03-29 20:46:57 UTC (rev 243661)
@@ -1,10 +1,10 @@
 
 FAIL iframeWindow.frames before and after removal assert_equals: frames got cleared after browsing context removal expected object "[object Window]" but got null
-FAIL popupWindow.frames before, after closing, and after discarding assert_true: expected true got false
+FAIL popupWindow.frames before, after closing, and after discarding assert_equals: frames got cleared after browsing context removal expected object "[object Window]" but got null
 PASS iframeWindow.globalThis before and after removal 
-FAIL popupWindow.globalThis before, after closing, and after discarding assert_true: expected true got false
+PASS popupWindow.globalThis before, after closing, and after discarding 
 FAIL iframeWindow.self before and after removal assert_equals: self got cleared after browsing context removal expected object "[object Window]" but got null
-FAIL popupWindow.self before, after closing, and after discarding assert_true: expected true got false
+FAIL popupWindow.self before, after closing, and after discarding assert_equals: self got cleared after browsing context removal expected object "[object Window]" but got null
 FAIL iframeWindow.window before and after removal assert_equals: window got cleared after browsing context removal expected object "[object Window]" but got null
-FAIL popupWindow.window before, after closing, and after discarding assert_true: expected true got false
+FAIL popupWindow.window before, after closing, and after discarding assert_equals: window got cleared after browsing context removal expected object "[object Window]" but got null
 

Modified: trunk/Source/WebCore/ChangeLog (243660 => 243661)


--- trunk/Source/WebCore/ChangeLog	2019-03-29 20:26:49 UTC (rev 243660)
+++ trunk/Source/WebCore/ChangeLog	2019-03-29 20:46:57 UTC (rev 243661)
@@ -1,3 +1,21 @@
+2019-03-29  Chris Dumez  <cdu...@apple.com>
+
+        Set window.closed immediately when close() is invoked
+        https://bugs.webkit.org/show_bug.cgi?id=195409
+
+        Reviewed by Alex Christensen.
+
+        Window.closed should return true if it is closing:
+        - https://html.spec.whatwg.org/#dom-window-closed
+
+        Window.close() sets the 'is closing' flag to true synchronously, as per:
+        - https://html.spec.whatwg.org/#dom-window-close (step 3.1)
+
+        No new tests, rebaselined existing tests.
+
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::closed const):
+
 2019-03-29  Zalan Bujtas  <za...@apple.com>
 
         [Simple line layout] Turn off inline boxtree generation for multiline content

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (243660 => 243661)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2019-03-29 20:26:49 UTC (rev 243660)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2019-03-29 20:46:57 UTC (rev 243661)
@@ -1314,7 +1314,12 @@
 
 bool DOMWindow::closed() const
 {
-    return !frame();
+    auto* frame = this->frame();
+    if (!frame)
+        return true;
+
+    auto* page = frame->page();
+    return !page || page->isClosing();
 }
 
 unsigned DOMWindow::length() const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to