OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../inspector-test.js"></script> |
| 4 <script src="../security-test.js"></script> |
| 5 <script> |
| 6 function test() |
| 7 { |
| 8 //** @type {!Protocol.Security.InsecureContentStatus} */ |
| 9 var insecureContentStatus = { ranMixedContent: false, displayedMixedContent:
false, ranContentWithCertErrors: false, displayedContentWithCertErrors: false,
ranInsecureContentStyle: Protocol.Security.SecurityState.Insecure, displayedInse
cureContentStyle: Protocol.Security.SecurityState.Neutral }; |
| 10 InspectorTest.mainTarget.model(Security.SecurityModel).dispatchEventToListen
ers(Security.SecurityModel.Events.SecurityStateChanged, new Security.PageSecurit
yState(Protocol.Security.SecurityState.Secure, true, [], insecureContentStatus,
null)); |
| 11 |
| 12 const page_url = InspectorTest.resourceTreeModel.mainFrame.url; |
| 13 const page_origin = Common.ParsedURL.extractOrigin(page_url); |
| 14 InspectorTest.addResult("Page origin: " + page_origin); |
| 15 // Fire a Main Frame Navigation event without firing a NetworkRequest first. |
| 16 InspectorTest.mainTarget.model(SDK.ResourceTreeModel).dispatchEventToListene
rs(SDK.ResourceTreeModel.Events.MainFrameNavigated, InspectorTest.resourceTreeMo
del.mainFrame); |
| 17 // Validate that this set the MainOrigin in the sidebar |
| 18 const detectedMainOrigin = Security.SecurityPanel._instance()._sidebarTree._
mainOrigin; |
| 19 InspectorTest.addResult("Detected main origin: " + detectedMainOrigin); |
| 20 |
| 21 // Send subdownload resource requests to other origins. |
| 22 const request1 = new SDK.NetworkRequest(InspectorTest.mainTarget, 0, "https:
//foo.test/favicon.ico", page_url, 0, 0, null); |
| 23 InspectorTest.dispatchRequestFinished(request1); |
| 24 const request2 = new SDK.NetworkRequest(InspectorTest.mainTarget, 0, "https:
//bar.test/bar.css", page_url, 0, 0, null); |
| 25 InspectorTest.dispatchRequestFinished(request2); |
| 26 |
| 27 // Send one request to the Same Origin as the original page to ensure it app
ears in the group. |
| 28 const request3 = new SDK.NetworkRequest(InspectorTest.mainTarget, 0, detecte
dMainOrigin + "/favicon.ico", page_url, 0, 0, null); |
| 29 InspectorTest.dispatchRequestFinished(request3); |
| 30 InspectorTest.dumpSecurityPanelSidebarOrigins(); |
| 31 InspectorTest.completeTest(); |
| 32 } |
| 33 </script> |
| 34 </head> |
| 35 <body onload="runTest()"> |
| 36 <p>Tests that the Main Origin is assigned even if there is no matching Request.<
/p> |
| 37 </body> |
| 38 </html> |
OLD | NEW |