Title: [231456] trunk
Revision
231456
Author
[email protected]
Date
2018-05-07 14:42:29 -0700 (Mon, 07 May 2018)

Log Message

Stop using an iframe's id as fallback if its name attribute is not set
https://bugs.webkit.org/show_bug.cgi?id=11388

Reviewed by Geoff Garen.

Source/WebCore:

WebKit had logic to use an iframe's id as fallback name when its name
content attribute is not set. This behavior was not standard and did not
match other browsers:
- https://html.spec.whatwg.org/#attr-iframe-name

Gecko / Trident never behaved this way. Blink was aligned with us until
they started to match the specification in:
- https://bugs.chromium.org/p/chromium/issues/detail?id=347169

This WebKit quirk was causing some Web-compatibility issues because it
would affect the behavior of Window's name property getter when trying
to look up an iframe by id. Because of Window's named property getter
behavior [1], we would return the frame's contentWindow instead of the
iframe element itself.

[1] https://html.spec.whatwg.org/multipage/window-object.html#named-access-on-the-window-object

Test: fast/dom/Window/named-getter-frame-id.html

* html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::openURL):
(WebCore::HTMLFrameElementBase::parseAttribute):
(WebCore::HTMLFrameElementBase::didFinishInsertingNode):
* html/HTMLFrameElementBase.h:

LayoutTests:

* fast/dom/Window/named-getter-frame-id-expected.txt: Added.
* fast/dom/Window/named-getter-frame-id.html: Added.
Add layout test coverage.

* fast/dom/Geolocation/srcdoc-getCurrentPosition-expected.txt:
* fast/dom/Geolocation/srcdoc-watchPosition-expected.txt:
* fast/dom/HTMLAnchorElement/anchor-in-noscroll-iframe-crash.html:
* fast/dom/Window/window-special-properties-expected.txt:
* fast/frames/iframe-no-name-expected.txt:
* fast/frames/iframe-no-name.html:
* fast/layers/prevent-hit-test-during-layout.html:
* fast/xmlhttprequest/xmlhttprequest-no-file-access-expected.txt:
* http/tests/security/clipboard/copy-paste-html-cross-origin-iframe-across-origin.html:
* http/tests/security/contentSecurityPolicy/iframe-blank-url-programmatically-add-external-script-expected.txt:
* http/tests/security/cross-origin-reified-window-property-access.html:
* http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame-expected.txt:
* http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-but-try-access-from-wrong-frame-expected.txt:
* http/tests/webrtc/filtering-ice-candidate-same-origin-frame.html:
* http/wpt/beacon/keepalive-after-navigation-expected.txt:
* http/wpt/cache-storage/cache-remove-twice.html:
Update some layout tests that relied on our old (non-standard) behavior.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (231455 => 231456)


--- trunk/LayoutTests/ChangeLog	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/ChangeLog	2018-05-07 21:42:29 UTC (rev 231456)
@@ -1,3 +1,32 @@
+2018-05-07  Chris Dumez  <[email protected]>
+
+        Stop using an iframe's id as fallback if its name attribute is not set
+        https://bugs.webkit.org/show_bug.cgi?id=11388
+
+        Reviewed by Geoff Garen.
+
+        * fast/dom/Window/named-getter-frame-id-expected.txt: Added.
+        * fast/dom/Window/named-getter-frame-id.html: Added.
+        Add layout test coverage.
+
+        * fast/dom/Geolocation/srcdoc-getCurrentPosition-expected.txt:
+        * fast/dom/Geolocation/srcdoc-watchPosition-expected.txt:
+        * fast/dom/HTMLAnchorElement/anchor-in-noscroll-iframe-crash.html:
+        * fast/dom/Window/window-special-properties-expected.txt:
+        * fast/frames/iframe-no-name-expected.txt:
+        * fast/frames/iframe-no-name.html:
+        * fast/layers/prevent-hit-test-during-layout.html:
+        * fast/xmlhttprequest/xmlhttprequest-no-file-access-expected.txt:
+        * http/tests/security/clipboard/copy-paste-html-cross-origin-iframe-across-origin.html:
+        * http/tests/security/contentSecurityPolicy/iframe-blank-url-programmatically-add-external-script-expected.txt:
+        * http/tests/security/cross-origin-reified-window-property-access.html:
+        * http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame-expected.txt:
+        * http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-but-try-access-from-wrong-frame-expected.txt:
+        * http/tests/webrtc/filtering-ice-candidate-same-origin-frame.html:
+        * http/wpt/beacon/keepalive-after-navigation-expected.txt:
+        * http/wpt/cache-storage/cache-remove-twice.html:
+        Update some layout tests that relied on our old (non-standard) behavior.
+
 2018-05-07  Youenn Fablet  <[email protected]>
 
         Layout Test webrtc/addICECandidate-closed.html is a flaky failure

