| <!DOCTYPE html> |
| <html> |
| <body> |
| <script src="../../resources/js-test.js"></script> |
| <script> |
| description("Tests that javascript URL execute in the right context when set as href on an anchor with a target popup."); |
| jsTestIsAsync = true; |
| |
| function didRunJSURLInContext(_contextName) |
| { |
| contextName = _contextName; |
| // Since the anchor has target="testPopup", the javascript URL should execute in the context of the popup, not the top frame. |
| shouldBeEqualToString("contextName", "testPopup"); |
| finishJSTest(); |
| } |
| |
| onload = () => { |
| window.name = "topWindow"; |
| document.getElementById("testAnchor").click(); |
| }; |
| </script> |
| <a id="testAnchor" target="testPopup" href="javascript:opener.didRunJSURLInContext(window.name);" style="display:none">Click me</a> |
| </body> |
| </html> |