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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 18865003: Do not allow HTTP refresh headers to refresh to javascript: URLs. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 2730 matching lines...) Expand 10 before | Expand all | Expand 10 after
2741 m_styleSheetCollection->setPreferredStylesheetSetName(content); 2741 m_styleSheetCollection->setPreferredStylesheetSetName(content);
2742 styleResolverChanged(DeferRecalcStyle); 2742 styleResolverChanged(DeferRecalcStyle);
2743 } else if (equalIgnoringCase(equiv, "refresh")) { 2743 } else if (equalIgnoringCase(equiv, "refresh")) {
2744 double delay; 2744 double delay;
2745 String url; 2745 String url;
2746 if (frame && parseHTTPRefresh(content, true, delay, url)) { 2746 if (frame && parseHTTPRefresh(content, true, delay, url)) {
2747 if (url.isEmpty()) 2747 if (url.isEmpty())
2748 url = m_url.string(); 2748 url = m_url.string();
2749 else 2749 else
2750 url = completeURL(url).string(); 2750 url = completeURL(url).string();
2751 frame->navigationScheduler()->scheduleRedirect(delay, url); 2751 if (!protocolIsJavaScript(url)) {
2752 frame->navigationScheduler()->scheduleRedirect(delay, url);
2753 } else {
2754 String message = "Refused to refresh " + m_url.elidedString() + " to a javascript: URL";
2755 addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, mess age);
2756 }
2752 } 2757 }
2753 } else if (equalIgnoringCase(equiv, "set-cookie")) { 2758 } else if (equalIgnoringCase(equiv, "set-cookie")) {
2754 // FIXME: make setCookie work on XML documents too; e.g. in case of <htm l:meta .....> 2759 // FIXME: make setCookie work on XML documents too; e.g. in case of <htm l:meta .....>
2755 if (isHTMLDocument()) { 2760 if (isHTMLDocument()) {
2756 // Exception (for sandboxed documents) ignored. 2761 // Exception (for sandboxed documents) ignored.
2757 toHTMLDocument(this)->setCookie(content, IGNORE_EXCEPTION); 2762 toHTMLDocument(this)->setCookie(content, IGNORE_EXCEPTION);
2758 } 2763 }
2759 } else if (equalIgnoringCase(equiv, "content-language")) 2764 } else if (equalIgnoringCase(equiv, "content-language"))
2760 setContentLanguage(content); 2765 setContentLanguage(content);
2761 else if (equalIgnoringCase(equiv, "x-dns-prefetch-control")) 2766 else if (equalIgnoringCase(equiv, "x-dns-prefetch-control"))
(...skipping 2487 matching lines...) Expand 10 before | Expand all | Expand 10 after
5249 { 5254 {
5250 return DocumentLifecycleNotifier::create(this); 5255 return DocumentLifecycleNotifier::create(this);
5251 } 5256 }
5252 5257
5253 DocumentLifecycleNotifier* Document::lifecycleNotifier() 5258 DocumentLifecycleNotifier* Document::lifecycleNotifier()
5254 { 5259 {
5255 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); 5260 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier());
5256 } 5261 }
5257 5262
5258 } // namespace WebCore 5263 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/security/no-javascript-refresh-static-expected.txt ('k') | Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698