Modified: trunk/LayoutTests/fast/dom/Geolocation/srcdoc-getCurrentPosition-expected.txt (231455 => 231456)


--- trunk/LayoutTests/fast/dom/Geolocation/srcdoc-getCurrentPosition-expected.txt	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/fast/dom/Geolocation/srcdoc-getCurrentPosition-expected.txt	2018-05-07 21:42:29 UTC (rev 231456)
@@ -3,7 +3,7 @@
 
 
 --------
-Frame: 'frame'
+Frame: '<!--frame1-->'
 --------
 FAIL should have invoked error callback, but invoked success callback.
 

Modified: trunk/LayoutTests/fast/dom/Geolocation/srcdoc-watchPosition-expected.txt (231455 => 231456)


--- trunk/LayoutTests/fast/dom/Geolocation/srcdoc-watchPosition-expected.txt	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/fast/dom/Geolocation/srcdoc-watchPosition-expected.txt	2018-05-07 21:42:29 UTC (rev 231456)
@@ -3,7 +3,7 @@
 
 
 --------
-Frame: 'frame'
+Frame: '<!--frame1-->'
 --------
 FAIL should have invoked error callback, but invoked success callback.
 

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-in-noscroll-iframe-crash.html (231455 => 231456)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-in-noscroll-iframe-crash.html	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-in-noscroll-iframe-crash.html	2018-05-07 21:42:29 UTC (rev 231456)
@@ -14,15 +14,15 @@
     }
 
     function setupTopLevel() {
-        var scrollTarget = window.frames['target'].document.getElementById('might_scroll');
+        var scrollTarget = iframeTarget.contentDocument.getElementById('might_scroll');
 
-        window.frames['target'].window.registerAction(function () {
+        iframeTarget.contentWindow.registerAction(function () {
             iframeTarget.remove();
             setTimeout(finish, 0);
         });
 
-        window.frames['target'].window.run();
+        iframeTarget.contentWindow.run();
     }
 </script>    
 </body>
-</html>
\ No newline at end of file
+</html>

Added: trunk/LayoutTests/fast/dom/Window/named-getter-frame-id-expected.txt (0 => 231456)


--- trunk/LayoutTests/fast/dom/Window/named-getter-frame-id-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/named-getter-frame-id-expected.txt	2018-05-07 21:42:29 UTC (rev 231456)
@@ -0,0 +1,12 @@
+Tests that looking up a frame by id returns the iframe element and not its contentWindow.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testFrame is document.getElementById('testFrame')
+PASS testFrame.name is ""
+PASS testFrame.id is "testFrame"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/Window/named-getter-frame-id.html (0 => 231456)


--- trunk/LayoutTests/fast/dom/Window/named-getter-frame-id.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/named-getter-frame-id.html	2018-05-07 21:42:29 UTC (rev 231456)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<iframe id="testFrame"></iframe>
+<script>
+description("Tests that looking up a frame by id returns the iframe element and not its contentWindow.");
+_onload_ = function() {
+    shouldBe("testFrame", "document.getElementById('testFrame')");
+    shouldBeEqualToString("testFrame.name", "");
+    shouldBeEqualToString("testFrame.id", "testFrame");
+}
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/fast/dom/Window/window-special-properties-expected.txt (231455 => 231456)


--- trunk/LayoutTests/fast/dom/Window/window-special-properties-expected.txt	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/fast/dom/Window/window-special-properties-expected.txt	2018-05-07 21:42:29 UTC (rev 231456)
@@ -42,8 +42,8 @@
 Nonexistent iframe name: undefined
 Iframe by name (unique): single WINDOW
 Iframe by name (multiple): single WINDOW
-Iframe by id (unique): single WINDOW
-Iframe by id (multiple): single WINDOW
+Iframe by id (unique): single IFRAME(id)
+Iframe by id (multiple): collection(2) IFRAME(id) IFRAME(id)
 Iframe by id/name mixed: single WINDOW
 
 Nonexistent span name: undefined
@@ -53,7 +53,7 @@
 Span by id (multiple): collection(2) SPAN(id) SPAN(id)
 Span by id/name mixed: collection(2) SPAN(id) SPAN(id)
 
-Mixed by id: single WINDOW
+Mixed by id: collection(7) IMG(id) FORM(id) APPLET(id) EMBED(id) OBJECT(id) IFRAME(id) SPAN(id)
 Mixed by name: single WINDOW
 Mixed by id (no iframe): collection(6) IMG(id) FORM(id) APPLET(id) EMBED(id) OBJECT(id) SPAN(id)
 Mixed by name (no iframe): collection(5) IMG(name) FORM(name) APPLET(name) EMBED(name) OBJECT(name)

Modified: trunk/LayoutTests/fast/frames/iframe-no-name-expected.txt (231455 => 231456)


--- trunk/LayoutTests/fast/frames/iframe-no-name-expected.txt	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/fast/frames/iframe-no-name-expected.txt	2018-05-07 21:42:29 UTC (rev 231456)
@@ -3,7 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS frames[0].name is "id"
+PASS frames[0].name is ""
 PASS frames[1].name is "name"
 PASS frames[2].name is "name"
 PASS frames[3].name is "name"

Modified: trunk/LayoutTests/fast/frames/iframe-no-name.html (231455 => 231456)


--- trunk/LayoutTests/fast/frames/iframe-no-name.html	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/fast/frames/iframe-no-name.html	2018-05-07 21:42:29 UTC (rev 231456)
@@ -11,7 +11,7 @@
 <iframe name="name" id="id"></iframe>
 <script>
 description("Checks that the id of an iframe does not set the contentWindow's name if the iframe's name is not set.");
-shouldBeEqualToString("frames[0].name", "id");
+shouldBeEqualToString("frames[0].name", "");
 shouldBeEqualToString("frames[1].name", "name");
 shouldBeEqualToString("frames[2].name", "name");
 shouldBeEqualToString("frames[3].name", "name");

Modified: trunk/LayoutTests/fast/layers/prevent-hit-test-during-layout.html (231455 => 231456)


--- trunk/LayoutTests/fast/layers/prevent-hit-test-during-layout.html	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/fast/layers/prevent-hit-test-during-layout.html	2018-05-07 21:42:29 UTC (rev 231456)
@@ -33,7 +33,7 @@
     }
     
     function runTest() {
-        fixedDiv = window.frames['fixedFrame'].document.getElementById('fixedDiv');
+        fixedDiv = fixedFrame.contentDocument.getElementById('fixedDiv');
         target = document.getElementById('target');
 
         setTimeout(function() {
@@ -53,4 +53,4 @@
     </div>
     <script src=""
 </body>
-</html>
\ No newline at end of file
+</html>

Modified: trunk/LayoutTests/fast/xmlhttprequest/xmlhttprequest-no-file-access-expected.txt (231455 => 231456)


--- trunk/LayoutTests/fast/xmlhttprequest/xmlhttprequest-no-file-access-expected.txt	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/fast/xmlhttprequest/xmlhttprequest-no-file-access-expected.txt	2018-05-07 21:42:29 UTC (rev 231456)
@@ -16,6 +16,6 @@
 
 
 --------
-Frame: 'f'
+Frame: '<!--frame2-->'
 --------
 Successful write into iframe

Modified: trunk/LayoutTests/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt (231455 => 231456)


--- trunk/LayoutTests/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt	2018-05-07 21:42:29 UTC (rev 231456)
@@ -1,19 +1,19 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
-frame "frame" - didStartProvisionalLoadForFrame
+frame "<!--frame1-->" - didStartProvisionalLoadForFrame
 main frame - didFinishDocumentLoadForFrame
 http://127.0.0.1:8000/loading/resources/basic-auth-testing.php?username=webkit&password=rocks - didReceiveAuthenticationChallenge - Responding with webkit:rocks
-frame "frame" - didCommitLoadForFrame
-frame "frame" - didFinishDocumentLoadForFrame
-frame "frame" - willPerformClientRedirectToURL: http://127.0.0.1:8000/a//b/non-existent-file.html 
-frame "frame" - didHandleOnloadEventsForFrame
+frame "<!--frame1-->" - didCommitLoadForFrame
+frame "<!--frame1-->" - didFinishDocumentLoadForFrame
+frame "<!--frame1-->" - willPerformClientRedirectToURL: http://127.0.0.1:8000/a//b/non-existent-file.html 
+frame "<!--frame1-->" - didHandleOnloadEventsForFrame
 main frame - didHandleOnloadEventsForFrame
-frame "frame" - didFinishLoadForFrame
+frame "<!--frame1-->" - didFinishLoadForFrame
 main frame - didFinishLoadForFrame
-frame "frame" - didStartProvisionalLoadForFrame
-frame "frame" - didCancelClientRedirectForFrame
-frame "frame" - didCommitLoadForFrame
-frame "frame" - didReceiveTitle: 404 Not Found
-frame "frame" - didFinishDocumentLoadForFrame
-frame "frame" - didFailLoadWithError
+frame "<!--frame1-->" - didStartProvisionalLoadForFrame
+frame "<!--frame1-->" - didCancelClientRedirectForFrame
+frame "<!--frame1-->" - didCommitLoadForFrame
+frame "<!--frame1-->" - didReceiveTitle: 404 Not Found
+frame "<!--frame1-->" - didFinishDocumentLoadForFrame
+frame "<!--frame1-->" - didFailLoadWithError
 PASS did not cause assertion failure.

Modified: trunk/LayoutTests/http/tests/navigation/image-load-in-subframe-unload-handler-expected.txt (231455 => 231456)


--- trunk/LayoutTests/http/tests/navigation/image-load-in-subframe-unload-handler-expected.txt	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/http/tests/navigation/image-load-in-subframe-unload-handler-expected.txt	2018-05-07 21:42:29 UTC (rev 231456)
@@ -1,2 +1,2 @@
-frame "<!--frame1-->" - has 1 onunload handler(s)
+frame "<!--frame2-->" - has 1 onunload handler(s)
 This test triggers an unload handler that starts an image load in a different frame (and deletes both frames), but ensures the main frame is not destroyed. We pass if we don't crash.

Modified: trunk/LayoutTests/http/tests/quicklook/csp-header-ignored-expected.txt (231455 => 231456)


--- trunk/LayoutTests/http/tests/quicklook/csp-header-ignored-expected.txt	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/http/tests/quicklook/csp-header-ignored-expected.txt	2018-05-07 21:42:29 UTC (rev 231456)
@@ -4,6 +4,6 @@
 
 
 --------
-Frame: 'frame'
+Frame: '<!--frame1-->'
 --------
 PASS

Modified: trunk/LayoutTests/http/tests/security/clipboard/copy-paste-html-cross-origin-iframe-across-origin.html (231455 => 231456)


--- trunk/LayoutTests/http/tests/security/clipboard/copy-paste-html-cross-origin-iframe-across-origin.html	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/http/tests/security/clipboard/copy-paste-html-cross-origin-iframe-across-origin.html	2018-05-07 21:42:29 UTC (rev 231456)
@@ -33,7 +33,7 @@
     document.execCommand('copy');
     getSelection().removeAllRanges();
     setTimeout(() => {
-        destinationFrame.postMessage({type: 'paste'}, '*');
+        destinationFrame.contentWindow.postMessage({type: 'paste'}, '*');
     }, 0);
 }
 

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/iframe-blank-url-programmatically-add-external-script-expected.txt (231455 => 231456)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/iframe-blank-url-programmatically-add-external-script-expected.txt	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/iframe-blank-url-programmatically-add-external-script-expected.txt	2018-05-07 21:42:29 UTC (rev 231456)
@@ -2,6 +2,6 @@
 
 
 --------
-Frame: 'frame'
+Frame: '<!--frame1-->'
 --------
 

Modified: trunk/LayoutTests/http/tests/security/cross-origin-reified-window-property-access.html (231455 => 231456)


--- trunk/LayoutTests/http/tests/security/cross-origin-reified-window-property-access.html	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/http/tests/security/cross-origin-reified-window-property-access.html	2018-05-07 21:42:29 UTC (rev 231456)
@@ -26,8 +26,8 @@
 
 function runTest()
 {
-    crossOriginWindow = crossOriginFrame.window;
-    sameOriginWindow = sameOriginFrame.window;
+    crossOriginWindow = crossOriginFrame.contentWindow;
+    sameOriginWindow = sameOriginFrame.contentWindow;
 
     shouldThrowOrReturnUndefined('crossOriginWindow.document');
     shouldThrowOrReturnUndefined('crossOriginWindow.name');

Modified: trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame-expected.txt (231455 => 231456)


--- trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame-expected.txt	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame-expected.txt	2018-05-07 21:42:29 UTC (rev 231456)
@@ -10,7 +10,7 @@
   
 
 --------
-Frame: 'TheIframeThatRequestsStorageAccess'
+Frame: '<!--frame1-->'
 --------
 After the top frame navigates the sub frame, the sub frame should no longer have access to first-party cookies.
 Did not receive cookie named 'firstPartyCookie'.
@@ -18,7 +18,7 @@
 Client-side document.cookie: partitionedCookie=value
 
 --------
-Frame: '<!--frame1-->'
+Frame: '<!--frame2-->'
 --------
 Should receive first-party cookie.
 Received cookie named 'firstPartyCookie'.
@@ -26,7 +26,7 @@
 Client-side document.cookie: firstPartyCookie=value
 
 --------
-Frame: '<!--frame2-->'
+Frame: '<!--frame3-->'
 --------
 Should not receive cookies.
 Did not receive cookie named 'firstPartyCookie'.
@@ -34,13 +34,13 @@
 Client-side document.cookie:
 
 --------
-Frame: '<!--frame3-->'
+Frame: '<!--frame4-->'
 --------
 
 
 
 --------
-Frame: '<!--frame4-->'
+Frame: '<!--frame5-->'
 --------
 Should receive partitioned cookie.
 Did not receive cookie named 'firstPartyCookie'.

Modified: trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-but-try-access-from-wrong-frame-expected.txt (231455 => 231456)


--- trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-but-try-access-from-wrong-frame-expected.txt	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-but-try-access-from-wrong-frame-expected.txt	2018-05-07 21:42:29 UTC (rev 231456)
@@ -10,12 +10,12 @@
   
 
 --------
-Frame: 'theIframe'
+Frame: '<!--frame1-->'
 --------
 
 
 --------
-Frame: '<!--frame1-->'
+Frame: '<!--frame2-->'
 --------
 Should receive first-party cookie.
 Received cookie named 'firstPartyCookie'.
@@ -23,7 +23,7 @@
 Client-side document.cookie: firstPartyCookie=value
 
 --------
-Frame: '<!--frame2-->'
+Frame: '<!--frame3-->'
 --------
 Should not receive cookies.
 Did not receive cookie named 'firstPartyCookie'.
@@ -31,13 +31,13 @@
 Client-side document.cookie:
 
 --------
-Frame: '<!--frame3-->'
+Frame: '<!--frame4-->'
 --------
 
 
 
 --------
-Frame: '<!--frame4-->'
+Frame: '<!--frame5-->'
 --------
 Should receive partitioned cookie.
 Did not receive cookie named 'firstPartyCookie'.
@@ -45,7 +45,7 @@
 Client-side document.cookie: partitionedCookie=value
 
 --------
-Frame: '<!--frame5-->'
+Frame: '<!--frame6-->'
 --------
 Should receive partitioned cookie.
 Did not receive cookie named 'firstPartyCookie'.

Modified: trunk/LayoutTests/http/tests/webrtc/filtering-ice-candidate-same-origin-frame.html (231455 => 231456)


--- trunk/LayoutTests/http/tests/webrtc/filtering-ice-candidate-same-origin-frame.html	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/http/tests/webrtc/filtering-ice-candidate-same-origin-frame.html	2018-05-07 21:42:29 UTC (rev 231456)
@@ -15,7 +15,7 @@
     }
     if (event.data ="" "getUserMedia done") {
         didGetUserMedia = true;
-        frame1.postMessage("check filtering", "*");
+        frame1.contentWindow.postMessage("check filtering", "*");
         return;
     }
     check1.innerHTML = "";

Modified: trunk/LayoutTests/http/wpt/beacon/keepalive-after-navigation-expected.txt (231455 => 231456)


--- trunk/LayoutTests/http/wpt/beacon/keepalive-after-navigation-expected.txt	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/http/wpt/beacon/keepalive-after-navigation-expected.txt	2018-05-07 21:42:29 UTC (rev 231456)
@@ -1,4 +1,4 @@
-frame "testFrame" - has 1 onunload handler(s)
+frame "<!--frame1-->" - has 1 onunload handler(s)
 
 PASS Test that beacon sent from unload event handler is properly received 
 

Modified: trunk/LayoutTests/http/wpt/cache-storage/cache-remove-twice.html (231455 => 231456)


--- trunk/LayoutTests/http/wpt/cache-storage/cache-remove-twice.html	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/http/wpt/cache-storage/cache-remove-twice.html	2018-05-07 21:42:29 UTC (rev 231456)
@@ -24,8 +24,8 @@
         var cacheName = "test-remove-twice";
         return new Promise((resolve, reject) => {
             window.addEventListener("message", test.step_func((event) => {
-                return Promise.all([self.caches.open(cacheName), cacheFrame.window.caches.open(cacheName) ]).then(() => {
-                    return Promise.all([self.caches.delete(cacheName), cacheFrame.window.caches.delete(cacheName)]);
+                return Promise.all([self.caches.open(cacheName), cacheFrame.contentWindow.caches.open(cacheName) ]).then(() => {
+                    return Promise.all([self.caches.delete(cacheName), cacheFrame.contentWindow.caches.delete(cacheName)]);
                 }).then(resolve, reject);
 	    }));
 	});

Modified: trunk/LayoutTests/platform/ios/http/tests/quicklook/csp-header-ignored-expected.txt (231455 => 231456)


--- trunk/LayoutTests/platform/ios/http/tests/quicklook/csp-header-ignored-expected.txt	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/platform/ios/http/tests/quicklook/csp-header-ignored-expected.txt	2018-05-07 21:42:29 UTC (rev 231456)
@@ -3,6 +3,6 @@
 
 
 --------
-Frame: 'frame'
+Frame: '<!--frame1-->'
 --------
 PASS

Modified: trunk/LayoutTests/platform/wk2/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt (231455 => 231456)


--- trunk/LayoutTests/platform/wk2/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/LayoutTests/platform/wk2/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt	2018-05-07 21:42:29 UTC (rev 231456)
@@ -1,19 +1,19 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
 main frame - didFinishDocumentLoadForFrame
-frame "frame" - didStartProvisionalLoadForFrame
+frame "<!--frame1-->" - didStartProvisionalLoadForFrame
 127.0.0.1:8000 - didReceiveAuthenticationChallenge - Responding with webkit:rocks
-frame "frame" - didCommitLoadForFrame
-frame "frame" - didFinishDocumentLoadForFrame
-frame "frame" - willPerformClientRedirectToURL: http://127.0.0.1:8000/a//b/non-existent-file.html 
-frame "frame" - didHandleOnloadEventsForFrame
+frame "<!--frame1-->" - didCommitLoadForFrame
+frame "<!--frame1-->" - didFinishDocumentLoadForFrame
+frame "<!--frame1-->" - willPerformClientRedirectToURL: http://127.0.0.1:8000/a//b/non-existent-file.html 
+frame "<!--frame1-->" - didHandleOnloadEventsForFrame
 main frame - didHandleOnloadEventsForFrame
-frame "frame" - didFinishLoadForFrame
+frame "<!--frame1-->" - didFinishLoadForFrame
 main frame - didFinishLoadForFrame
-frame "frame" - didStartProvisionalLoadForFrame
-frame "frame" - didCancelClientRedirectForFrame
-frame "frame" - didCommitLoadForFrame
-frame "frame" - didReceiveTitle: 404 Not Found
-frame "frame" - didFinishDocumentLoadForFrame
-frame "frame" - didFailLoadWithError
+frame "<!--frame1-->" - didStartProvisionalLoadForFrame
+frame "<!--frame1-->" - didCancelClientRedirectForFrame
+frame "<!--frame1-->" - didCommitLoadForFrame
+frame "<!--frame1-->" - didReceiveTitle: 404 Not Found
+frame "<!--frame1-->" - didFinishDocumentLoadForFrame
+frame "<!--frame1-->" - didFailLoadWithError
 PASS did not cause assertion failure.

Modified: trunk/Source/WebCore/ChangeLog (231455 => 231456)


--- trunk/Source/WebCore/ChangeLog	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/Source/WebCore/ChangeLog	2018-05-07 21:42:29 UTC (rev 231456)
@@ -1,5 +1,37 @@
 2018-05-07  Chris Dumez  <[email protected]>
 
+        Stop using an iframe's id as fallback if its name attribute is not set
+        https://bugs.webkit.org/show_bug.cgi?id=11388
+
+        Reviewed by Geoff Garen.
+
+        WebKit had logic to use an iframe's id as fallback name when its name
+        content attribute is not set. This behavior was not standard and did not
+        match other browsers:
+        - https://html.spec.whatwg.org/#attr-iframe-name
+
+        Gecko / Trident never behaved this way. Blink was aligned with us until
+        they started to match the specification in:
+        - https://bugs.chromium.org/p/chromium/issues/detail?id=347169
+
+        This WebKit quirk was causing some Web-compatibility issues because it
+        would affect the behavior of Window's name property getter when trying
+        to look up an iframe by id. Because of Window's named property getter
+        behavior [1], we would return the frame's contentWindow instead of the
+        iframe element itself.
+
+        [1] https://html.spec.whatwg.org/multipage/window-object.html#named-access-on-the-window-object
+
+        Test: fast/dom/Window/named-getter-frame-id.html
+
+        * html/HTMLFrameElementBase.cpp:
+        (WebCore::HTMLFrameElementBase::openURL):
+        (WebCore::HTMLFrameElementBase::parseAttribute):
+        (WebCore::HTMLFrameElementBase::didFinishInsertingNode):
+        * html/HTMLFrameElementBase.h:
+
+2018-05-07  Chris Dumez  <[email protected]>
+
         ASSERT(!childItemWithTarget(child->target())) is hit in HistoryItem::addChildItem()
         https://bugs.webkit.org/show_bug.cgi?id=185322
 

Modified: trunk/Source/WebCore/html/HTMLFrameElementBase.cpp (231455 => 231456)


--- trunk/Source/WebCore/html/HTMLFrameElementBase.cpp	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/Source/WebCore/html/HTMLFrameElementBase.cpp	2018-05-07 21:42:29 UTC (rev 231456)
@@ -96,7 +96,7 @@
     if (!parentFrame)
         return;
 
-    parentFrame->loader().subframeLoader().requestFrame(*this, m_URL, m_frameName, lockHistory, lockBackForwardList);
+    parentFrame->loader().subframeLoader().requestFrame(*this, m_URL, getNameAttribute(), lockHistory, lockBackForwardList);
 }
 
 void HTMLFrameElementBase::parseAttribute(const QualifiedName& name, const AtomicString& value)
@@ -105,17 +105,7 @@
         setLocation("about:srcdoc");
     else if (name == srcAttr && !hasAttributeWithoutSynchronization(srcdocAttr))
         setLocation(stripLeadingAndTrailingHTMLSpaces(value));
-    else if (name == idAttr) {
-        HTMLFrameOwnerElement::parseAttribute(name, value);
-        // Falling back to using the 'id' attribute is not standard but some content relies on this behavior.
-        if (!hasAttributeWithoutSynchronization(nameAttr))
-            m_frameName = value;
-    } else if (name == nameAttr) {
-        m_frameName = value;
-        // FIXME: If we are already attached, this doesn't actually change the frame's name.
-        // FIXME: If we are already attached, this doesn't check for frame name
-        // conflicts and generate a unique frame name.
-    } else if (name == marginwidthAttr) {
+    else if (name == marginwidthAttr) {
         m_marginWidth = value.toInt();
         // FIXME: If we are already attached, this has no effect.
     } else if (name == marginheightAttr) {
@@ -132,15 +122,6 @@
         HTMLFrameOwnerElement::parseAttribute(name, value);
 }
 
-void HTMLFrameElementBase::setNameAndOpenURL()
-{
-    m_frameName = getNameAttribute();
-    // Falling back to using the 'id' attribute is not standard but some content relies on this behavior.
-    if (m_frameName.isNull())
-        m_frameName = getIdAttribute();
-    openURL();
-}
-
 Node::InsertedIntoAncestorResult HTMLFrameElementBase::insertedIntoAncestor(InsertionType insertionType, ContainerNode& parentOfInsertedTree)
 {
     HTMLFrameOwnerElement::insertedIntoAncestor(insertionType, parentOfInsertedTree);
@@ -163,7 +144,7 @@
 
     if (!renderer())
         invalidateStyleAndRenderersForSubtree();
-    setNameAndOpenURL();
+    openURL();
 }
 
 void HTMLFrameElementBase::didAttachRenderers()

Modified: trunk/Source/WebCore/html/HTMLFrameElementBase.h (231455 => 231456)


--- trunk/Source/WebCore/html/HTMLFrameElementBase.h	2018-05-07 21:06:34 UTC (rev 231455)
+++ trunk/Source/WebCore/html/HTMLFrameElementBase.h	2018-05-07 21:42:29 UTC (rev 231456)
@@ -70,11 +70,9 @@
 
     bool isFrameElementBase() const final { return true; }
 
-    void setNameAndOpenURL();
     void openURL(LockHistory = LockHistory::Yes, LockBackForwardList = LockBackForwardList::Yes);
 
     AtomicString m_URL;
-    AtomicString m_frameName;
 
     ScrollbarMode m_scrolling;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to