Skip to content

Commit 008eb05

Browse files
committed
Regression(r272607) Removal of alert()/confirm() in third-party iframes breaks Salesforce
https://bugs.webkit.org/show_bug.cgi?id=229737 <rdar://82591122> Source/WebCore: Unreviewed, Revert behavior change made in r272607 as it broke Salesforce. My understanding is that Chrome had to revert this too. Tests: http/tests/security/cross-origin-js-prompt-allowed.html http/tests/security/same-origin-different-domain-js-prompt-allowed.html * page/DOMWindow.cpp: (WebCore::DOMWindow::alert): (WebCore::DOMWindow::confirmForBindings): (WebCore::DOMWindow::prompt): LayoutTests: Unreviewed, Update existing tests to reflect behavior change. * http/tests/security/cross-origin-js-prompt-allowed-expected.txt: Added. * http/tests/security/cross-origin-js-prompt-allowed.html: Renamed from LayoutTests/http/tests/security/cross-origin-js-prompt-forbidden.html. * http/tests/security/cross-origin-js-prompt-forbidden-expected.txt: Removed. * http/tests/security/resources/cross-origin-js-prompt-allowed.html: Renamed from LayoutTests/http/tests/security/resources/cross-origin-js-prompt-forbidden.html. * http/tests/security/same-origin-different-domain-js-prompt-allowed-expected.txt: Added. * http/tests/security/same-origin-different-domain-js-prompt-allowed.html: Renamed from LayoutTests/http/tests/security/same-origin-different-domain-js-prompt-forbidden.html. * http/tests/security/same-origin-different-domain-js-prompt-forbidden-expected.txt: Removed. Canonical link: https://commits.webkit.org/241180@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281848 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 53f771a commit 008eb05

12 files changed

Lines changed: 77 additions & 71 deletions

LayoutTests/ChangeLog

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
2021-09-01 Chris Dumez <cdumez@apple.com>
2+
3+
Regression(r272607) Removal of alert()/confirm() in third-party iframes breaks Salesforce
4+
https://bugs.webkit.org/show_bug.cgi?id=229737
5+
<rdar://82591122>
6+
7+
Unreviewed, Update existing tests to reflect behavior change.
8+
9+
* http/tests/security/cross-origin-js-prompt-allowed-expected.txt: Added.
10+
* http/tests/security/cross-origin-js-prompt-allowed.html: Renamed from LayoutTests/http/tests/security/cross-origin-js-prompt-forbidden.html.
11+
* http/tests/security/cross-origin-js-prompt-forbidden-expected.txt: Removed.
12+
* http/tests/security/resources/cross-origin-js-prompt-allowed.html: Renamed from LayoutTests/http/tests/security/resources/cross-origin-js-prompt-forbidden.html.
13+
* http/tests/security/same-origin-different-domain-js-prompt-allowed-expected.txt: Added.
14+
* http/tests/security/same-origin-different-domain-js-prompt-allowed.html: Renamed from LayoutTests/http/tests/security/same-origin-different-domain-js-prompt-forbidden.html.
15+
* http/tests/security/same-origin-different-domain-js-prompt-forbidden-expected.txt: Removed.
16+
117
2021-09-01 Myles C. Maxfield <mmaxfield@apple.com>
218

319
CSSFontFaceSet.clear() should not clear CSS-connected members

LayoutTests/http/tests/history/cross-origin-replace-history-object-child-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CONSOLE MESSAGE: SecurityError: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a cross-origin frame. Protocols, domains, and ports must match.
22
ALERT: Child window's history object before attempt to clear: undefined
3-
CONSOLE MESSAGE: Use of window.alert is not allowed in different origin-domain iframes.
3+
ALERT: About to shadow child window's history object: [object History]
44
CONSOLE MESSAGE: PASS: Could not shadow child window's history object: [object History]
55
CONSOLE MESSAGE: SecurityError: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a cross-origin frame. Protocols, domains, and ports must match.
66
ALERT: Child window's history object after attempt to clear: undefined
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
PROMPT: PASS: This prompt dialog should show, default text:
2+
CONFIRM: PASS: This confirm dialog should show
3+
ALERT: PASS: This alert dialog should show
4+
Tests that JS prompts are allowed in cross-origin frames
5+
6+
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
7+
8+
9+
PASS successfullyParsed is true
10+
11+
TEST COMPLETE
12+

LayoutTests/http/tests/security/cross-origin-js-prompt-forbidden.html renamed to LayoutTests/http/tests/security/cross-origin-js-prompt-allowed.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<body>
44
<script src="/js-test-resources/js-test.js"></script>
55
<script>
6-
description("Tests that JS prompts are forbidden in cross-origin frames");
6+
description("Tests that JS prompts are allowed in cross-origin frames");
77
jsTestIsAsync = true;
88

99
onmessage = (e) => {
@@ -13,6 +13,6 @@
1313
debug(e.data);
1414
}
1515
</script>
16-
<iframe src="http://localhost:8000/security/resources/cross-origin-js-prompt-forbidden.html"></iframe>
16+
<iframe src="http://localhost:8000/security/resources/cross-origin-js-prompt-allowed.html"></iframe>
1717
</body>
1818
</html>

LayoutTests/http/tests/security/cross-origin-js-prompt-forbidden-expected.txt

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<body>
4+
<script>
5+
onload = () => {
6+
setTimeout(() => {
7+
window.prompt("PASS: This prompt dialog should show");
8+
window.confirm("PASS: This confirm dialog should show");
9+
window.alert("PASS: This alert dialog should show");
10+
top.postMessage("done", "*");
11+
}, 0);
12+
};
13+
</script>
14+
</body>
15+
</html>

LayoutTests/http/tests/security/resources/cross-origin-js-prompt-forbidden.html

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
PROMPT: PASS: This prompt dialog should show, default text:
2+
CONFIRM: PASS: This confirm dialog should show
3+
ALERT: PASS: This alert dialog should show
4+
Tests that JS prompts are allowed in same-origin but different-domain iframes
5+
6+
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
7+
8+
9+
PASS successfullyParsed is true
10+
11+
TEST COMPLETE
12+

LayoutTests/http/tests/security/same-origin-different-domain-js-prompt-forbidden.html renamed to LayoutTests/http/tests/security/same-origin-different-domain-js-prompt-allowed.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<body>
44
<script src="/js-test-resources/js-test.js"></script>
55
<script>
6-
description("Tests that JS prompts are forbidden in same-origin but different-domain iframes");
6+
description("Tests that JS prompts are allowed in same-origin but different-domain iframes");
77
jsTestIsAsync = true;
88

99
if (window.internals)
@@ -17,6 +17,6 @@
1717
debug(e.data);
1818
}
1919
</script>
20-
<iframe src="http://127.0.0.1:8000/security/resources/cross-origin-js-prompt-forbidden.html"></iframe>
20+
<iframe src="http://127.0.0.1:8000/security/resources/cross-origin-js-prompt-allowed.html"></iframe>
2121
</body>
2222
</html>

LayoutTests/http/tests/security/same-origin-different-domain-js-prompt-forbidden-expected.txt

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)