From 5a23a566633681848a394ac1c5435140fdc1b2fe Mon Sep 17 00:00:00 2001 From: "radha%netscape.com" Date: Fri, 20 Sep 2002 19:10:23 +0000 Subject: [PATCH] Fix for bug # 159659. urlbar spoofing with wyciwyg://. r=adamlock, mstolz, sr=darin. Make sure normal loads of wyciwyg url don't go through nsDocShell::InternalLoad(). git-svn-id: svn://10.0.0.236/trunk@130166 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 02dc9891d50..5680ca9265a 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -4726,7 +4726,7 @@ nsDocShell::InternalLoad(nsIURI * aURI, nsIRequest** aRequest) { nsresult rv = NS_OK; - + // Initialize aDocShell/aRequest if (aDocShell) { *aDocShell = nsnull; @@ -4735,6 +4735,15 @@ nsDocShell::InternalLoad(nsIURI * aURI, *aRequest = nsnull; } + // wyciwyg urls can only be loaded through history. Any normal load of + // wyciwyg through docshell is illegal. Disallow such loads. + if (aURI && (aLoadType & LOAD_CMD_NORMAL)) { + PRBool isWyciwyg = PR_FALSE; + rv = aURI->SchemeIs("wyciwyg", &isWyciwyg); + if ((isWyciwyg && NS_SUCCEEDED(rv)) || NS_FAILED(rv)) + return NS_ERROR_FAILURE; + } + // // First, notify any nsIContentPolicy listeners about the document load. // Only abort the load if a content policy listener explicitly vetos it!