Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector/security/main-origin-assigned-despite-request-missing.html

Issue 2756983002: [DevTools] Fallback to MainFrameNavigated event url in Security panel (Closed)
Patch Set: Rebase, change const to let Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/security/main-origin-assigned-despite-request-missing-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/inspector/security/main-origin-assigned-despite-request-missing.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/security/main-origin-assigned-despite-request-missing.html b/third_party/WebKit/LayoutTests/http/tests/inspector/security/main-origin-assigned-despite-request-missing.html
new file mode 100644
index 0000000000000000000000000000000000000000..bf22953812baee3adf2cba6ebc6b6aa11b3ee13e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/security/main-origin-assigned-despite-request-missing.html
@@ -0,0 +1,38 @@
+<html>
+<head>
+<script src="../inspector-test.js"></script>
+<script src="../security-test.js"></script>
+<script>
+ function test()
+ {
+ //** @type {!Protocol.Security.InsecureContentStatus} */
+ var insecureContentStatus = { ranMixedContent: false, displayedMixedContent: false, ranContentWithCertErrors: false, displayedContentWithCertErrors: false, ranInsecureContentStyle: Protocol.Security.SecurityState.Insecure, displayedInsecureContentStyle: Protocol.Security.SecurityState.Neutral };
+ InspectorTest.mainTarget.model(Security.SecurityModel).dispatchEventToListeners(Security.SecurityModel.Events.SecurityStateChanged, new Security.PageSecurityState(Protocol.Security.SecurityState.Secure, true, [], insecureContentStatus, null));
+
+ const page_url = InspectorTest.resourceTreeModel.mainFrame.url;
+ const page_origin = Common.ParsedURL.extractOrigin(page_url);
+ InspectorTest.addResult("Page origin: " + page_origin);
+ // Fire a Main Frame Navigation event without firing a NetworkRequest first.
+ InspectorTest.mainTarget.model(SDK.ResourceTreeModel).dispatchEventToListeners(SDK.ResourceTreeModel.Events.MainFrameNavigated, InspectorTest.resourceTreeModel.mainFrame);
+ // Validate that this set the MainOrigin in the sidebar
+ const detectedMainOrigin = Security.SecurityPanel._instance()._sidebarTree._mainOrigin;
+ InspectorTest.addResult("Detected main origin: " + detectedMainOrigin);
+
+ // Send subdownload resource requests to other origins.
+ const request1 = new SDK.NetworkRequest(InspectorTest.mainTarget, 0, "https://foo.test/favicon.ico", page_url, 0, 0, null);
+ InspectorTest.dispatchRequestFinished(request1);
+ const request2 = new SDK.NetworkRequest(InspectorTest.mainTarget, 0, "https://bar.test/bar.css", page_url, 0, 0, null);
+ InspectorTest.dispatchRequestFinished(request2);
+
+ // Send one request to the Same Origin as the original page to ensure it appears in the group.
+ const request3 = new SDK.NetworkRequest(InspectorTest.mainTarget, 0, detectedMainOrigin + "/favicon.ico", page_url, 0, 0, null);
+ InspectorTest.dispatchRequestFinished(request3);
+ InspectorTest.dumpSecurityPanelSidebarOrigins();
+ InspectorTest.completeTest();
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Tests that the Main Origin is assigned even if there is no matching Request.</p>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/security/main-origin-assigned-despite-request-missing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698