beidson@apple.com | 29c8b21 | 2009-09-14 20:05:30 +0000 | [diff] [blame] | 1 | <html> |
| 2 | <head> |
| 3 | <script> |
rniwa@webkit.org | 14a295a | 2012-06-13 07:49:51 +0000 | [diff] [blame] | 4 | if (window.testRunner) { |
| 5 | testRunner.dumpAsText(); |
| 6 | testRunner.dumpChildFramesAsText(); |
| 7 | testRunner.setHandlesAuthenticationChallenges(true); |
| 8 | testRunner.setAuthenticationUsername("first"); |
| 9 | testRunner.setAuthenticationPassword("first-pw"); |
| 10 | testRunner.waitUntilDone(); |
beidson@apple.com | 29c8b21 | 2009-09-14 20:05:30 +0000 | [diff] [blame] | 11 | } |
| 12 | |
| 13 | function firstFrameLoaded() |
| 14 | { |
rniwa@webkit.org | 14a295a | 2012-06-13 07:49:51 +0000 | [diff] [blame] | 15 | if (window.testRunner) { |
| 16 | testRunner.setAuthenticationUsername("second"); |
| 17 | testRunner.setAuthenticationPassword("second-pw"); |
beidson@apple.com | 29c8b21 | 2009-09-14 20:05:30 +0000 | [diff] [blame] | 18 | } |
| 19 | var frame = document.createElement("iframe"); |
cgambrell@apple.com | e86a8b7 | 2021-03-01 21:16:20 +0000 | [diff] [blame] | 20 | frame.setAttribute("src", "http://127.0.0.1:8000/loading/resources/protected-resource.py"); |
achristensen@apple.com | 7cd6c5e | 2017-10-25 21:19:19 +0000 | [diff] [blame] | 21 | frame.setAttribute("onload", "setTimeout(secondFrameLoaded, 0)"); |
beidson@apple.com | 29c8b21 | 2009-09-14 20:05:30 +0000 | [diff] [blame] | 22 | document.body.appendChild(frame); |
| 23 | } |
| 24 | |
| 25 | function secondFrameLoaded() |
| 26 | { |
rniwa@webkit.org | 14a295a | 2012-06-13 07:49:51 +0000 | [diff] [blame] | 27 | if (window.testRunner) { |
| 28 | testRunner.setAuthenticationUsername("third"); |
| 29 | testRunner.setAuthenticationPassword("third-pw"); |
beidson@apple.com | 29c8b21 | 2009-09-14 20:05:30 +0000 | [diff] [blame] | 30 | } |
| 31 | var frame = document.createElement("iframe"); |
cgambrell@apple.com | e86a8b7 | 2021-03-01 21:16:20 +0000 | [diff] [blame] | 32 | frame.setAttribute("src", "http://127.0.0.1:8000/loading/resources/protected-resource.py"); |
achristensen@apple.com | 7cd6c5e | 2017-10-25 21:19:19 +0000 | [diff] [blame] | 33 | frame.setAttribute("onload", "setTimeout(thirdFrameLoaded, 0)"); |
beidson@apple.com | 29c8b21 | 2009-09-14 20:05:30 +0000 | [diff] [blame] | 34 | document.body.appendChild(frame); |
| 35 | } |
| 36 | |
| 37 | function thirdFrameLoaded() |
| 38 | { |
rniwa@webkit.org | 14a295a | 2012-06-13 07:49:51 +0000 | [diff] [blame] | 39 | if (window.testRunner) { |
| 40 | testRunner.setAuthenticationUsername("fourth"); |
| 41 | testRunner.setAuthenticationPassword("fourth-pw"); |
beidson@apple.com | 29c8b21 | 2009-09-14 20:05:30 +0000 | [diff] [blame] | 42 | } |
| 43 | var frame = document.createElement("iframe"); |
cgambrell@apple.com | e86a8b7 | 2021-03-01 21:16:20 +0000 | [diff] [blame] | 44 | frame.setAttribute("src", "http://127.0.0.1:8000/loading/resources/othersubresources/protected-resource.py"); |
achristensen@apple.com | 7cd6c5e | 2017-10-25 21:19:19 +0000 | [diff] [blame] | 45 | frame.setAttribute("onload", "setTimeout(fourthFrameLoaded, 0)"); |
beidson@apple.com | 29c8b21 | 2009-09-14 20:05:30 +0000 | [diff] [blame] | 46 | document.body.appendChild(frame); |
| 47 | } |
| 48 | |
| 49 | function fourthFrameLoaded() |
| 50 | { |
rniwa@webkit.org | 14a295a | 2012-06-13 07:49:51 +0000 | [diff] [blame] | 51 | if (window.testRunner) |
| 52 | testRunner.notifyDone(); |
beidson@apple.com | 29c8b21 | 2009-09-14 20:05:30 +0000 | [diff] [blame] | 53 | } |
| 54 | |
achristensen@apple.com | 94739c2 | 2017-10-16 23:10:00 +0000 | [diff] [blame] | 55 | function makeIFrame() { |
| 56 | var iframe = document.createElement("iframe"); |
achristensen@apple.com | 7cd6c5e | 2017-10-25 21:19:19 +0000 | [diff] [blame] | 57 | iframe.setAttribute("onload", "setTimeout(firstFrameLoaded, 0)"); |
cgambrell@apple.com | e86a8b7 | 2021-03-01 21:16:20 +0000 | [diff] [blame] | 58 | iframe.src="resources/subresources/protected-resource.py"; |
achristensen@apple.com | 94739c2 | 2017-10-16 23:10:00 +0000 | [diff] [blame] | 59 | document.body.appendChild(iframe); |
| 60 | } |
| 61 | |
beidson@apple.com | 29c8b21 | 2009-09-14 20:05:30 +0000 | [diff] [blame] | 62 | </script> |
| 63 | </head> |
achristensen@apple.com | 7cd6c5e | 2017-10-25 21:19:19 +0000 | [diff] [blame] | 64 | <body onload="setTimeout(makeIFrame, 0)"> |
beidson@apple.com | 29c8b21 | 2009-09-14 20:05:30 +0000 | [diff] [blame] | 65 | This test makes sure that once an HTTP Basic Auth. protected path is authenticated once, urls that emanate from that path automatically have their credentials sent without a challenge.<br> |
cgambrell@apple.com | e86a8b7 | 2021-03-01 21:16:20 +0000 | [diff] [blame] | 66 | The first frame's path is /loading/resources/subresources/protected-resource.py, and we should get a challenge for it.<br> |
beidson@apple.com | 29c8b21 | 2009-09-14 20:05:30 +0000 | [diff] [blame] | 67 | It will be authorized with first/first-pw.<br> |
cgambrell@apple.com | e86a8b7 | 2021-03-01 21:16:20 +0000 | [diff] [blame] | 68 | The second frame's path is /loading/resources/protected-resource.py, and we should get a challenge for it, because it does not share a common subpath of the previously authorized resource.<br> |
beidson@apple.com | 29c8b21 | 2009-09-14 20:05:30 +0000 | [diff] [blame] | 69 | It will be authorized with second/second-pw.<br> |
cgambrell@apple.com | e86a8b7 | 2021-03-01 21:16:20 +0000 | [diff] [blame] | 70 | The third frame's path is also /loading/resources/protected-resource.py, and we should *not* get a challenge for it because we authorized to this path for the second frame.<br> |
beidson@apple.com | 29c8b21 | 2009-09-14 20:05:30 +0000 | [diff] [blame] | 71 | It will be authorized with second/second-pw.<br> |
cgambrell@apple.com | e86a8b7 | 2021-03-01 21:16:20 +0000 | [diff] [blame] | 72 | The fourth frame's path is /loading/resources/othersubresources/protected-resource.py, and we should *not* get a challenge for it, because it has a common subpath with the previously authorized second and third frames.<br> |
beidson@apple.com | 29c8b21 | 2009-09-14 20:05:30 +0000 | [diff] [blame] | 73 | It will be authorized with second/second-pw.<br> |
beidson@apple.com | 29c8b21 | 2009-09-14 20:05:30 +0000 | [diff] [blame] | 74 | </body> |
| 75 | </html> |